Showing posts with label Amazon DynamoDB. Show all posts
Showing posts with label Amazon DynamoDB. Show all posts

Monday, December 10, 2012

Part 2: Understanding Amazon ElastiCache Internals:Elasticity Implication and Solutions


In this article we will explore the implications of Elasticity which Amazon ElastiCache brings to the architecture. The Amazon ElastiCache nodes use memcached engine currently and they are not aware of other memcached nodes running inside the cache cluster. Since the cache nodes are not aware of the data distribution among its peers, the balancing act has to be done by the clients. Usually cache clients use a simple hashing algorithm to PUT/GET values from the corresponding cache nodes. This works well if the cache cluster size is static, but for any growing web application being static will not serve the purpose. Let us assume an online business decides to run a promotion where nearly 6X more visitors are expected to hit the site during this period. It is natural that for any heavy cache dependent site their memory needs will also increase correspondingly during this period. Amazon ElastiCache service understands this elastic behavior in the online business and provides an easy mechanism using API or console to add / remove cache nodes in existing cluster. Whenever your cache memory needs grow, you can simply add “N” new cache nodes into the Amazon ElastiCache cluster. But as an IT architect you need to understand this elastic action comes with certain side effects in a distributed caching scenario with Memcached-Amazon ElastiCache Nodes. They may cause swamping of your backend with requests if it is not dealt properly. Let us understand effects in detail:

Effect 1: Cold Cache: Amazon ElastiCache nodes using Memcached engine are ephemeral in nature. The KV data is stored in the memory and it is not persisted to the disk. Whenever you add new cache nodes you need to understand the proportion of increase % and accordingly take a cache node scale out strategy.  Imagine you have 2 cache nodes each with cache.m1.large capacity, now if you decide to add 2 more cache nodes of the same type into the cluster, you are adding close to 50% of capacity in cold state without  proper cache warming. This action may bring undesirable consequences and swamp your backend with heavy requests until the Amazon ElastiCache Nodes are properly warmed. Whereas if you have 100 cache.m1.large nodes running your cluster and if you are planning to add 5 more nodes into your cluster , it will not have a big impact if the backend is designed to handle this little spike variation. Some best practices that can be followed in this aspect are:
Plan for the addition of the nodes well in advance before the promotion, so that enough time is given for warming the cache nodes adequately. 
Add the cache nodes in right proportions which your backend can optimally take without performance disruption. Example: Instead of adding 2 cache nodes in 2 X m1.large cache cluster, adding one by one with enough time to warm will add only ~25% load to your backend. For some advanced strategies using cache redundancy, Maintenance windows etc in AWS to address this situation refer this URL: http://harish11g.blogspot.in/2012/11/amazon-elasticache-memcached-ec2.html

Effect 2: Object Remapping: The most common approach used by clients of Amazon ElastiCache nodes is to distribute object “o” among multiple cache nodes “n” by putting object o in cache node number hash(o) mod n function( result of this function). This approach is good for static cache node scenarios, but when you add or remove cache nodes then object “o” may need to be hashed to a new location every time the “n” nodes change. This operation can thunder your backend with heavy load and cause undesirable consequences. Ideally it would be nice, if a new cache node is added/removed only fair share of objects were remapped to other cache nodes in the Amazon ElastiCache. This can be achieved by using “Consistent Hashing” in the cache node clients. Since Amazon ElastiCache nodes are not peer aware, it does not require any change, it is only in the cache clients we need to apply this intelligent hashing approach. Consistent Hashing was introduced by David Karger et al in the paper “Consistent Hashing and Random Trees: Distributed Caching Protocols for Relieving Hot Spots on the World Wide Web”. The paper can be found here. http://www.akamai.com/dl/technical_publications/ConsistenHashingandRandomTreesDistributedCachingprotocolsforrelievingHotSpotsontheworldwideweb.pdf
Consistent hashing was first implemented by last.fm team on memcached library as “ketama”. Refer URL: http://www.last.fm/user/RJ/journal/2007/04/10/rz_libketama_-_a_consistent_hashing_algo_for_memcache_clients
Now let us explore what is Consistent hashing? How it helps and so on. The idea behind the consistent hashing algorithm is to hash both objects and cache nodes using the same hash function and consistently maps objects to the same cache node, as much as possible. Consistent hashing uses a mechanism that acts like a clock. The hash function actually maps objects and cache nodes to a number range. The number range values wrap around like a circle, that's why we call this circle a continuum. Imagine in the below picture a circle with number of objects 1,2,3,4 and cache nodes A,B and C. To assign which cache node an object goes in, you move clockwise round the circle until you find an appropriate cache node. So in the below diagram, you can see object 1 and 4 belong to cache node A, object 2 belongs to cache node B and object 3 belongs in cache node C.


