Showing posts with label Multi-Tenancy. Show all posts
Showing posts with label Multi-Tenancy. Show all posts

Thursday, September 20, 2012

From MVM to Multi-Tenant JVM

Last month, at the JVM Language Summit, Ryan Sciampacone from IBM shared his experience with extending IBM J9 JVM to host multiple applications.  You can view his talk on Oracle Media Network. You can also download a copy of his presentation here. Ryan goes into fairly good details about the challenges and lessons learned, so I recommend taking a look at it.
Across the world in Ireland, Waratek recently announced availability of Waratek Cloud VM for Java.   This JVM extends OpenJDK (HotSpot VM) with a virtualization layer that isolates applications in Java Virtual Containers.  In addition to application isolation, Waratek’s solution offers a container management interface based on Virsh, and resource monitoring… I think this is a very cool solution that could potentially shape ideas to JVM multi-tenancy implementation.  You can watch a presentation on their solution here, and find more information on their solution here. 
-----
Background: The current model of one JVM per application is inefficient.  It leads to JVM sprawls and inefficient usage of infrastructure resources.
The JVM specification defines the JVM as an abstract computing machine. It describes the Class file format,  machine instruction set, rules/constraints on class loading, etc., but contains no requirements or models for the implementation of the JVM’s internal processes, task management or resource management for secure sharing of the JVM by multiple applications. 
Over the last decade, before multi-tenancy had become such a popular (and overused) term, there have been a number of related efforts to address the issues:
  • JSR 121: Application Isolation API  – Proposes a language construct called “Isolate” as the means to instantiate isolated Java applications on the JVM.  The spec also addresses isolate-to-isolate communication. 
  • JSR 284: Resource Consumption Management (RCM) API – Since there will be different applications sharing a JVM, there needs to be a way to make sure a rogue app does not impact the performance of another app.   JSR 284 proposes a standard API to bind RCM policies to applications running on the JVM.  This JSR is quite interesting, as it has provisions for resource reservation as well setting constraints / quota for resource consumption.
Sun had a couple of reference implementations (MVM, MVM2).  For a complete list of related papers, visit Project Barcelona.) 
SAP also did its own implementation of application isolation scheme by implementing a pool of VMs and a dispatcher to schedule work in the VMs (see Process Attachable Virtual Machines,  Virtual Machine Container).
-----
Java multi-tenancy
There are two usecases for JVM multi-tenancy:
Print
N.B. In the diagram above, I specify App, but App Server should be implied as well.
In option B, you have multiple applications using the JVM.  This is pretty straight forward.  In option A, you have a situation where multiple customers or business units (i.e. shared services) need to share the application securely.
In the case of option A, let’s assume an application has been implemented as a multi-tenant solution using JEE framework.  The App Server interfaces with the underlying JVM to provision new tenants (new isolates).  As part of the tenant provisioning, the App Server uses the RCM interface to set tenant policies.  The JVM monitors the RCM policies, and takes appropriate action.  As application requests hit the App Server, the App Server uses some tenant context scheme to determine which isolate it should go to….As the request flows through the different tiers of the JEE solution, the App Server makes sure only the tenant only accesses the JEE resources that it is authorized to use.  In case of an isolate loop or application runtime environment crash, the JVM applies RCM policies to handle the situation…
In the example above, we can see that there are requirements for the JEE framework as well as JVM runtime to support multi-tenancy.  And, we also should not forget that there re other languages running on the JVM.  Additional requirements may need to be considered.
-----
So, where are we now?
The JCP will standardize multi-tenancy in the Java Platform, but this will probably not happen in JDK8 given the current schedule and the focus for JDK8 (productivity, modularity, performance).
There should be more information available by Jan 2013. 
-----
Final thoughts
With JDK8, there will be a new Java module system (Jigsaw) replacing the old JAR format and class loading from Classpath…  The new format will contain metadata about the packages, classes, and dependencies using a new set of annotations (i.e. version, imports, exports, …), and reflection APIs to improve class loading and sharing, performance,… For some background, have a look at JSR 294 and JSR 277.   This will play an important supporting role in implementing multi-tenancy support in the JVM efficiently.
Clearly, JVM multi-programming / multi-tenancy capabilities will bring economic benefits to both enterprise customers and vendors. It think it might also trigger a new wave of JVM innovations like Waratek.

Sunday, July 31, 2011

Enterprise Architects should consider multi-tenancy design patterns & best practices to deliver better shared solutions

