KEMBAR78
GIDS 2012: PaaSing a Java EE Application | PDF
PaaSing a Java EE Application
Arun Gupta, Java EE & GlassFish Guy
blogs.oracle.com/arungupta, @arungupta
 1   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
The following is intended to outline our general product
    direction. It is intended for information purposes only, and
    may not be incorporated into any contract. It is not a
    commitment to deliver any material, code, or functionality,
    and should not be relied upon in making purchasing
    decisions. The development, release, and timing of any
    features or functionality described for Oracle s products
    remains at the sole discretion of Oracle.


2   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Cloud Computing
    Essential Characteristics
    •  On-demand Self-Service
    •  Broad network access
    •  Resource Pooling
    •  Rapid Elasticity
    •  Measured Service


                                                                           (*) NIST Definition of Cloud Computing – 800-145



3   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Cloud Computing
    Deployment Models
    •  Private Cloud
          –  Operated solely for an organization
          –  On-premise or off-premise
    •  Community Cloud
    •  Public Cloud
          –  Access to general public
    •  Hybrid Cloud
          –  2 or more clouds, Cloud Bursting
                                                                           (*) NIST Definition of Cloud Computing – 800-145

4   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Cloud Computing
    Service Models
    •  Software as a Service (SaaS)
    •  Platform as a Service (PaaS)
          –  Deploy customer-created applications
          –  Using languages and tools supported by PaaS Provider
          –  No control of underlying cloud infrastructure
          –  Control over deployed applications, hosting env. Configurations
    •  Infrastructure as a Service (IaaS)
                                                                           (*) NIST Definition of Cloud Computing – 800-145



5   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
PaaS and Java EE
    Java EE design principles and capabilities
    •  Common programming model for enterprise developers
    •  Runtime handles application’s infrastructure concerns
    •  Declarative resource references
    •  Scalable (scale-out) component models




6   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
PaaS and Java EE
    Java EE 7: “Making Java EE ready for the cloud”
    •  Enhancements
          –  New Roles for PaaS
          –  Services as first class citizens
          –  Multitenancy
    •  Evolution, not a revolution!




7   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
PaaS Implications on Deployment
    •  Simplified PaaS Application Deployment
         –  Single-click, self-service, “push to cloud”




8   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
PaaS Implications on Deployment
    Services Management
    •  Automatic Service Provisioning and Management
          –  Service Orchestration
                   •  Automatic Service Dependency discovery
                   •  Service Provisioning and Association
          –  Handle operational infrastructure concerns automatically
                   •  Network configuration, HA, Clustering, Load Balancing …
          –  Application and Service deployment versioning




9   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
PaaS Implications on Deployment
     Virtualized runtimes
     •  Scalable virtualized on-demand environment
           –  Support multiple cloud deployment models
                    •  Public, Private, Hybrid
           –  PaaS Provider decoupled from IaaS infrastructure
           –  Multi-tenancy




10   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
PaaS Implications on Deployment
     Scaling and Operations
     •  Automatic Scaling of Services
           –  Scale to application’s needs
           –  User-defined alerts and actions
     •  Control over application hosting environment
           –  Flexibility in choice of application services, framework
           –  Rich service configuration
           –  Shared services
           –  Extensible runtime to allow new Services


11   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Demo
     PaaSing a Java EE Application in the Cloud




     glassfish.org/javaone2011


12   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Conference Planning in the Cloud

Java EE Application

       JSF                                JPA                               Deploy

                                   Services
      EJB                          Metadata
                                                                               <glassfish-services>

                                                                               <service-description init-type="LB" name="ConferencePlanner-lb">

                                                                                   <template id="LBNative"/>

                                                                                   <configurations>

                                                                                      <configuration name="https-port" value="50443"/>

                                                                                      <configuration name="ssl-enabled" value="false"/>

                                                                                      <configuration name="http-port" value="50080"/>

                                                                                   </configurations></service-description>

                                                                               <service-description init-type="JavaEE" name="ConferencePlanner">

                                                                                   <characteristics>

                                                                                      <characteristic name="service-type" value="JavaEE"/>

                                                                                   </characteristics>

                                                                                   <configurations>

                                                                                      <configuration name="max.clustersize" value="4"/>

                                                                                      <configuration name="min.clustersize" value="2"/>

                                                                                   </configurations>

                                                                               </service-description>"
                                                                               . . .

                                                                               </glassfish-services>"