Consider what happens if cache node C is removed from the cache cluster: object 3 now belongs will be remapped to cache node A, and all the other object mappings are unchanged. Same way, If we add another cache node D in the position marked below in the diagram it will take objects 3 and 4, only object 1 belonging to A.


The principle advantage of consistent hashing is that departure or arrival of a node only affects its immediate neighbors and other nodes remain unaffected .This approach reduces the remapping of the objects between the cache nodes and there by significantly decrease the swamping of backend servers in event of cache elasticity.
Consistent Hashing implementation is available in most of the popular Amazon ElastiCache-Memcached clients we use every day. There is a saying “everything comes with a consequence”; since the approach used in consistent hashing is random, it is possible to have a very non-uniform data and load distribution of objects between cache nodes inside/across a cluster.
To address this issue, more advanced KV systems like Membase and Amazon Dynamo uses a variant of consistent hashing.  Instead of mapping a node to a single point in the circle, each node gets assigned to multiple points in the ring (Amazon Dynamo uses the concept of “virtual nodes”). A virtual node looks like a single node in the system, but each node can be responsible for more than one virtual node. Effectively, when a new node is added to the system, it is assigned multiple positions (henceforth, “tokens”) in the ring. To know more about this approach read Amazon Dynamo paper. I hope in future Amazon ElastiCache Team implements this concept in their distributed caching service as well, because it will help us optimally use nodes.  



Related Articles

Saturday, October 6, 2012

Web Session Synchronization patterns in AWS


Statelessness is an important property that every application needs to posses in order to achieve Scalability and Availability in AWS cloud. Usually any web application will maintain the user web sessions on its server side to authorize them at every request. Also Sessions are used map the user requests to user data in some designs. When developing a new PHP/Java application, a common approach is to store session data in memory. Unfortunately, this approach doesn't scale very well for Large scale distributed systems . The moment your application scales out beyond a single web/app server, it becomes a necessity that the session state must be shared between multiple web/app servers. The common solution is to store session state on altogether different data store and share it with all the Web/App Servers. Though this approach is little complex than in-memory sessions, single point of failure and scalability can be achieved using this architecture pattern. 

Let us explore some popular patterns for web session synchronization on AWS cloud world.


Pattern 1: Synchronization using JGroups




Since AWS Infrastructure currently does not support Multicast protocol, the application layer software should synchronize the session data between them directly using Unicast TCP mechanism. Java based Application servers can use JGroups to synchronize the session data to other Java Web/Application EC2 instances in Unicast TCP of JGroups. This pattern will suffice if there are ~5-10 EC2 Web/App servers in the infrastructure. Also since this pattern follows a distributed approach towards web session synchronization there is no SPOF.  On other hand, If your web application layer has few hundreds of EC2 instances then Unicast TCP will be inefficient because of following reasons; there will lots of sync traffic data among Java Web/App EC2,  EC2 instances will be busy using considerable amount of CPU cycles for synchronization rather than serving web requests and EC2 web/app memory will filled with redundant session data.  
Note : vCider or VPNCubed seemed to support Multicast on AWS. vCider is acquired by Cisco and have stopped new downloads currently. 

Pattern 2: Synchronization using Terracotta Web Sessions