Recently, I came across a few good research papers on Cloud and Multi-tenancy design patterns. Typically, the primary audience for such articles is architects and technologists working for service providers (IaaS, PaaS, SaaS, BPaaS…) or software vendors. However, enterprise architects can also apply these architectural principles and patterns to build more cost-effective and easier-to-maintain shared solutions.

In this post, I won’t bore you with an introduction of different Cloud services and taxonomy. I assume you’ve heard it all already. If not, have a look here or just google “Cloud Computing”. My intention is to explain multi-tenancy and key characteristics, review some of the patterns and organize them in logical groups, and provide some references for further examination.

Background
For the last decade, large multi-national enterprises have progressively consolidated IT organizations / functions into Global Shared Services. This is a common strategy to reduce costs by eliminating redundancies, improve operational efficiencies by reducing technology stacks, vendors, and required skills through portfolio rationalization and standardization.

In such organizations, Enterprise Architects are routinely involved in building cost-effective shared solutions. These solutions are used by different business units around the globe requiring BU-specific look & feel, application behavior, and compliance with local customs & regulations.

In the enterprise, a common approach to building shared solutions involves deploying multiple instances of an application or package to accommodate BU-specific functional customizations and non-functional requirements (i.e. load, performance, security…) on a shared infrastructure.

Instances are typically separated in different logical partitions or virtual machines, have their own dedicated resources (application server, middleware, database…), and are configured to meet BU-specific requirements.

Over time, what started out as a common code-base application supporting all BUs diverges into multiple code branches, sometimes so different, that they essentially become different applications. In this case, while infrastructure costs are contained, operational and maintenance complexities and costs grow.

There is a better approach. If applications are designed based on multi-tenancy, the level of “sharedness“ moves higher in the stack. The higher it moves, the better efficiency and asset utilization is gained.

It should be noted that this is appropriate for those organizations that operate at a higher level of IT maturity, as change and release management, and availability and scalability, get more complex.


What is a multi-tenant application?
A multi-tenant application is a shared solution (i.e. CRM) used by different tenants (organizations, BUs). It is a single application with scalable resources to meet the performance demands of tenants.

As each tenant has its own specific functional requirements, the single multi-tenant application can support tenant specific customization at different layers of the architecture (persistence, workflow, component integration, security, UI).

Since multi-tenant applications run on shared infrastructure, it is important to isolate tenants from each other to protect information security, and prevent rogue actions or failure in one tenant’s execution environment does not impact other tenants’ availability.

Finally, since we’re talking about a single code-base running in shared environment, maintenance and updates must be continuously performed without requiring any downtime.

[Note: These are the key concepts behind multi-tenant applications. I am not going to include things like subscription-based licensing or utilization-based billing. Those are in the realm of Software-as-a-Service offering and operation.]

So, the main idea behind multi-tenancy is to provide a single code-base, polymorphic application that is customizable and scalable to meet the demands of different tenants:
image
In the diagram above, on the left (A) we have a single code-base, single instance, and single DB application supporting different tenants. On the right (B), we have a single code-base and single DB, but multiple instances supporting different tenants. This is not the same as an enterprise deploying multiple instances in their shared solution implementation.

In this case, the reason for “multiple instances” is related to the underlying infrastructure hosting the multi-tenant application. It is related to how its request handling, provisioning, and scalability strategies have been implemented.

In A, there is probably a cluster or grid of compute nodes powering the application. In B, as new application requests arrive, the underlying infrastructure provisions an execution environment (i.e. servlet container) and dispatches the request to the container to run the requests.

Here are some references which you might find useful:
· http://www.computer.org/portal/web/csdl/doi/10.1109/CEC-EEE.2007.4
· https://www6.software.ibm.com/developerworks/offers/techbriefings/cc4d-replays/session2_dcarew.pdf
· http://www.ibm.com/developerworks/webservices/library/ws-multitenantpart2/index.html

