This document is based on this functional spec document that Tom Mueller, Sahoo, Siva and myself participated in.

Architectural Components 

The PaaS feature consists of the architectural components described in this section.  These components are services that reside within an instance of GlassFish server, but depending on the configured topology, they may or may not be within the same server.

The Platform As A Service (PaaS) feature is about considering the Java EE ecosystem as a set of services interoperating. These services can be of different types like a Java EE Service Type (Java EE Stack) or a Persistence Service (a Database). In GlassFish 3.2, we propose to add capabilities to understand Java EE application's explicit and implicit services requirements. Such requirements can then be implemented using basically three building blocks. At the lower level, the Infrastructure Management Service is responsible for managing hardware resources and allocate virtual machines. The IMS has no understanding of Java EE Services types. The Orchestrator resides above the IMS layer and is responsible for understanding the Services requirements of deployed applications, it delegates to the IMS the provision of virtual machines. Finally, the Elasticity manager is responsible for monitoring the runtime environment and dial up or down the services availability based on constraints set by the deployer or administrator.

The diagram below show how these components fits together :

Unknown macro: {gliffy}

IaaS Management Service (IMS)

The Infrastructure as a Service (IaaS) management service provides an abstraction of the IaaS cloud to the GlassFish software.  This abstraction encapsulates various APIs that are available for managing cloulds. 

The IaaS management service is responsible for carrying out the decisions made by the elasticity manager and the orchestrator. If the IaaS provides VM-level monitoring services, then the IaaS management service communicates information about IaaS decisions (such as moving a VM) to the elasticity manager, which then includes that information into its elasticity algorithms. It is capable of allocating and de-allocating virtual machines across all groups defined in its configuration. Virtual machines are allocated across groups (virtualization management decision tbd) but the IaaS management service is responsible for deciding on which bare metal hardware such virtual machines should run.

Server Pools

Machines are divided into server pools. Server Pools can be geographically determined, or can be based on network boundaries. Such pools are composed of physical machines and share the same virtualization technology (libvirt, jclouds..). It is unclear how well such groups will map to public clouds offerings (at worst I suppose you have a single group).

The group will be managed by an IaaS management service which has the following APIs.

  • group management (add, remove machines).
  • activate/suspend machines.
  • have pre-defined set of templates that can be used to virtual machines instantiation
  • allocate/deallocate virtual machines
  • monitor and expose monitoring data of allocated virtual machines

The IaaS management service will not duplicate the DAS responsibilities of maintaining a list of clusters or list of deployed applications. It's main responsibility is to provide bare metal and run VMs on it. I consider the IaaS management service stateless artifacts. The IaaS management service could be implemented as a standalone component on top of GlassFish nucleus distribution.

Templates

GlassFish 3.2 will be a template based virtualization solution. Templates are virtual machines disk that can be duplicated on demand to create a new virtual machine instance. Templates are usually provided by the IT department of corporations and very little assumption should be made about its content. Templates will need to provide a GlassFish installation or a way to automatically install GlassFish by providing a SSH access for instance.

Templates will provide one to many services implementation (Java EE Service, Database Service, MQ Service, etc...) which must be identified when registering a template to the system.

Orchestrator

The orchestrator is the top-level services that provides the ability to deploy an application to the cloud. It is responsible for:

  • Service Dependency Discovery - Determining what services an application requires when it is deployed, either through implicit dependencies or through explicit+ dependencies specified through a clould.xml file. 
  • Service Provisioning - Requesting the necessary VMs or servers from the virtualization management layer and provisioning the needed services on those VMs.
  • Service Association - Associating the provisioned service with the application in GlassFish by defining resources.
  • Deployment - Deploying the application within GlassFish so that it makes use of the provisioned services.

The orchestrator uses a set of service plugins to allow applications to be deployed with various services such as a database, JMS, etc. 

Elasticity Manager

The elasticity manager  is responsible for providing elasticity to the deployed application.  It is responsible for:

  • Metric collection - Gathering data about application use and machine resources that is used as input to the decision making process.
  • Scaling decisions - Make decisions about increasing or decreasing the number of instances used to run the application, or other methods of scaling such as informing users. 
  • Action execution - Once a decision is made, the elasticity manager has to implement that decision.

Domains Manager

An optional deliverable of 3.2 is the Domains Manager.

The Domains Manager is responsible for automating the process of creating a domain within the cloud.  The domains manager may be a simple command line interface that is used by the PaaS admin to create a domain on behalf of a GlassFish user, or it could provide a GUI console that would provide a single landing point for users to create a domain (or domains), and it could even provide a simplified interface for application deployment.

The domains manager is an optional part of the architecture, as the PaaS admin could manually allocate a VM from the cloud, create a GlassFish domain on it, and configure that domain to use the IMS. 

The domains manager could have the following functions:

For GlassFish Users:

  • create account and/or login to the a console
  • choose which cloud to use, collect cloud credentials and store them in the IaaS management service
  • create a Java EE domain by using the IaaS management service to create a VM, put GlassFish there, create a domain, pass IaaS management service location to the domain. (This includes potentially choosing from different VM options (OS type, web/full distribution, etc.)
  • direct the user to the console for the domain
  • show a list of domains that the user has created
  • delete a domain
  • provide an integrated console to deploy applications directly to a domain, possibly hiding the existence of domains in the interface
  • job scheduling for scheduled tasks with respect to the PaaS infrastructure - an example is backing up domains and configurations.
  • reporting on monitoring of physical resources and providing a listener based notification for exhaustion of physical resources as cloud demand nears exceeding supply.

For the PaaS Administrator

  • view the GlassFish users (and do everything a user can do)
  • configure which IaaS management service is used
  • provide a UI for the IaaS management service (this is TBD - the IaaS management service could have its own UI)

The domains manager acts as an interface point for users of the PaaS. It has the ability to create a VM for a DAS. But it doesn't analyze applications, create VMs for clustered instances, create VMs for other services. It doesn't have a pluggable interface for service providers.

The domains manager runs on a GlassFish DAS.

The domains manager lifecycle begins with a manual installation of GlassFish with the PaaS feature. A separate GlassFish domain is needed to run the domains manager itself, i.e., separate from the domains that are being managed by users of the domains manager. If this GlassFish domain is to be run within the cloud itself, a VM for the domain would need to be manually created using tools from the cloud infrastructure.

Domains Manager Data Store

The domains manager stores the following information

  • user store configuration (how to authenticate and authorize users)
  • IaaS management service configuration information (where is the IaaS Management Service to be used by this domains manager)
  • per-user domain configuration information
    • where is the DAS (console URL, VM location)
    • what IaaS management service it is using

DAS Creation

How the GlassFish cloud environment bootstraps itself depends on the deployment environment.

  1. Domains Manager present. The user will register itself to domains manager and request for a domain creation. Domains manager will allocate a virtual machine and setup a DAS on that machine. It should be possible to run the DAS on bare metal. It should also be possible to attach an existing DAS to domains manager (tbd). Domains manager will need to configure the DAS with the right IaaS Management configuration so the DAS can request virtual machines.
  2. Domains Manager not present. The user will need to install manually a DAS on bare metal or in a Virtual Machine and configure it appropriately with the right IaaS definitions so the DAS can use the IMS to allocate/deallocate virtual machines.

Deployment

The most important difference with the PaaS Feature versus 3.1 is the deployment use case. In 3.1 the users were most of the time performing the following tasks when deploying an application to a multi-instance environments :

  • create a cluster
  • for each physical boxes, create a node
  • for each node, create one or more instances in that cluster
  • provision services needed by the application (databases, JMS, etc.)
  • define resources within the application server to associate those services with application identifiers
  • deploy applications to the cluster.

As you can see, the physical layout of the deployment is set before the deployment itself and the elasticity of the cluster can be achieved though manually adding instances to an existing cluster.

With the PaaS feature, the dynamics will be reversed where the hardware is mapped to a deployment request and the elasticity is entirely managed by the PaaS architecture (of course manual modification could still be possible, tbd).The following steps is how the system could handle a cloud deployment request.

  • deploy an application
    • orchestrator pre-deploy (read DDs and annotations) + explicit cloud metadata to determine the required services and deployment environment (number of vms, types of vms).
    • orchestrator creates a cluster (similar to a 3.1 cluster, maybe invisible to users).
    • orchestrator requests to IaaS management service for allocation of Virtual Machine (type, number). By default, a round robin within the IaaS management service list might suffice but more elaborated algorithm (probably with metadata input) could be used.
    • IaaS management service will start hardware machines
    • IaaS management service will install the requested virtual machines types (in the started machines or underused ones, at his discretion).
    • IaaS management service will return the VMs information to the orchestrator
    • Orchestrator will use the new virtual machine information to provision services (via service plugins) and configure the cluster
    • Orchestrator will associate services with resources
    • Normal deployment follows.

It is still unclear at this point where the virtual machines templates will reside. It is entirely possible that we choose to associate template management at the IaaS management service level as it is usually a primary function of the same IT department (the IaaS admin responsibilities).

Elasticity

Elasticity will be mostly managed by the PaaS architecture within the DAS where instances can be provisioned or decommissioned following events, monitoring triggers. Let's have a look at the work the PaaS architecture will have to do to add a new GlassFish instance to a deployment environment.

  • The Elasticity manager receives notification that application X needs a new instance (maybe through a deamon running, tbd)
  • The Elasticity manager requests through the IaaS Management Service for a new Virtual Machine.
  • The Virtual Machine is added to the Application X's domain as a GlassFish node and an clustered instance on that node
  • Normal 3.1 replication to the new GlassFish instance follows.

OverallDesign.png (image/png)