Terracotta(TC) web sessions can be used synchronize the session data in Java based applications. This product comes with client plugin(Terracotta driver) that needs to attached to the Web/App JVM of the EC2 instance and a Terracotta server that can be installed on a separate EC2 instance. The web session data will be optimally* serialized using TCP protocol from the Java Application server to the Centralized Terracotta EC2 server instance.  In case a web request earlier served by App EC2 A reaches App EC2 B because of Round Robin algorithm or App EC2 A failure, the later will check with centralized TC EC2 server instance for the session authenticity and proceed with processing the request without causing problems for the end user. This way the application server can designed to behave stateless and pick up any web requests from any load balancers. In addition to web sessions Terracotta can be extended with their other product lines which can help us store much more information on TC server EC2 instance efficiently. The Terracotta server EC2 instances can also be set HA mode to avoid SPOF in your application. Terracotta also follows an optimized serialization protocol where by only the changed piece of data is sent over the wire and not the entire serialized content. This saves lots of data flowing over the Amazon EC2 NW and proves very handy and effective on scalable deployments.In our experience we found ,Terracotta web sessions are mainly suitable for Java based application servers. It is better to run Terracotta EC2 server instance with High IO SSD EC2 instance type or other larger Memory EC2 instances in AWS cloud because TC EC2 server performs really well when they are given lots of memory and NW leverage. TC server using high memory EC2 instances can use ephemeral with TC HA mode (or) RAID 0+EBS optimized+ PIOPS as underlying storage on AWS for better performance. We have observed this centralized architecture pattern using TC server is suitable for ~20-30 app server farms with heavy traffic in AWS. This is not surely suitable of large web applications running couple of hundreds app servers in their web/app farms. Since the numbers mentioned are primarily dependent upon connections/sec, volume of data and nature of application traffic, I would strongly suggest the teams using this model to do their own benchmarks before concluding.  

Pattern 3: Synchronization using Distributed MemCacheD / Amazon ElastiCache




This is one of the most widely used architecture patterns in the Highly Scalable applications for web session synchronization. Applications written in Java, .Net, PHP, Python etc can use this model to synchronize their sessions. Web Sessions from the Application layer are synchronized(PUT) in the distributed MemcacheD / Amazon ElastiCache nodes using a MemCacheD client(namely spymemcached for Java, respectively for others). Web/App EC2 instances can GET the web session from MemcacheD and authorize them. Though the session data is distributed, the Memcached client has the logic to access and get data from the correct MemcacheD EC2 server. Clients can use TCP,UDP in binary or string format to communicate with MemCacheD Server.
Amazon ElastiCache is an AWS implementation of MemCacheD with better features and control. MemCached can be installed on any Amazon EC2 instance whereas ElastiCache is an Amazon service which exists in a separate tier of your tech stack. It can be accessed thru same memcache protocol over TCP. As best practice Multiple MemcacheD / ElastiCache nodes should be created in multiple AZ's in AWS for storing sessions and other user data. Since the session data is distributed into multiple cache nodes a single MemcacheD node failure will not much impact the user experience. In case session data redundancy is needed you can write(2 or more PUTs) the session data to multiple cache nodes and get from single node. This offers better HA on the distributed cache layer for Cache dependent sites but comes with small latency hick during PUT operation. MemCacheD performs better on High Memory instances with better IO in AWS. Depending upon the Cache Infra architecture we can keep a separate layer of High memory EC2 instances for MemcacheD/ ElastiCache Tier or share the unused space of web/app/other EC2 servers memory using MemCached EC2 installations. Both works well for MemCacheD dependent applications. Since session auth is an important step, TCP with Binary or String mode is recommended for session synchronization in Memcache protocol. We have seen that this architecture can easily handle tens of thousands of concurrent requests/sec in highly scalable applications.

Pattern 4: Synchronization with RDS Master (MySQL,Oracle, SQL)




This is one of the most used architecture patterns in the entry level or some poorly designed applications for web session synchronization. Web Sessions from the Application layer are synchronized in the Centralized Database Master. Though applications written in Java, .Net, PHP, Python etc can use this model to synchronize their sessions, it is not recommended for applications which demands heavy traffic and scalability. The database master will be unnecessarily pounded with Session requests and will be overloaded to perform normal transaction/queries. It is strongly recommended to offload this traffic from the master using other patterns suggested in this article. Example : m1.large RDS MySQL instance type comes with default max connections of 600. If 250 users are going to access your web app then only 350 connections are available for others to perform txns overall. In case your DB is overloaded then you can observe heavy downfall in your txn throughput as well as session authorization requests in this architecture.

Pattern 5: Synchronization with RDS Master+ Multiple Read Replica's