13   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Service Provisioning

                                                                              Load
                                                                             Balancer



                                                 Java EE                    Java EE    ...   Java EE


                                                                            Database



14   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
GlassFish PaaS Runtime Architecture




15   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Service Terminology

     •  Service
     •  ServiceType
           –  Java EE, RDBMS, HTTP Load Balancer etc.
     •  Services – scope and lifecycle
           –  Provisioned Services
                    •  Application scoped
                    •  Shared
           –  External (a priori) services


16   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Specification of Service Metadata

     •  Optional!
           –  When not specified (vanilla EE app archives)
                    •  Orchestration Engine automatically handles discovery of service deps
                    •  Automatic wiring to default Service Templates
           –  Metadata may be specified when:
                    •  Finer grain control of application environment desired
                    •  Application-specific Service configuration




17   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Specification of Service Metadata

     •  Service Definition
           –  Metadata used to provision and configure a Service
                    •  What : Service characteristics (functional and non-functional) →
                       Template matching
                    •  How : Explicit Template specification → Template wiring
     •  Service Reference
           –  An application component’s dependency on a Service
                    •  Explicit : User-specified through deployment descriptors
                    •  Implicit and Discovered: Information contained within the archive


18   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Service Dependency Specification




19   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Sample Service Definition




20   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Sample Service Reference




21   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
GlassFish PaaS Runtime Architecture




22   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
IaaS Management Service (IMS)
     One-liner
        Provide common management interface across different
        virtualization technologies




23   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
IMS




24   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
IMS functionalities
•  Support virtualization definitions
•  Isolates from low level Virtual Machine allocation/interface
  –  Integrates with native solutions through Plug-in/SPI mechanism.
•  Template management
•  ServerPool / Hardware management (depending on the
   virtualization technology).




  25   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Templates
•  A virtual-machine disk
  –  can be duplicated
  –  used to instantiate a virtual-machine.
•  Virtualization Specific
•  Provides 1 to many service types (usually one).
•  Template are customized during the first startup
  –  DAS location
  –  Template parameters like instance name
  –  Customization mechanism is virtualization specific

  26   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
GlassFish PaaS Runtime Architecture




27   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Service Orchestration
     One-liner
         Enable single-click deployment of a PaaS application
        through automatic service dependency discovery,
        service provisioning and service association




28   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Service Dependency Discovery




29   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Service Provisioning




30   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Service Association




31   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
GlassFish PaaS Runtime Architecture




32   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Auto-Scaling
     One-liner
     The ability of a system to automatically adapt to volume of
      traffic without impacting throughput and availability




33   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What we need
     •  To determine the health of Services in the System
          –  Number of metrics can be used
          –  An arbitrary / complex condition need to be evaluated
          –  Arbitrary actions can be taken


     •  A framework that allows
          –  Ability to define new Metric sources easily (Extensible)
          –  Ability to express complex queries easily
          –  Ability to create new Actions easily


34   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Determining State of Services

     •  Monitor System Resources
           –  CPU
                    •  Used and idle CPU times
           –  Memory
                    •  Process memory: Allocated, Resident etc.
                    •  JVM memory: Used, Committed and Max memory
           –  Disk
                    •  Reads, Writes per seconds
                    •  Bytes read, written etc.



35   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Determining State of Services (Contd.)
          –  Monitor Application Related Objects
                   •  HTTP Sessions created / destroyed per second
                   •  Number of HTTP requests that arrived
                   •  Connection Pools: Number of connections acquired / released etc.
                   •  Database Queries executed
                   •  Transaction status: Number of commits / rollbacks
                   •  Response time of a specific URL

          –  Many, many, many other metrics…



36   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
We have metrics. Now what?
     •  Use relevant metrics to determine health of the services
           –  Such as Java EE Clustered Instances, Clustered DB
     •  Use Trends
           –  Average memory usage above 60% for last 10 min
           –  Avg Response times of 90% of requests in last 10 min below 5ms
     •  Use Combinations
           –  Are both CPU and Memory usages high ?
           –  Is CPU usage of Java EE Cluster and number of queries executed
              on Database within certain limits ?


