Rules for Surviving an Amazon EC2 Outage

The recent outage of one of Amazon’s availability zones has some technologists claiming the cloud isn’t product ready. The reality is that it isn’t a problem with the cloud—it’s a problem with the architecture of the sites hosted on the cloud. Michael T. Fisher and Martin L. Abbott, co-authors of Scalability Rules: 50 Principles for Scaling Web Sites, cover four simple rules that, if followed, will help your site maintain high availability no matter where it is hosted.

In an effort at full disclosure, one of the authors is a member of the board of directors for ShareThis. We’re going to use ShareThis to explain how they survived the Amazon EC2 outage and how, by following a few simple rules, you can survive the next outage of one of your vendors. Our newest book, Scalability Rules, has a rule based format that we are going to reference, but we’ll fully explain the ones we use in this article.

Design to Clone Things

The first rule is “Design to Clone Things.” This is often called horizontal scaling and is the duplication of services or databases to spread transaction load across multiple physical or virtual servers. Any site with a reasonable amount of traffic has implemented multiple front end web servers to handle the traffic, which is an example of horizontal scaling. Many sites that are dependent on their database for retrieval and storage of information for web pages use horizontal scaling of their databases as well. If your database is MySQL, this is done through Master-Slave replication. Your application writes to one master database, which replicates the data to one or more slave databases from which the application reads data. ShareThis has hundreds of front end web servers handling their traffic and makes use of MySQL Master-Slave replication to spread the load of their database across multiple instances.

Getting rid of any single point of failure (SPOF) in your architecture by horizontally scaling is the first step in surviving outages. Our mantra is “everything fails,” and therefore when cloning look to keep devices geographically separated whenever possible. ShareThis had their systems spread across both the U.S. East and U.S. West data centers roughly 15% of their servers were within the 1c availability zone that failed in U.S. East. Because their databases and servers were spread across the availability zones in U.S. East and further cloned to U.S. West, the size of the potential impact was reduced significantly.

Use Databases Appropriately

The second rule to follow is “Use Databases Appropriately.” Relational database management systems (RDBMSs) such as Oracle and MySQL are based on the relational model introduced by Edgar F. Codd in his 1970 paper, “A Relational Model of Data for Large Shared Data Banks.” Most RDBMSs provide two huge benefits for storing data – the guarantee of transactional integrity through ACID properties (Atomicity, Consistency, Isolation, and Durability) and the relational structure within and between tables. Guaranteeing that transactions are written to multiple database nodes, such as in a MySQL NDB or Oracle RAC cluster, requires synchronous replication that is difficult to scale beyond a couple nodes. The relational structure within and between tables in the RDBMS makes it difficult to split the database through such actions as sharding or partitioning. A simple query that joined two tables in a single database must be converted into two separate queries with the joining of the data taking place in the application to split tables into different databases.

Data that requires transactional integrity or relationships with other data are very well suited for RDBMSs, but there is often data within your system that doesn’t require transactional integrity or relationships with other data. Using an RDBMS for this data is incurring the overhead without the benefits. Alternative persistent storage systems include file systems such as Google File System, MogileFS, and Ceph, depending on the nature of the data you are storing. Another alternative to an RDBMS is a NoSQL solution. Technologies that fall into this category are often subdivided into key-value stores, extensible record stores, and document stores. These are, by design, much easier to scale within or across datacenters than a traditional RDBMS. There is no universally agreed classification of technologies, but in general, key-value stores have a single key-value index for data, extensible record stores use a row and column data model that can be split across nodes, and document stores use a multi-indexed object model that can be aggregated into collections.

ShareThis makes very deliberate decisions about where to store each piece of data. Some data in stored in MySQL, other data is cached in key-value stores such as Memcached or Membase, while still other data are placed in extensible record stores such as Cassandra. By taking this approach of using the right tool for the job, ShareThis can more easily deploy parts of their infrastructure in different availability zones. This rule in association with the cloning rule helped them mitigate or eliminate the impact of a failure.

Design Using Fault Isolation Zones

The third rule is to “Design Using Fault Isolation Zones.” We often call fault isolation zones “swim lanes” because of the visual it invokes of keeping swimmers isolated in their lanes. Other organizations call them pods, pools, or shards. From our perspective, the most important differentiation among these terms is the notion of design. Whereas a pool, shard, or pod refers to how something is implemented in a production environment, the swim lane is a design concept for creating fault isolation domains where service failures only affect those users or services within that zone. Swim lanes extend the concepts provided within shards and pods by extending the failure domain all the way to the users themselves.

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*