This is an extended version of the pattern 4. The Web Session is created and written in RDS Master and subsequent Session reads are done from the Read Replica slaves. In a web application, session is accessed multiple times during its lifetime and this model offloads that traffic from the RDS Master. One core point to understand in this pattern is; RDS Master asynchronously replicates data to Read Replica Slaves, so in case your DB is heavily pounded with heavy queries/txns there could be a replication lag between Master and Read replica's.  Which means first time when you create a session and immediately try to read it from read slave it may* not be replicated in the slave.This exception has to handled at application code level. This pattern is suggested for applications which are totally designed with DB as the core component and cannot easily migrate to other patterns in short term. On the long term we recommend you to migrate other patterns in AWS.   

Pattern 6: Synchronization with Amazon DynamoDB



Amazon DynamoDB is a NoSQL database that can handle massive concurrent read and writes. You can configure in Amazon DynamoDB console how many read/writes you want per second, accordingly Amazon DynamoDB will provision the required infrastructure at the backend. The infrastructure provisioning operations that happens in the backend are completely abstracted from the end user. The biggest advantage of Amazon DynamoDB is its predictable performance,low latency with seamless scalability. Internally all data items are stored on Solid State Drives (SSDs) and are automatically replicated across three Availability Zones in a Region to provide built-in high availability and data durability. After the launch of DynamoDB, we have architected solutions for some customers using it as a web session data store. It was used for highly scalable applications that need tens of thousands of concurrent requests/sec with persistent session data and specific cache data requirements. Since the web session data are usually in the range of few bytes to KB we were easily able to accommodate this in DynamoDB structure. It is recommended to use "Strong Consistent reads" while transacting with session data in DynamoDB. Amazon DynamoDB also provides APIs and session state extensions for variety of languages like Java,.Net etc. 


Related Articles
Part 1: Understanding Amazon ElastiCache Internals : Connection overhead
Part 2: Understanding Amazon ElastiCache Internals : Elasticity Implication and Solutions
Part 3: Understanding Amazon ElastiCache Internals : Auto Discovery
Part 4: Understanding Amazon ElastiCache Internals : Economics of Choosing Cache Node Type
Launching Amazon ElastiCache in 3 Easy Steps
Caching architectures using Memcached & Amazon ElastiCache
Web Session Synchronization patterns in AWS

Wednesday, July 25, 2012

Part 8: (AZ Series) Availability Zones : Simple Latency Test


AWS Availability Zones: Simple latency test


We did a simple test to check the latency between Amazon Availability zones 1a and 1b (our account). 
The Test architecture had:
  • Multiple Grinder Load Clients
  • Tomcat Application Server and 1-RDS MySQL Database Server
  • M1.large instance type was used for the Tomcat and RDS MySQL
  • 100,000 txns generated in 60 seconds 
  • Region: US-East , Availability Zones : 1A and 1B in our account
  • In Practice Majority of Web/App EC2 and Master Database should reside in same AZ. For ease of testing purpose we have followed the above architecture.


Test 1: Observations
·         Java/Tomcat based App EC2 was launched on US-EAST-1A
·         RDS MySQL was launched on US-EAST-1A ( same availability zone)
·         Both were EC2 instances were m1.large capacity
·         100K txns/minute was generated from Tomcat to RDS instance
·         Average latency of 3 ms was observed for 100K txns in a single AZ setup

Test 2: Observations
·         Java/Tomcat based App EC2 was launched on US-EAST-1A
·         RDS MySQL was launched on US-EAST-1B (different availability zone)
·         Both were EC2 instances were m1.large capacity
·         100K txns/minute was generated from Tomcat to RDS instance
·         Average latency of 9 ms was observed for 100K txns in the multi-AZ setup.
·        Though it is roughly ~3X increase of latency from Test1, since the Average latency is in the range of single digit ms, it is suggested to use Multi-AZ deployments for applications requiring high availability.  Note: The observed ~3X latency difference will usually vary depending upon the Availability Zones (AZ origin / AZ destination /AWS Region) and it should not be treated as exact figure.

Other Related Articles :
(Full Article) Exploring Amazon Availability Zones 
Part 8: (AZ Series) Availability Zones : Simple Latency Test
Part 7: (AZ Series) AWS Availability Zones Usage charges
Part 6: (AZ Series) Guidelines for architecting applications across AWS Availability Zones
Part 5:(AZ Series) Availability Zone Names are logical names
Part 4: (AZ Series) How Amazon VPC uses Availability zones
Part 3: (AZ Series) How AWS Building blocks inherently leverage Availability Zones?
Part 2: (AZ Series) Why we should leverage AWS Availability Zones?
Part 1: (AZ Series) What is AWS Availability Zone ?