37   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What Actions can you take?
     •  Possible Actions
           –  Send email to admin
           –  Log some info
           –  Scale up / Scale down to meet the load
           –  Send a (JMX) notification
           –  And many, many, many more…




38   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Call to Action

     •  Java EE 7 Expert Group Project
           – http://javaee-spec.java.net
     •  Java EE 7 Reference Implementation
           – http://glassfish.org
     •  The Aquarium
           –  http://blogs.oracle.com/theaquarium

39   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
PaaSing a Java EE Application
Arun Gupta, Java EE & GlassFish Guy
blogs.oracle.com/arungupta, @arungupta
40   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
41   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

GIDS 2012: PaaSing a Java EE Application

  • 1.
    PaaSing a JavaEE Application Arun Gupta, Java EE & GlassFish Guy blogs.oracle.com/arungupta, @arungupta 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 2.
    The following isintended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle s products remains at the sole discretion of Oracle. 2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 3.
    Cloud Computing Essential Characteristics •  On-demand Self-Service •  Broad network access •  Resource Pooling •  Rapid Elasticity •  Measured Service (*) NIST Definition of Cloud Computing – 800-145 3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 4.
    Cloud Computing Deployment Models •  Private Cloud –  Operated solely for an organization –  On-premise or off-premise •  Community Cloud •  Public Cloud –  Access to general public •  Hybrid Cloud –  2 or more clouds, Cloud Bursting (*) NIST Definition of Cloud Computing – 800-145 4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 5.
    Cloud Computing Service Models •  Software as a Service (SaaS) •  Platform as a Service (PaaS) –  Deploy customer-created applications –  Using languages and tools supported by PaaS Provider –  No control of underlying cloud infrastructure –  Control over deployed applications, hosting env. Configurations •  Infrastructure as a Service (IaaS) (*) NIST Definition of Cloud Computing – 800-145 5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 6.
    PaaS and JavaEE Java EE design principles and capabilities •  Common programming model for enterprise developers •  Runtime handles application’s infrastructure concerns •  Declarative resource references •  Scalable (scale-out) component models 6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 7.
    PaaS and JavaEE Java EE 7: “Making Java EE ready for the cloud” •  Enhancements –  New Roles for PaaS –  Services as first class citizens –  Multitenancy •  Evolution, not a revolution! 7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 8.
    PaaS Implications onDeployment •  Simplified PaaS Application Deployment –  Single-click, self-service, “push to cloud” 8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 9.
    PaaS Implications onDeployment Services Management •  Automatic Service Provisioning and Management –  Service Orchestration •  Automatic Service Dependency discovery •  Service Provisioning and Association –  Handle operational infrastructure concerns automatically •  Network configuration, HA, Clustering, Load Balancing … –  Application and Service deployment versioning 9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 10.
    PaaS Implications onDeployment Virtualized runtimes •  Scalable virtualized on-demand environment –  Support multiple cloud deployment models •  Public, Private, Hybrid –  PaaS Provider decoupled from IaaS infrastructure –  Multi-tenancy 10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 11.
    PaaS Implications onDeployment Scaling and Operations •  Automatic Scaling of Services –  Scale to application’s needs –  User-defined alerts and actions •  Control over application hosting environment –  Flexibility in choice of application services, framework –  Rich service configuration –  Shared services –  Extensible runtime to allow new Services 11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 12.
    Demo PaaSing a Java EE Application in the Cloud glassfish.org/javaone2011 12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 13.
    Conference Planning inthe Cloud Java EE Application JSF JPA Deploy Services EJB Metadata <glassfish-services>
 <service-description init-type="LB" name="ConferencePlanner-lb">
 <template id="LBNative"/>
 <configurations>
 <configuration name="https-port" value="50443"/>
 <configuration name="ssl-enabled" value="false"/>
 <configuration name="http-port" value="50080"/>
 </configurations></service-description>
 <service-description init-type="JavaEE" name="ConferencePlanner">
 <characteristics>
 <characteristic name="service-type" value="JavaEE"/>
 </characteristics>
 <configurations>
 <configuration name="max.clustersize" value="4"/>
 <configuration name="min.clustersize" value="2"/>
 </configurations>
 </service-description>" . . .
 </glassfish-services>" 13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 14.
    Service Provisioning Load Balancer Java EE Java EE ... Java EE Database 14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 15.
    GlassFish PaaS RuntimeArchitecture 15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 16.
    Service Terminology •  Service •  ServiceType –  Java EE, RDBMS, HTTP Load Balancer etc. •  Services – scope and lifecycle –  Provisioned Services •  Application scoped •  Shared –  External (a priori) services 16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 17.
    Specification of ServiceMetadata •  Optional! –  When not specified (vanilla EE app archives) •  Orchestration Engine automatically handles discovery of service deps •  Automatic wiring to default Service Templates –  Metadata may be specified when: •  Finer grain control of application environment desired •  Application-specific Service configuration 17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 18.
    Specification of ServiceMetadata •  Service Definition –  Metadata used to provision and configure a Service •  What : Service characteristics (functional and non-functional) → Template matching •  How : Explicit Template specification → Template wiring •  Service Reference –  An application component’s dependency on a Service •  Explicit : User-specified through deployment descriptors •  Implicit and Discovered: Information contained within the archive 18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 19.
    Service Dependency Specification 19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 20.
    Sample Service Definition 20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 21.
    Sample Service Reference 21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 22.
    GlassFish PaaS RuntimeArchitecture 22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 23.
    IaaS Management Service(IMS) One-liner Provide common management interface across different virtualization technologies 23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 24.
    IMS 24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 25.
    IMS functionalities •  Supportvirtualization definitions •  Isolates from low level Virtual Machine allocation/interface –  Integrates with native solutions through Plug-in/SPI mechanism. •  Template management •  ServerPool / Hardware management (depending on the virtualization technology). 25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 26.
    Templates •  A virtual-machinedisk –  can be duplicated –  used to instantiate a virtual-machine. •  Virtualization Specific •  Provides 1 to many service types (usually one). •  Template are customized during the first startup –  DAS location –  Template parameters like instance name –  Customization mechanism is virtualization specific 26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 27.
    GlassFish PaaS RuntimeArchitecture 27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 28.
    Service Orchestration One-liner Enable single-click deployment of a PaaS application through automatic service dependency discovery, service provisioning and service association 28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 29.
    Service Dependency Discovery 29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 30.
    Service Provisioning 30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 31.
    Service Association 31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 32.
    GlassFish PaaS RuntimeArchitecture 32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 33.
    Auto-Scaling One-liner The ability of a system to automatically adapt to volume of traffic without impacting throughput and availability 33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 34.
    What we need •  To determine the health of Services in the System –  Number of metrics can be used –  An arbitrary / complex condition need to be evaluated –  Arbitrary actions can be taken •  A framework that allows –  Ability to define new Metric sources easily (Extensible) –  Ability to express complex queries easily –  Ability to create new Actions easily 34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 35.
    Determining State ofServices •  Monitor System Resources –  CPU •  Used and idle CPU times –  Memory •  Process memory: Allocated, Resident etc. •  JVM memory: Used, Committed and Max memory –  Disk •  Reads, Writes per seconds •  Bytes read, written etc. 35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 36.
    Determining State ofServices (Contd.) –  Monitor Application Related Objects •  HTTP Sessions created / destroyed per second •  Number of HTTP requests that arrived •  Connection Pools: Number of connections acquired / released etc. •  Database Queries executed •  Transaction status: Number of commits / rollbacks •  Response time of a specific URL –  Many, many, many other metrics… 36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 37.
    We have metrics.Now what? •  Use relevant metrics to determine health of the services –  Such as Java EE Clustered Instances, Clustered DB •  Use Trends –  Average memory usage above 60% for last 10 min –  Avg Response times of 90% of requests in last 10 min below 5ms •  Use Combinations –  Are both CPU and Memory usages high ? –  Is CPU usage of Java EE Cluster and number of queries executed on Database within certain limits ? 37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 38.
    What Actions canyou take? •  Possible Actions –  Send email to admin –  Log some info –  Scale up / Scale down to meet the load –  Send a (JMX) notification –  And many, many, many more… 38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 39.
    Call to Action •  Java EE 7 Expert Group Project – http://javaee-spec.java.net •  Java EE 7 Reference Implementation – http://glassfish.org •  The Aquarium –  http://blogs.oracle.com/theaquarium 39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 40.
    PaaSing a JavaEE Application Arun Gupta, Java EE & GlassFish Guy blogs.oracle.com/arungupta, @arungupta 40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 41.
    41 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.