Thursday, 22 May 2014

Amazon AWS deployment options for Apache web server to Tomcat connectivity

The cloud proposition is attractive because of the ability to scale up or down to meet workload demand almost instantaneously and to utilize efficiencies in the services delivery model. The rationale of using and paying for only what you need, when you need it is a very compelling business justification.


This post and the next few ones describes the various options and features available when a web application is deployed on the AWS cloud infrastructure using Apache HTTP Web Server and Apache Tomcat application server. This document deals more with options available to maintain sticky sessions and application persistence.
This is based on a recent project where we are deploying with Apache 2.4 and Tomcat 7.0.x
First some basic terms

 AWS Glossary

·                     Amazon EC2 is hosted in multiple locations world-wide. These locations are composed of Regions and Zones. Each region is a separate geographic area.
Each region has multiple, isolated locations known as Availability Zones. This supports high availability of the applications and workloads can be balanced across both availability zones.
·                     To maintain a high-level of security the different tiers such as Web, App and Database are divided into separate subnets and "Security Groups", which are roughly analogous to firewalls.  This is done through Amazon VPC, a logically isolated section of the AWS Cloud where customers can launch AWS resources into a virtual network which they define. Capability to control inbound and outbound access to and from individual subnets using network access control lists, i.e. stateless firewall.  
·                     Load balancer (Elastic Load Balancer)
Elastic Load Balancing automatically distributes incoming application traffic across multiple Amazon EC2 instances. Elastic Load Balancing also detects unhealthy instances and automatically reroutes traffic to healthy instances until the unhealthy instances have been restored. Elastic Load Balancing can also be enabled within a single or multiple Availability Zones for more consistent application performance.
ELB also maintains Sticky sessions in case the application requires it.

Logical View

The application is hosted across two Zones within a region.
There is a Web tier ELB to load balance across the Apache servers as well as an Application tier ELB to load balance requests across the Tomcat servers. Cross-zone load balancing is optional and can be configured as required.
The requests from the Apache server to the Tomcat server can also be load balanced by Apache server itself (i.e. the application tier ELB is bypassed and not used). But this is not a preferred approach for AWS.
Hence both the application as well as the web tier ELB’s are used for load balancing.
In the next post I will explain how to use either mod_jk or mod_proxy to achieve the load balancing plus sticky sessions.


No comments:

Post a Comment