Part 7: (AZ Series) AWS Availability Zones Usage charges


AWS Availability Zones: Usage Charges

We are charged a small bandwidth charge (Regional Data Transfer) for data that crosses Availability Zones. Regional Data Transfer rates apply if at least one of the following is true, but is only charged once for a given instance even if both are true:
·   The other instance is in a different availability zone, regardless of which type of address is used.
    • Data transferred between instances in the same availability zone on EC2 costs $0.00 per GB.
    • Data transferred between instances across different availability zones on EC2 costs $0.01 per GB.
·   Public or Elastic IP addresses are used, regardless of which zone the other instance is in.
Also Data transfer between VPC and non-VPC instances in the same Region, regardless of Availability Zone, is charged at the usual rate of $0.01 per Gigabyte


Other Related Articles :
(Full Article) Exploring Amazon Availability Zones 
Part 8: (AZ Series) Availability Zones : Simple Latency Test
Part 7: (AZ Series) AWS Availability Zones Usage charges
Part 6: (AZ Series) Guidelines for architecting applications across AWS Availability Zones
Part 5:(AZ Series) Availability Zone Names are logical names
Part 4: (AZ Series) How Amazon VPC uses Availability zones
Part 3: (AZ Series) How AWS Building blocks inherently leverage Availability Zones?
Part 2: (AZ Series) Why we should leverage AWS Availability Zones?
Part 1: (AZ Series) What is AWS Availability Zone ?

Part 6: (AZ Series) Guidelines for architecting applications across AWS Availability Zones


Guidelines for architecting applications across AWS Availability Zones


A typical Web-Application Stack consists of following tiers; DNS tier, Load Balancers, Web Tier, App Tier, Cache, Database and Storage layer. It is important to run all independent application stacks in more than one AZ, so that if one zone fails, the application in the other zone can continue to run without disruption in AWS infrastructure. All the above mentioned tiers can be distributed and deployed to run on at least 2 or more availability zones inside an AWS region. In our experience we have seen the following set of tiers and software’s can be deployed across multiple availability zones with minimal configuration changes:







Sample Web/App Architecture using Multiple Availability zones


Following diagram illustrates a reference architecture using Multiple Availability zones of Amazon. Let us see what the various tiers in this architecture are and how they are using AZ concept.






DNS tier: Route53 
Load balancing Tier: Amazon ELB inbuilt with Multi-AZ
Web /App Tier: EC2 instances launched across Multiple Availability zones using Amazon AutoScaling. Integrated with Amazon ELB and CloudWatch 
Database Tier: RDS MySQL with Hot Standby, Multiple Read Replica’s in multiple AZ’s depending upon the Read Scaling needed 
Caching Tier: Amazon ElastiCache cluster or EC2 MemCached distributed in Multiple –AZ
Search Tier: Since Amazon CloudSearch currently support only single AZ; users can look at deploying Solr replication/Replicated shards across multiple Availability zones
NoSQL Tier: Amazon DynamoDB inherently replicates data in Multiple AZ’s/Facilities
CDN Tier: Amazon CloudFront internally uses global network of edge locations
Monitoring Tier: Amazon CloudWatch is used for monitoring the infrastructure. EC2 instances use detailed monitoring.


Other Related Articles :
(Full Article) Exploring Amazon Availability Zones 
Part 8: (AZ Series) Availability Zones : Simple Latency Test
Part 7: (AZ Series) AWS Availability Zones Usage charges
Part 6: (AZ Series) Guidelines for architecting applications across AWS Availability Zones
Part 5:(AZ Series) Availability Zone Names are logical names
Part 4: (AZ Series) How Amazon VPC uses Availability zones
Part 3: (AZ Series) How AWS Building blocks inherently leverage Availability Zones?
Part 2: (AZ Series) Why we should leverage AWS Availability Zones?
Part 1: (AZ Series) What is AWS Availability Zone ?

Part 5:(AZ Series) Availability Zone Names are logical names


Availability Zone Names are logical 