Multi-Tenancy Design Patterns & Realization
In this section, I am going to describe some of the key multi-tenancy design patterns and organize them into logical order:
Requirement Description Patterns, Approach, and Techniques
Tenant Isolation
(Infrastructure)
Tenant isolation is quite broad and multi-dimensional. It is primarily motivated by security and tenant availability and performance. At the infrastructure layer, tenant execution environment may be separated by virtual machines
Higher up, in the application server layer, each tenants may get their own server (Take a look at this WSO2 paper)
In the future, OSGi bundles? (See OSGi4C – RFP 133)
SOA provides a natural choice for multi-tenant and cloud applications (i.e. reusable components, composite apps). Take a look at this paper by Frank Leymann, et al on combining different multi-tenancy patterns in Service-Oriented applications.
Tenant Isolation
(Data)
In a multi-tenant environment, a single database contains data from multiple customers. Tenants should only be able to see their own data. SQL operations are qualified using tenant_id to return only tenant-specific data.
For added security & audit, another field such as user may be required to for authorization and logging.
References:
http://msdn.microsoft.com/en-us/library/aa479086.aspx
Customization As previously discussed, the single code-base multi-tenant application must provide some degree of customization and use extension to facilitate adoption. The customizable configuration items range from UI to workflow to database schema. For different layers, different techniques are applied to make the changes.
Here is a good reference on approach / methodology including assessing customization needs for a multi-tenant application.
Most SaaS solutions offer a metadata repository and a configuration service. A self-service UI panel is provided to the administrator on the tenant side to make the configuration changes.
Wizards are also provided to constrain / guide configuration changes. For most configuration items, change is automatic.
On the fly code generation techniques (i.e. templates), and dependency injection are also used to create tenant-specific code at runtime.
Maintenance & Upgrade Applying patches or system upgrades for a single instance multi-tenant solution running on a shared platform gets quite complex.
In the enterprise, change management and release strategies must factor in availability SLAs.
The same principles and best practices as continuous integration and delivery apply here
Force.com development lifecycle offers good best practices for release testing and promotion which can also be applied to a multi-tenant solution in the enterprise.
Obviously, it is important to be able to roll back to a previous stable point if things go wrong, so here are some general tips:
· An on-demand provisioning infrastructure provides an important capability for multi-tenant operation and management. Now, for an enterprise it doesn’t have to get as sophisticated as Amazon or Google, but try to understand the gaps, build a business case, and take appropriate steps.
· Similarly, investment in a CMDB solution also plays an important role in developing capabilities to manage change requests effectively and reduce deployment errors and others…
· Template-based configuration and deployment…This is an important configuration and change management best practice.
· Regular incremental backups (i.e. system snapshots) are also important to enable recovery in the event of rollbacks….

The above have direct linkage to the solutions that are built in enterprise shared services. BUs must be isolated for both technical operational and regulatory reasons. Enterprise architects must find ways to design solutions that share more and cost less in ongoing operation and maintenance. And, the systems typically have high availability requirements.

What’s also important to note is that the there is often no reference model for building shared solutions. This is a big gap. Multi-tenancy patterns and principles can be a big help.

Final thoughts
This is quite a fluid area. Multi-tenancy is still relatively a new concept. The ideas There are a lot of open questions from design -> operation. Enterprise Architects should have this on their radar, as they engage with new projects – or – refactor old implementations.

What do you think?

Tuesday, November 16, 2010

More on VMforce - Part Deux

I blogged about VMforce a couple of times back in April.  In August, VMware/SpringSource and SalesForce.com provided more details about this service in a couple of webinars to introduce Spring framework to Force.com developers, and Force.com & VMforce to Java developers:

VMForce–Cloud Computing for Java Developers

Basically, VMforce enables developers deploy JEE webapps on Force.com, and access Force.com database to persist data using standard JEE interfaces (JPA):

VMForce1

SpringSource offers the tooling (STS) to easily build and deploy Spring-based applications to VMforce. Force.com implements a JPA adapter to provide secure, multi-tenant access to Force.com database.

On the development/tooling side, it doesn’t seem the Force.com Eclipse Plug-in can be installed on STS (yet).  Once they work this out, both sets of developers can install one Eclipse to implement either JEE/Spring apps or Apex. 

I think the significance of VMforce is beyond merely extending Force.com with Java EE support or providing extensibility for Apex applications.  VMforce is significant, because it will support the most common approach to Cloud migration by customers.   Customers need a reliable service from a reputable, enterprise-ready service provider to move their existing applications to the cloud as is without much re-factoring.  This is going to be the trend for the next few years.  VMforce is a key strategy to meet that need. 

And, of course with Spring framework programming model (abstraction, dependency injection), there is a good story for platform lock-in and change management.

What is not completely clear so far is how VMforce will meet monitoring and on-premise integration requirements for customers.

----

Side note:

As I am writing this, I can understand how Google and SalesForce have partnered with SpringSource today to enable implementation of Cloud apps using the framework (i.e. skills).  However, this framework is based on “legacy Java EE” development and deployment.  Java EE, as it exists today, does not cover Cloud distributed programming model and patterns, and I don’t know if it could be easily extended to support them.   The problem here is that customers may have to invest in migration in the future.

However, there is no practical alternative available today.  Until there is standardization around Cloud development, deployment, and interoperability, Spring-based development seems to be a logical approach.

----

Thoughts/Comments?

Friday, March 19, 2010

IBM POWER7: Smarter Systems for Smarter Planet

Yesterday I attended an IBM event on POWER7 in Los Angeles.  The event was designed to show how POWER7 is a game changer in terms of form factor, massive parallelism and performance, virtualization, workload consolidation, integrated systems management, high availability,  energy consumption, and overall costs.

First, Ross Mauri gave an introduction to POWER series and innovation over the last decade.  He shared a lot of interesting metrics in terms of clients, migration patterns and experiences, key aspects of the system and overall score relative to competition… and he also shared some information on POWER7+, and POWER8 roadmap.  Next, John Shedletsky (VP, IBM SWG) gave a presentation on how IBM software is integrated and optimized on POWER7, and shared some case studies and competitive analysis in terms of workload performance and scalability, and cost.  Finally, Stan Pachura (CIO, The PMI Group) shared his experience with POWER7.  He described how PMI had been able to upgrade to POWER7, and consolidate iSeries & BI workloads without incurring any additional costs.

Some of the vendors mentioned in the presentations included HP, SUN (Oracle), and VMware :-)  Here is a link to the presentations:
https://www-950.ibm.com/events/wwe/grp/grp017.nsf/v16_agenda?openform&seminar=584RYCES&locale=en_US

Tuesday, November 03, 2009

The economics of multi-tenancy and its effect on the overall service offering…

One of the key design decisions for Cloud Computing implementers is multi-tenancy.  The idea is to abstract a pool of sharable resources (i.e. server, database) at the right layer, and to the right degree to optimize the number of tenants served by the resource.   Obviously, this needs to be done in balance to the particular service offered, the context in which the service is used, and challenges in terms of ongoing Cloud infrastructure/platform operation and maintenance, Terms of Service, etc…
Multi-tenancy has broad impact on the overall service offering from architecture and operation to financial management.  For service providers (including private Clouds implemented by shared services in many large organizations), it bears direct financial impact with regards to level of asset utilization and return-on-assets [i.e. total revenue from all tenants / (assets costs + asset operation & maintenance)].  It  also effects software licensing costs, resources required for ongoing service operation and configuration management, support, etc…
There is a spectrum of multi-tenancy:
image
At the server level, the unit of deployment is Virtual Machine (VM).  Each tenant is offered a VM to provide isolation and protection from other tenants.  So, a key question in this shared tenancy model is VM density.  How many VMs can be carved out on a physical server resource?  Other key considerations involve service provider's average cost of a VM (i.e. power, cooling, hardware and software costs, ongoing support and maintenance, etc)…
At the next level, there is platform as a service.  Examples of that would include Google App Engine (GAE) or Force.com.   On these platforms, unit of deployment is an application.  As an example, on GAE, tenants are provisioned their own application server (Jetty) running on Google’s infrastructure.   Similarly, on Force.com, each developer is provisioned a Resin app server in the to prevent tenants from stepping on each other…
At the top, a single code-base application is shared by multiple tenants.  A well-known example would be SalesForce.com.  Depending on the service implementation and tenancy model, as new tenants are provisioned, different levels of resource sharing may occur…  [Please have a look at the following MSDN article on Multi-Tenant Data Architecture.]
At each level, the following issues should be continually considered:
  • Tenancy Density: How many tenants can be instantiated on a physical unit of deployment?  
  • Cost / Tenant:  What is the average cost / tenant?  The cost includes everything from infrastructure costs (i.e. facilities, power, cooling, Telco provider) to hardware components including server, storage, network to software licensing costs, service maintenance and support…
  • Service Design: Does the tenancy model enhance the service for the target customers?  For example, many organizations are looking at the Cloud to simplify their IT by offloading infrastructure operation and maintenance costs to Cloud service providers.  In the lower level, organizations are still required to staff for operation, monitoring, and support of their applications on the Cloud infrastructure…
  • etc…
So, the design decisions and technology selections around multi-tenancy should not be approached casually, as it has fundamental impact on the service, its profitability, as well as operation and maintenance.