Availability Zones are not the same across AWS accounts. There is a common misconception that an AZ name like "US-east-1a" identifies a specific physical availability zone for everyone.  The fact is that AWS can map/remap the same AZ name to different physical availability zones across multiple accounts. The Availability Zone us-east-1a for account A is not necessarily the same as us-east-1a for account B. Zone assignments are mapped independently for each account. This is important when our infrastructure or use cases spans across multiple accounts. Example: Infrastructure provisioned through Account-A and Load Testing Agents are launched through Account-B, and both pointing to "US-east-1a" may not map to same AZ.


Other Related Articles :
(Full Article) Exploring Amazon Availability Zones 
Part 8: (AZ Series) Availability Zones : Simple Latency Test
Part 7: (AZ Series) AWS Availability Zones Usage charges
Part 6: (AZ Series) Guidelines for architecting applications across AWS Availability Zones
Part 5:(AZ Series) Availability Zone Names are logical names
Part 4: (AZ Series) How Amazon VPC uses Availability zones
Part 3: (AZ Series) How AWS Building blocks inherently leverage Availability Zones?
Part 2: (AZ Series) Why we should leverage AWS Availability Zones?
Part 1: (AZ Series) What is AWS Availability Zone ?

Part 4: (AZ Series) How Amazon VPC uses Availability zones


Multiple Availability Zones inside Amazon VPC


Using Amazon Virtual Private Cloud (Amazon VPC) we can provision a private, isolated section of the Amazon Web Services (AWS) Cloud where we can launch AWS resources in a virtual network that we define. We have seen enterprises mostly prefer VPC model of deployment in Amazon cloud.
Inside Amazon VPC, we can define a virtual network topology that closely resembles a traditional network with complete control over our virtual networking environment, including selection of IP address range, creation of subnets, and configuration of route tables and network gateways. Since Availability zone concept works inside VPC, for deploying highly available applications inside VPC it is recommended to run it in multiple Availability Zones.
Create multiple subnets inside a VPC and put each subnet in a distinct Availability Zone for High Availability. Currently a single VPC can span multiple Availability Zones and Multiple VPN connections, but we cannot create subnets inside Amazon VPC that spans multiple availability zones. Amazon VPC is available in all the regions of AWS infrastructure.
VPN Gateways are regional objects, and can be accessed from any of the subnets (subject, of course, to any Network ACLs that you create); Sample architecture using VPC-Multi-AZ is illustrated below:







Let me detail the above diagram:
Point 1) Amazon VPC is created in US-East Region of AWS.
Point 2) Multiple subnets are created inside a VPC and each subnet is put in a distinct Amazon Availability Zone for High Availability. Example: Have your Web, App and DB layer distributed in public/private subnets inside availability zone 1a and keep a similar set in availability zone 1b as well for HA. Since we cannot create subnets inside Amazon VPC that spans multiple availability zones, we need to achieve HA using the above mentioned subnet-AZ network architecture.
Point 3) Multiple VPN connections from the single VPC are attached to multiple customer gateways located in multiple geographies (simulating "branch office" architecture).

Other Related Articles :
(Full Article) Exploring Amazon Availability Zones 
Part 8: (AZ Series) Availability Zones : Simple Latency Test
Part 7: (AZ Series) AWS Availability Zones Usage charges
Part 6: (AZ Series) Guidelines for architecting applications across AWS Availability Zones
Part 5:(AZ Series) Availability Zone Names are logical names
Part 4: (AZ Series) How Amazon VPC uses Availability zones
Part 3: (AZ Series) How AWS Building blocks inherently leverage Availability Zones?
Part 2: (AZ Series) Why we should leverage AWS Availability Zones?
Part 1: (AZ Series) What is AWS Availability Zone ?

Part 3: (AZ Series) How AWS Building blocks inherently leverage Availability Zones?


How AWS Building blocks inherently leverage Availability Zones?


Most of the higher-level AWS, such as Amazon Simple Storage Service (S3), Amazon DynamoDB, Amazon CloudWatch, Amazon Simple Queue Service (SQS), and Amazon Elastic Load Balancing (ELB), have been built with inherent fault tolerance and high availability in mind. They already work across multiple availability zones inside an Amazon Region. Let us see how each of them uses the Availability zone concept;


Amazon ELB:  Amazon ELB can direct and load balance requests to multiple EC2 instances launched across multiple availability zones inside a Region. Load Balancer Instances are spawned in Multiple Availability Zones in the ELB tier as well internally when the traffic increases. 
Amazon RDS MySQL:  Amazon RDS for MySQL and Oracle currently supports Multi-AZ Hot Standby architecture, where the Primary Master will run on one Availability zone and Hot Standby (Secondary) will run on another Availability zone. In event of Primary AZ failure, the Hot Standby will start serving the requests from the alternative AZ. We can also create and launch multiple RDS Read Replica’s in Multiple Availability Zones for Read scaling and HA.
Amazon S3: Any data that is stored on S3 (Standard Storage option) is synchronized at multiple locations/facilities inside an Amazon Region. Amazon S3 Objects are redundantly stored on multiple devices across multiple facilities (AZ’s) in an Amazon S3 Region. To help ensure durability, Amazon S3 PUT and COPY operations synchronously store our data across multiple facilities before returning a successful response.
Amazon DynamoDB: Amazon DynamoDB service replicates data across three facilities/Availability zones in an AWS Region to provide fault tolerance in the event of a server failure or Availability Zone outage. Also to achieve high uptime and durability, Amazon DynamoDB does synchronous replication of data across these (multiple) facilities.
Amazon SQS: Amazon SQS stores all queue and messages redundantly on multiple servers and in multiple data centers/availability zones, which means that no single computer or network failure will render SQS messages inaccessible.
Amazon ElastiCache: Currently Amazon ElastiCache Cluster cannot span multiple Availability Zones inside an AWS Region. Deploy redundant ElastiCache Clusters in different Availability Zones for HA in AWS or alternatively use efficient cache warming techniques in your architecture for fault tolerance in this layer.
Amazon CloudWatch: Amazon CloudWatch can monitor EC2 instances which are deployed at multiple availability zones inside an Amazon Region. Amazon CloudWatch is an AWS building block and it is a Highly Available service by design. 
Amazon AutoScaling: Amazon AutoScaling can scale out/down EC2 instances across multiple Availability zones inside an Amazon Region. Amazon AutoScaling cannot span EC2 scale out across Amazon Regions.

Other Related Articles :
(Full Article) Exploring Amazon Availability Zones 
Part 8: (AZ Series) Availability Zones : Simple Latency Test
Part 7: (AZ Series) AWS Availability Zones Usage charges
Part 6: (AZ Series) Guidelines for architecting applications across AWS Availability Zones
Part 5:(AZ Series) Availability Zone Names are logical names
Part 4: (AZ Series) How Amazon VPC uses Availability zones
Part 3: (AZ Series) How AWS Building blocks inherently leverage Availability Zones?
Part 2: (AZ Series) Why we should leverage AWS Availability Zones?
Part 1: (AZ Series) What is AWS Availability Zone ?

Part 2: (AZ Series) Why we should leverage AWS Availability Zones?


Why we should leverage AWS Availability Zones?


Just moving a system into the cloud doesn’t make it fault-tolerant or highly available; we need to understand the features provided by the cloud provider for availability in depth and then architect our application leveraging the same. 
In AWS infrastructure it is usually recommended to architect applications using multiple availability zones inside a region as best practice. When you design such a system, it is suggested to have a good prior understanding of zone dependencies.
Availability zones (AZs) are distinct geographical locations that are engineered to be insulated from failures in other AZs. Certain services that provide basic infrastructure, such as Amazon Elastic Compute Cloud (EC2) and Amazon Elastic Block Store (EBS) need to be properly architected using this Amazon Multi-AZ’s concept. By placing Amazon EC2 instances in multiple AZs, an application can be protected from failure at a Single EC2, Single location or Single Data center level. It is important to run independent application stacks in more than one AZ, so that if one zone fails, the application in the other zone can continue to run without disruption.
Usually applications which are properly architected for multi-tiered distribution and statelessness in mind can easily leverage AWS High availability features without any code change. Applications which are Statefull can still leverage Amazon Multi-AZ deployment, but it will not be completely fault tolerant because of it is design. Some of the techniques followed in AWS Multi-AZ deployments to avoid Single point of Failure (SPOF) in web/app layer are:

  • Since AWS infrastructure does not support Multicast protocol currently, the application layer software should synchronize data using Unicast TCP mechanism. Example: Java based servers can use JGroups or Terracotta NAM to synchronize the cluster information in AWS.
  • In case the Web/App servers are written on PHP, .Net, Python etc then all the user and session data can be stored on centralized systems like MemCached EC2 instance or ElastiCache nodes or Amazon DynamoDB. Note: Deploy redundant ElastiCache Clusters in different Availability Zones for HA (or) build cache warming in your design for ElastiCache/MemCached Layers.
  • Uploaded User files and documents should be centrally stored on NFS Pool or RedHat Gluster Storage Pool or Amazon S3
The above mentioned points are some of the simple steps that needs to be remembered during the Architecture or Migration phase in AWS.


Other Related Articles :
(Full Article) Exploring Amazon Availability Zones 
Part 8: (AZ Series) Availability Zones : Simple Latency Test
Part 7: (AZ Series) AWS Availability Zones Usage charges
Part 6: (AZ Series) Guidelines for architecting applications across AWS Availability Zones
Part 5:(AZ Series) Availability Zone Names are logical names
Part 4: (AZ Series) How Amazon VPC uses Availability zones
Part 3: (AZ Series) How AWS Building blocks inherently leverage Availability Zones?
Part 2: (AZ Series) Why we should leverage AWS Availability Zones?
Part 1: (AZ Series) What is AWS Availability Zone ?

Part 1: (AZ Series) What is AWS Availability Zone ?


Amazon Web Services (AWS) currently serves hundreds of thousands of customers in more than 190 countries. AWS is steadily expanding their global infrastructure to help customers achieve lower latency and higher throughput, and to ensure that customer data resides only in the Region they specify. AWS currently operates at 8 regions around the world and they are constantly expanding their infrastructure as I write this article. Following diagram illustrates their current regional infrastructure distribution:




Each Amazon EC2 Region is designed to be completely isolated from the other Amazon EC2 Regions. This infrastructure design achieves the greatest possible failure independence and stability. Also by launching EC2 instances in separate Amazon Regions, we can design our application to be closer to specific customers or to meet legal/compliance or other requirements. 
Every Amazon Region is further sub divided into Availability Zones. By launching EC2 instances in separate Availability Zones (AZ), we can protect our applications from the failure of a single location.


So what is an Amazon Availability Zone?


Amazon operates state-of-the-art, highly available data center facilities. However, failures can occur that affect the availability of EC2 instances that are in the same location. Although this is rare, if you host all your Amazon EC2 instances in a single location that is affected by such a failure, your instances will be unavailable.
So to overcome this every Amazon Region is further sub divided into Availability zones. Amazon Availability Zones are distinct physical locations having Low latency network connectivity between them inside the same region and are engineered to be insulated from failures from other AZ’s. Each availability zone runs on its own physically distinct, independent infrastructure, and is engineered to be highly reliable; they have Independent power, cooling, network and security. Common points of failures like generators and cooling equipment are not shared across Availability Zones. Additionally, they are physically separate; such that even extremely uncommon disasters such as fires, tornados or flooding would only affect a single Availability Zone. The following diagram illustrates availability zone concept: (image Source : AWS)



We can visualize each AZ internally having Single Data Center or Multiple Data centers. The following diagram illustrates the current AZ allocation of AWS infrastructure:(image Source : AWS)


  • ·         Region :US-EAST( North Virginia) has 5 availability zones
  • ·         Region :US-West (California + Oregon) has 6 availability zones
  • ·         Region :Europe – West (Dublin) has 3 availability zones
  • ·         Region :Asia Pacific (Japan) has 2 availability zones
  • ·         Region :Asia Pacific (Singapore) has 2 availability zones
  • ·         Region :South America (Sao Paulo) has 2 availability zones
  • ·         Region : Gov Cloud

Need Consulting help ?

Name

Email *

Message *

DISCLAIMER
All posts, comments, views expressed in this blog are my own and does not represent the positions or views of my past, present or future employers. The intention of this blog is to share my experience and views. Content is subject to change without any notice. While I would do my best to quote the original author or copyright owners wherever I reference them, if you find any of the content / images violating copyright, please let me know and I will act upon it immediately. Lastly, I encourage you to share the content of this blog in general with other online communities for non-commercial and educational purposes.

Followers