让我在被误解之前强调内部技术部分：Dynamo不是直exposed externally as a web service; however, Dynamo and similar Amazon technologies是用于为我们的Amazon Web Services的某些部分供电，例如S3。
We submitted the technology for publication in SOSP because many of the techniques used in Dynamo originate in the operating systems and distributed systems research of the past years; DHTs, consistent hashing, versioning, vector clocks, quorum, anti-entropy based recovery, etc据我所知，Dynamo是第一个使用所有这些技术综合的生产系统，从中学到了很多经验教训。本文主要是关于这些课程。
We are extremely fortunate that the paper was selected for publication in SOSP; only a very few true production systems have made it into the conference and as such it is a recognition of the quality of the work that went into building a real incrementally scalable storage system in which the most important properties can be appropriately configured.
Dynamo is representative of a lot of the work that we are doing at Amazon; we continuously 必威体育精装版app官网 cutting edge technologies using recent research, and in many cases do the research ourselves大部分工程在亚马逊工作,无论是在基础设施、分布式系统、工作流、渲染、搜索、数字,相似之处,供应链、运输或者其他的系统,同样高度发达。
Giuseppe DeCandia，Deniz Hastorun，Madan Jampani，Gunavardhan Kakulapati，Avinash Lakshman，Alex Pilchin，Swami Sivasubramanian，Peter Vosshall和Werner Vogels，“Dynamo：亚马逊的高度可用的钥匙价值商店”，Proceedings of the 21st ACM Symposium on Operating Systems Principles，华盛顿州史蒂文森，2007年10月。
©ACM，2007这是作者的作品版本它是在ACM许可的基础上发布的，供您个人使用不是为了再分配最终版本发布于2007年10月14日至17日的SOSP'07，美国华盛顿州史蒂文森，版权所有2007 ACM 978-1-59593-591-5 / 07/20010
Giuseppe DeCandia, Deniz Hastorun, Madan Jampani, Gunavardhan Kakulapati, Avinash Lakshman, Alex Pilchin, Swaminathan Sivasubramanian, Peter Vosshall and Werner Vogels
Reliability at massive scale is one of the biggest challenges we face at Amazon.com, one of the largest e-commerce operations in the world; even the slightest outage has significant financial consequences and impacts customer trustThe Amazon.com platform, which provides services for many web sites worldwide, is implemented on top of an infrastructure of tens of thousands of servers and network components located in many datacenters around the worldAt this scale, small and large components fail continuously and the way persistent state is managed in the face of these failures drives the reliability and scalability of the software systems.
This paper presents the design and implementation of Dynamo, a highly available key-value storage system that some of Amazon’s core services use to provide an “always-on” experience. To achieve this level of availability, Dynamo sacrifices consistency under certain failure scenariosIt makes extensive use of object versioning and application-assisted conflict resolution in a manner that provides a novel interface for 必威体育精装版app官网ers to use.
D.4.2 [操作系统]: Storage Management; D.4.5 [操作系统]: Reliability; D.4.2 [操作系统]: Performance;
Amazon runs a world-wide e-commerce platform that serves tens of millions customers at peak times using tens of thousands of servers located in many data centers around the worldThere are strict operational requirements on Amazon’s platform in terms of performance, reliability and efficiency, and to support continuous growth the platform needs to be highly scalableReliability is one of the most important requirements because even the slightest outage has significant financial consequences and impacts customer trustIn addition, to support continuous growth, the platform needs to be highly scalable.
One of the lessons our organization has learned from operating Amazon’s platform is that the reliability and scalability of a system is dependent on how its application state is managedAmazon uses a highly decentralized, loosely coupled, service oriented architecture consisting of hundreds of servicesIn this environment there is a particular need for storage technologies that are always availableFor example, customers should be able to view and add items to their shopping cart even if disks are failing, network routes are flapping, or data centers are being destroyed by tornados. Therefore, the service responsible for managing shopping carts requires that it can always write to and read from its data store, and that its data needs to be available across multiple data centers.
Dealing with failures in an infrastructure comprised of millions of components is our standard mode of operation; there are always a small but significant number of server and network components that are failing at any given timeAs such Amazon’s software systems need to be constructed in a manner that treats failure handling as the normal case without impacting availability or performance.
To meet the reliability and scaling needs, Amazon has 必威体育精装版app官网ed a number of storage technologies, of which the Amazon Simple Storage Service (also available outside of Amazon and known as Amazon S3), is probably the best knownThis paper presents the design and implementation of Dynamo, another highly available and scalable distributed data store built for Amazon’s platformDynamo is used to manage the state of services that have very high reliability requirements and need tight control over the tradeoffs between availability, consistency, cost-effectiveness and performanceAmazon’s platform has a very diverse set of applications with different storage requirementsA select set of applications requires a storage technology that is flexible enough to let application designers configure their data store appropriately based on these tradeoffs to achieve high availability and guaranteed performance in the most cost effective manner.
There are many services on Amazon’s platform that only need primary-key access to a data storeFor many services, such as those that provide best seller lists, shopping carts, customer preferences, session management, sales rank, and product catalog, the common pattern of using a relational betway88体育官网 would lead to inefficiencies and limit scale and availabilityDynamo provides a simple primary-key only interface to meet the requirements of these applications.
Dynamo uses a synthesis of well known techniques to achieve scalability and availability: Data is partitioned and replicated using consistent hashing , and consistency is facilitated by object versioning . The consistency among replicas during updates is maintained by a quorum-like technique and a decentralized replica synchronization protocolDynamo employs a gossip based distributed failure detection and membership protocolDynamo is a completely decentralized system with minimal need for manual administration. Storage nodes can be added and removed from Dynamo without requiring any manual partitioning or redistribution.
In the past year, Dynamo has been the underlying storage technology for a number of the core services in Amazon’s e-commerce platform. It was able to scale to extreme peak loads efficiently without any downtime during the busy holiday shopping seasonFor example, the service that maintains shopping cart (Shopping Cart Service) served tens of millions requests that resulted in well over 3 million checkouts in a single day and the service that manages session state handled hundreds of thousands of concurrently active sessions.
The main contribution of this work for the research community is the evaluation of how different techniques can be combined to provide a single highly-available systemIt demonstrates that an eventually-consistent storage system can be used in production with demanding applicationsIt also provides insight into the tuning of these techniques to meet the requirements of production systems with very strict performance demands.
该论文的结构如下Section 2 presents the background and Section 3 presents the related workSection 4 presents the system design and Section 5 describes the implementationSection 6 details the experiences and insights gained by running Dynamo in production and Section 7 concludes the paperThere are a number of places in this paper where additional information may have been appropriate but where protecting Amazon’s business interests require us to reduce some level of detailFor this reason, the intra- and inter-datacenter latencies in section 6, the absolute request rates in section 6.2 and outage lengths and workloads in section 6.3 are provided through aggregate measures instead of absolute details.
Amazon’s e-commerce platform is composed of hundreds of services that work in concert to deliver functionality ranging from recommendations to order fulfillment to fraud detectionEach service is exposed through a well defined interface and is accessible over the network. These services are hosted in an infrastructure that consists of tens of thousands of servers located across many data centers world-wideSome of these services are stateless (i.e., services which aggregate responses from other services) and some are stateful (i.e., a service that generates its response by executing business logic on its state stored in persistent store).
Traditionally production systems store their state in relational betway88体育官网sFor many of the more common usage patterns of state persistence, however, a relational betway88体育官网 is a solution that is far from idealMost of these services only store and retrieve data by primary key and do not require the complex querying and management functionality offered by an RDBMS. This excess functionality requires expensive hardware and highly skilled personnel for its operation, making it a very inefficient solutionIn addition, the available replication technologies are limited and typically choose consistency over availabilityAlthough many advances have been made in the recent years, it is still not easy to scale-out betway88体育官网s or use smart partitioning schemes for load balancing.
This paper describes Dynamo, a highly available data storage technology that addresses the needs of these important classes of services. Dynamo has a simple key/value interface, is highly available with a clearly defined consistency window, is efficient in its resource usage, and has a simple scale out scheme to address growth in data set size or request ratesEach service that uses Dynamo runs its own Dynamo instances.
The storage system for this class of services has the following requirements:
查询模型: simple read and write operations to a data item that is uniquely identified by a keyState is stored as binary objects (i.e., blobs) identified by unique keysNo operations span multiple data items and there is no need for relational schemaThis requirement is based on the observation that a significant portion of Amazon’s services can work with this simple query model and do not need any relational schemaDynamo targets applications that need to store objects that are relatively small (usually less than 1 MB).
ACID属性：酸 （Atomicity, Consistency, Isolation, Durability) is a set of properties that guarantee that betway88体育官网 transactions are processed reliablyIn the context of betway88体育官网s, a single logical operation on the data is called a transactionExperience at Amazon has shown that data stores that provide ACID guarantees tend to have poor availabilityThis has been widely acknowledged by both the industry and academia Dynamo targets applications that operate with weaker consistency (the “C” in ACID) if this results in high availabilityDynamo does not provide any isolation guarantees and permits only single key updates.
效率: The system needs to function on a commodity hardware infrastructureIn Amazon’s platform, services have stringent latency requirements which are in general measured at the 99.9th percentile of the distributionGiven that state access plays a crucial role in service operation the storage system must be capable of meeting such stringent SLAs (see Section 2.2 below)Services must be able to configure Dynamo such that they consistently achieve their latency and throughput requirementsThe tradeoffs are in performance, cost efficiency, availability, and durability guarantees.
Other Assumptions: Dynamo is used only by Amazon’s internal servicesIts operation environment is assumed to be non-hostile and there are no security related requirements such as authentication and authorization. Moreover, since each service uses its distinct instance of Dynamo, its initial design targets a scale of up to hundreds of storage hostsWe will discuss the scalability limitations of Dynamo and possible scalability related extensions in later sections.
To guarantee that the application can deliver its functionality in a bounded time, each and every dependency in the platform needs to deliver its functionality with even tighter boundsClients and services engage in a Service Level Agreement (SLA), a formally negotiated contract where a client and a service agree on several system-related characteristics, which most prominently include the client’s expected request rate distribution for a particular API and the expected service latency under those conditionsAn example of a simple SLA is a service guaranteeing that it will provide a response within 300ms for 99.9% of its requests for a peak client load of 500 requests per second.
In Amazon’s decentralized service oriented infrastructure, SLAs play an important roleFor example a page request to one of the e-commerce sites typically requires the rendering engine to construct its response by sending requests to over 150 servicesThese services often have multiple dependencies, which frequently are other services, and as such it is not uncommon for the call graph of an application to have more than one levelTo ensure that the page rendering engine can maintain a clear bound on page delivery each service within the call chain must obey its performance contract.
Figure 1 shows an abstract view of the architecture of Amazon’s platform, where dynamic web content is generated by page rendering components which in turn query many other servicesA service can use different data stores to manage its state and these data stores are only accessible within its service boundariesSome services act as aggregators by using several other services to produce a composite responseTypically, the aggregator services are stateless, although they use extensive caching.
A common approach in the industry for forming a performance oriented SLA is to describe it using average, median and expected varianceAt Amazon we have found that these metrics are not good enough if the goal is to build a system where所有customers have a good experience, rather than just the majorityFor example if extensive personalization techniques are used then customers with longer histories require more processing which impacts performance at the high-end of the distributionAn SLA stated in terms of mean or median response times will not address the performance of this important customer segmentTo address this issue, at Amazon, SLAs are expressed and measured at the 99.9th percentile of the distributionThe choice for 99.9% over an even higher percentile has been made based on a cost-benefit analysis which demonstrated a significant increase in cost to improve performance that muchExperiences with Amazon’s production systems have shown that this approach provides a better overall experience compared to those systems that meet SLAs defined based on the mean or median.
In this paper there are many references to this 99.9th percentile of distributions, which reflects Amazon engineers’ relentless focus on performance from the perspective of the customers’ experienceMany papers report on averages, so these are included where it makes sense for comparison purposesNevertheless, Amazon’s engineering and optimization efforts are not focused on averagesSeveral techniques, such as the load balanced selection of write coordinators, are purely targeted at controlling performance at the 99.9th percentile.
Storage systems often play an important role in establishing a service’s SLA, especially if the business logic is relatively lightweight, as is the case for many Amazon servicesState management then becomes the main component of a service’s SLAOne of the main design considerations for Dynamo is to give services control over their system properties, such as durability and consistency, and to let services make their own tradeoffs between functionality, performance and cost-effectiveness.
Data replication algorithms used in commercial systems traditionally perform synchronous replica coordination in order to provide a strongly consistent data access interfaceTo achieve this level of consistency, these algorithms are forced to tradeoff the availability of the data under certain failure scenariosFor instance, rather than dealing with the uncertainty of the correctness of an answer, the data is made unavailable until it is absolutely certain that it is correctFrom the very early replicated betway88体育官网 works, it is well known that when dealing with the possibility of network failures, strong consistency and high data availability cannot be achieved simultaneously [2, 11]As such systems and applications need to be aware which properties can be achieved under which conditions.
For systems prone to server and network failures, availability can be increased by using optimistic replication techniques, where changes are allowed to propagate to replicas in the background, and concurrent, disconnected work is toleratedThe challenge with this approach is that it can lead to conflicting changes which must be detected and resolvedThis process of conflict resolution introduces two problems: when to resolve them and who resolves themDynamo is designed to be an eventually consistent data store; that is all updates reach all replicas eventually.
一个重要的设计考虑因素是决定当to perform the process of resolving update conflicts, i.e., whether conflicts should be resolved during reads or writesMany traditional data stores execute conflict resolution during writes and keep the read complexity simple In such systems, writes may be rejected if the data store cannot reach all (or a majority of) the replicas at a given timeOn the other hand, Dynamo targets the design space of an “always writeable” data store (i.e., a data store that is highly available for writes)For a number of Amazon services, rejecting customer updates could result in a poor customer experienceFor instance, the shopping cart service must allow customers to add and remove items from their shopping cart even amidst network and server failuresThis requirement forces us to push the complexity of conflict resolution to the reads in order to ensure that writes are never rejected.
下一个设计选择是谁执行冲突解决的过程This can be done by the data store or the applicationIf conflict resolution is done by the data store, its choices are rather limitedIn such cases, the data store can only use simple policies, such as “last write wins” , to resolve conflicting updatesOn the other hand, since the application is aware of the data schema it can decide on the conflict resolution method that is best suited for its client’s experienceFor instance, the application that maintains customer shopping carts can choose to “merge” the conflicting versions and return a single unified shopping cartDespite this flexibility, some application 必威体育精装版app官网ers may not want to write their own conflict resolution mechanisms and choose to push it down to the data store, which in turn chooses a simple policy such as “last write wins”.
Other key principles embraced in the design are:
增量可扩展性: Dynamo should be able to scale out one storage host (henceforth, referred to as “节点”) at a time, with minimal impact on both operators of the system and the system itself.
对称: Every node in Dynamo should have the same set of responsibilities as its peers; there should be no distinguished node or nodes that take special roles or extra set of responsibilitiesIn our experience, symmetry simplifies the process of system provisioning and maintenance.
分权: An extension of symmetry, the design should favor decentralized peer-to-peer techniques over centralized controlIn the past, centralized control has resulted in outages and the goal is to avoid it as much as possibleThis leads to a simpler, more scalable, and more available system.
异质性: The system needs to be able to exploit heterogeneity in the infrastructure it runs on例如the work distribution must be proportional to the capabilities of the individual serversThis is essential in adding new nodes with higher capacity without having to upgrade all hosts at once.
There are several peer-to-peer (P2P) systems that have looked at the problem of data storage and distributionThe first generation of P2P systems, such as自由网和Gnutella的, were predominantly used as file sharing systemsThese were examples of unstructured P2P networks where the overlay links between peers were established arbitrarilyIn these networks, a search query is usually flooded through the network to find as many peers as possible that share the dataP2P systems evolved to the next generation into what is widely known as structured P2P networksThese networks employ a globally consistent protocol to ensure that any node can efficiently route a search query to some peer that has the desired dataSystems like Pastry  and Chord  use routing mechanisms to ensure that queries can be answered within a bounded number of hopsTo reduce the additional latency introduced by multi-hop routing, some P2P systems (e.g., ) employ O(1) routing where each peer maintains enough routing information locally so that it can route requests (to access a data item) to the appropriate peer within a constant number of hops.
Various storage systems, such as Oceanstore  and PAST  were built on top of these routing overlaysOceanstore provides a global, transactional, persistent storage service that supports serialized updates on widely replicated dataTo allow for concurrent updates while avoiding many of the problems inherent with wide-area locking, it uses an update model based on conflict resolutionConflict resolution was introduced in  to reduce the number of transaction abortsOceanstore resolves conflicts by processing a series of updates, choosing a total order among them, and then applying them atomically in that orderIt is built for an environment where the data is replicated on an untrusted infrastructureBy comparison, PAST provides a simple abstraction layer on top of Pastry for persistent and immutable objects. It assumes that the application can build the necessary storage semantics (such as mutable files) on top of it.
3.2 Distributed File Systems and betway88体育官网s
Distributing data for performance, availability and durability has been widely studied in the file system and betway88体育官网 systems communityCompared to P2P storage systems that only support flat namespaces, distributed file systems typically support hierarchical namespacesSystems like Ficus  and Coda  replicate files for high availability at the expense of consistencyUpdate conflicts are typically managed using specialized conflict resolution proceduresThe Farsite system  is a distributed file system that does not use any centralized server like NFS. Farsite achieves high availability and scalability using replicationThe Google File System  is another distributed file system built for hosting the state of Google’s internal applicationsGFS uses a simple design with a single master server for hosting the entire metadata and where the data is split into chunks and stored in chunkserversBayou is a distributed relational betway88体育官网 system that allows disconnected operations and provides eventual data consistency .
Among these systems, Bayou, Coda and Ficus allow disconnected operations and are resilient to issues such as network partitions and outagesThese systems differ on their conflict resolution proceduresFor instance, Coda and Ficus perform system level conflict resolution and Bayou allows application level resolutionAll of them, however, guarantee eventual consistencySimilar to these systems, Dynamo allows read and write operations to continue even during network partitions and resolves updated conflicts using different conflict resolution mechanismsDistributed block storage systems like FAB  split large size objects into smaller blocks and stores each block in a highly available mannerIn comparison to these systems, a key-value store is more suitable in this case because: (a) it is intended to store relatively small objects (size < 1M) and (b) key-value stores are easier to configure on a per-application basisAntiquity is a wide-area distributed storage system designed to handle multiple server failures It uses a secure log to preserve data integrity, replicates each log on multiple servers for durability, and uses Byzantine fault tolerance protocols to ensure data consistencyIn contrast to Antiquity, Dynamo does not focus on the problem of data integrity and security and is built for a trusted environmentBigtable is a distributed storage system for managing structured dataIt maintains a sparse, multi-dimensional sorted map and allows applications to access their data using multiple attributes Compared to Bigtable, Dynamo targets applications that require only key/value access with primary focus on high availability where updates are not rejected even in the wake of network partitions or server failures.
Traditional replicated relational betway88体育官网 systems focus on the problem of guaranteeing strong consistency to replicated dataAlthough strong consistency provides the application writer a convenient programming model, these systems are limited in scalability and availability These systems are not capable of handling network partitions because they typically provide strong consistency guarantees.
Dynamo differs from the aforementioned decentralized storage systems in terms of its target requirementsFirst, Dynamo is targeted mainly at applications that need an “always writeable” data store where no updates are rejected due to failures or concurrent writesThis is a crucial requirement for many Amazon applicationsSecond, as noted earlier, Dynamo is built for an infrastructure within a single administrative domain where all nodes are assumed to be trustedThird, applications that use Dynamo do not require support for hierarchical namespaces (a norm in many file systems) or complex relational schema (supported by traditional betway88体育官网s)Fourth, Dynamo is built for latency sensitive applications that require at least 99.9% of read and write operations to be performed within a few hundred millisecondsTo meet these stringent latency requirements, it was imperative for us to avoid routing requests through multiple nodes (which is the typical design adopted by several distributed hash table systems such as Chord and Pastry)This is because multi-hop routing increases variability in response times, thereby increasing the latency at higher percentilesDynamo can be characterized as a zero-hop DHT, where each node maintains enough routing information locally to route a request to the appropriate node directly.
The architecture of a storage system that needs to operate in a production setting is complexIn addition to the actual data persistence component, the system needs to have scalable and robust solutions for load balancing, membership and failure detection, failure recovery, replica synchronization, overload handling, state transfer, concurrency and job scheduling, request marshalling, request routing, system monitoring and alarming, and configuration management. Describing the details of each of the solutions is not possible, so this paper focuses on the core distributed systems techniques used in Dynamo: partitioning, replication, versioning, membership, failure handling and scaling. Table 1 presents a summary of the list of techniques Dynamo uses and their respective advantages.
Provides high availability and durability guarantee when some of the replicas are not available.
Anti-entropy using Merkle trees
Gossip-based membership protocol and failure detection.
Preserves symmetry and avoids having a centralized registry for storing membership and node liveness information.
Dynamo stores objects associated with a key through a simple interface; it exposes two operations: get() and put()得到的（键) operation locates the object replicas associated with the键in the storage system and returns a single object or a list of objects with conflicting versions along with a上下文把(key, context, object）操作确定复制品的位置宾语should be placed based on the associated键, and writes the replicas to disk的上下文encodes system metadata about the object that is opaque to the caller and includes information such as the version of the objectThe context information is stored along with the object so that the system can verify the validity of the context object supplied in the put request.
Dynamo treats both the key and the object supplied by the caller as an opaque array of bytesIt applies a MD5 hash on the key to generate a 128-bit identifier, which is used to determine the storage nodes that are responsible for serving the key.
One of the key design requirements for Dynamo is that it must scale incrementallyThis requires a mechanism to dynamically partition the data over the set of nodes (i.e., storage hosts) in the systemDynamo’s partitioning scheme relies on consistent hashing to distribute the load across multiple storage hostsIn consistent hashing , the output range of a hash function is treated as a fixed circular space or “ring” (i.e. the largest hash value wraps around to the smallest hash value)Each node in the system is assigned a random value within this space which represents its “position” on the ringEach data item identified by a key is assigned to a node by hashing the data item’s key to yield its position on the ring, and then walking the ring clockwise to find the first node with a position larger than the item’s positionThus, each node becomes responsible for the region in the ring between it and its predecessor node on the ringThe principle advantage of consistent hashing is that departure or arrival of a node only affects its immediate neighbors and other nodes remain unaffected.
The basic consistent hashing algorithm presents some challengesFirst, the random position assignment of each node on the ring leads to non-uniform data and load distributionSecond, the basic algorithm is oblivious to the heterogeneity in the performance of nodesTo address these issues, Dynamo uses a variant of consistent hashing (similar to the one used in [10, 20]): instead of mapping a node to a single point in the circle, each node gets assigned to multiple points in the ringTo this end, 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 nodeEffectively, when a new node is added to the system, it is assigned multiple positions (henceforth, “tokens”) in the ringThe process of fine-tuning Dynamo’s partitioning scheme is discussed in Section 6.
If a node becomes unavailable (due to failures or routine maintenance), the load handled by this node is evenly dispersed across the remaining available nodes.
When a node becomes available again, or a new node is added to the system, the newly available node accepts a roughly equivalent amount of load from each of the other available nodes.
The number of virtual nodes that a node is responsible can decided based on its capacity, accounting for heterogeneity in the physical infrastructure.
To achieve high availability and durability, Dynamo replicates its data on multiple hostsEach data item is replicated at N hosts, where N is a parameter configured“每个实例”每把钥匙，ķ, is assigned to a coordinator node (described in the previous section)The coordinator is in charge of the replication of the data items that fall within its rangeIn addition to locally storing each key within its range, the coordinator replicates these keys at the N-1 clockwise successor nodes in the ringThis results in a system where each node is responsible for the region of the ring between it and its Nth predecessorIn Figure 2, node B replicates the keyķ除了在本地存储它之外，在节点C和D处Node D will store the keys that fall in the ranges (A, B], (B, C], and (C, D].
The list of nodes that is responsible for storing a particular key is called the偏好列表The system is designed, as will be explained in Section 4.8, so that every node in the system can determine which nodes should be in this list for any particular keyTo account for node failures, preference list contains more than N nodesNote that with the use of virtual nodes, it is possible that the first N successor positions for a particular key may be owned by less than N distinct physical nodes (i.ea node may hold more than one of the first N positions). To address this, the preference list for a key is constructed by skipping positions in the ring to ensure that the list contains only distinct physical nodes.
Dynamo provides eventual consistency, which allows for updates to be propagated to all replicas asynchronouslyA put() call may return to its caller before the update has been applied at all the replicas, which can result in scenarios where a subsequent get() operation may return an object that does not have the latest updates.If there are no failures then there is a bound on the update propagation timesHowever, under certain failure scenarios (e.g., server outages or network partitions), updates may not arrive at all replicas for an extended period of time.
There is a category of applications in Amazon’s platform that can tolerate such inconsistencies and can be constructed to operate under these conditionsFor example, the shopping cart application requires that an “添加到购物车”operation can never be forgotten or rejectedIf the most recent state of the cart is unavailable, and a user makes changes to an older version of the cart, that change is still meaningful and should be preservedBut at the same time it shouldn’t supersede the currently unavailable state of the cart, which itself may contain changes that should be preserved请注意，“添加到购物车”和“delete item from cart“操作被转换为对Dynamo的put请求When a customer wants to add an item to (or remove from) a shopping cart and the latest version is not available, the item is added to (or removed from) the older version and the divergent versions are reconciled later.
In order to provide this kind of guarantee, Dynamo treats the result of each modification as a new and immutable version of the dataIt allows for multiple versions of an object to be present in the system at the same timeMost of the time, new versions subsume the previous version(s), and the system itself can determine the authoritative version (syntactic reconciliation)However, version branching may happen, in the presence of failures combined with concurrent updates, resulting in conflicting versions of an objectIn these cases, the system cannot reconcile the multiple versions of the same object and the client must perform the reconciliation in order to坍方多个数据分支演变为一个（语义对帐）A typical example of a collapse operation is “merging” different versions of a customer’s shopping cartUsing this reconciliation mechanism, an “add to cart” operation is never lost但是，删除的项目可能会重新出现。
It is important to understand that certain failure modes can potentially result in the system having not just two but several versions of the same dataUpdates in the presence of network partitions and node failures can potentially result in an object having distinct version sub-histories, which the system will need to reconcile in the futureThis requires us to design applications that explicitly acknowledge the possibility of multiple versions of the same data (in order to never lose any updates).
Dynamo uses vector clocks  in order to capture causality between different versions of the same objectA vector clock is effectively a list of (node, counter) pairsOne vector clock is associated with every version of every objectOne can determine whether two versions of an object are on parallel branches or have a causal ordering, by examine their vector clocks.If the counters on the first object’s clock are less-than-or-equal to all of the nodes in the second clock, then the first is an ancestor of the second and can be forgottenOtherwise, the two changes are considered to be in conflict and require reconciliation.
In Dynamo, when a client wishes to update an object, it must specify which version it is updatingThis is done by passing the context it obtained from an earlier read operation, which contains the vector clock informationUpon processing a read request, if Dynamo has access to multiple branches that cannot be syntactically reconciled, it will return all the objects at the leaves, with the corresponding version information in the contextAn update using this context is considered to have reconciled the divergent versions and the branches are collapsed into a single new version.
To illustrate the use of vector clocks, let us consider the example shown in Figure 3客户端编写新对象The node (say Sx) that handles the write for this key increases its sequence number and uses it to create the data's vector clockThe system now has the object D1 and its associated clock [(Sx, 1)]客户端更新对象Assume the same node handles this request as wellThe system now also has object D2 and its associated clock [(Sx, 2)]D2下降from D1 and therefore over-writes D1, however there may be replicas of D1 lingering at nodes that have not yet seen D2Let us assume that the same client updates the object again and a different server (say Sy) handles the requestThe system now has data D3 and its associated clock [(Sx, 2), (Sy, 1)].
Next assume a different client reads D2 and then tries to update it, and another node (say Sz) does the writeThe system now has D4 (descendant of D2) whose version clock is [(Sx, 2), (Sz, 1)]A node that is aware of D1 or D2 could determine, upon receiving D4 and its clock, that D1 and D2 are overwritten by the new data and can be garbage collectedA node that is aware of D3 and receives D4 will find that there is no causal relation between themIn other words, there are changes in D3 and D4 that are not reflected in each otherBoth versions of the data must be kept and presented to a client (upon a read) for semantic reconciliation.
Now assume some client reads both D3 and D4 (the context will reflect that both values were found by the read)The read's context is a summary of the clocks of D3 and D4, namely [(Sx, 2), (Sy, 1), (Sz, 1)]If the client performs the reconciliation and node Sx coordinates the write, Sx will update its sequence number in the clockThe new data D5 will have the following clock: [(Sx, 3), (Sy, 1), (Sz, 1)].
A possible issue with vector clocks is that the size of vector clocks may grow if many servers coordinate the writes to an objectIn practice, this is not likely because the writes are usually handled by one of the top N nodes in the preference listIn case of network partitions or multiple server failures, write requests may be handled by nodes that are not in the top N nodes in the preference list causing the size of vector clock to growIn these scenarios, it is desirable to limit the size of vector clockTo this end, Dynamo employs the following clock truncation scheme: Along with each (node, counter) pair, Dynamo stores a timestamp that indicates the last time the node updated the data itemWhen the number of (node, counter) pairs in the vector clock reaches a threshold (say 10), the oldest pair is removed from the clockClearly, this truncation scheme can lead to inefficiencies in reconciliation as the descendant relationships cannot be derived accurately. However, this problem has not surfaced in production and therefore this issue has not been thoroughly investigated.
Any storage node in Dynamo is eligible to receive client get and put operations for any keyIn this section, for sake of simplicity, we describe how these operations are performed in a failure-free environment and in the subsequent section we describe how read and write operations are executed during failures.
Both get and put operations are invoked using Amazon’s infrastructure-specific request processing framework over HTTPThere are two strategies that a client can use to select a node: (1) route its request through a generic load balancer that will select a node based on load information, or (2) use a partition-aware client library that routes requests directly to the appropriate coordinator nodesThe advantage of the first approach is that the client does not have to link any code specific to Dynamo in its application, whereas the second strategy can achieve lower latency because it skips a potential forwarding step.
A node handling a read or write operation is known as the协调Typically, this is the first among the top N nodes in the preference listIf the requests are received through a load balancer, requests to access a key may be routed to any random node in the ringIn this scenario, the node that receives the request will not coordinate it if the node is not in the top N of the requested key’s preference listInstead, that node will forward the request to the first among the top N nodes in the preference list.
Read and write operations involve the first N healthy nodes in the preference list, skipping over those that are down or inaccessibleWhen all nodes are healthy, the top N nodes in a key’s preference list are accessedWhen there are node failures or network partitions, nodes that are lower ranked in the preference list are accessed.
To maintain consistency among its replicas, Dynamo uses a consistency protocol similar to those used in quorum systems. This protocol has two key configurable values: R and WR is the minimum number of nodes that must participate in a successful read operationW is the minimum number of nodes that must participate in a successful write operationSetting R and W such that R + W > N yields a quorum-like systemIn this model, the latency of a get (or put) operation is dictated by the slowest of the R (or W) replicas. For this reason, R and W are usually configured to be less than N, to provide better latency.
Upon receiving a put() request for a key, the coordinator generates the vector clock for the new version and writes the new version locallyThe coordinator then sends the new version (along with the new vector clock) to the N highest-ranked reachable nodesIf at least W-1 nodes respond then the write is considered successful.
Similarly, for a get() request, the coordinator requests all existing versions of data for that key from the N highest-ranked reachable nodes in the preference list for that key, and then waits for R responses before returning the result to the client. If the coordinator ends up gathering multiple versions of the data, it returns all the versions it deems to be causally unrelatedThe divergent versions are then reconciled and the reconciled version superseding the current versions is written back.
If Dynamo used a traditional quorum approach it would be unavailable during server failures and network partitions, and would have reduced durability even under the simplest of failure conditionsTo remedy this it does not enforce strict quorum membership and instead it uses a “sloppy quorum”; all read and write operations are performed on the first N健康nodes from the preference list, which may not always be the first N nodes encountered while walking the consistent hashing ring.
Consider the example of Dynamo configuration given in Figure 2 with N=3In this example, if node A is temporarily down or unreachable during a write operation then a replica that would normally have lived on A will now be sent to node DThis is done to maintain the desired availability and durability guaranteesThe replica sent to D will have a hint in its metadata that suggests which node was the intended recipient of the replica (in this case A)Nodes that receive hinted replicas will keep them in a separate local betway88体育官网 that is scanned periodicallyUpon detecting that A has recovered, D will attempt to deliver the replica to AOnce the transfer succeeds, D may delete the object from its local store without decreasing the total number of replicas in the system.
Using hinted handoff, Dynamo ensures that the read and write operations are not failed due to temporary node or network failuresApplications that need the highest level of availability can set W to 1, which ensures that a write is accepted as long as a single node in the system has durably written the key it to its local storeThus, the write request is only rejected if all nodes in the system are unavailableHowever, in practice, most Amazon services in production set a higher W to meet the desired level of durabilityA more detailed discussion of configuring N, R and W follows in section 6.
It is imperative that a highly available storage system be capable of handling the failure of an entire data center(s)Data center failures happen due to power outages, cooling failures, network failures, and natural disastersDynamo is configured such that each object is replicated across multiple data centersIn essence, the preference list of a key is constructed such that the storage nodes are spread across multiple data centers这些数据中心通过高速网络链路连接This scheme of replicating across multiple datacenters allows us to handle entire data center failures without a data outage.
Hinted handoff works best if the system membership churn is low and node failures are transientThere are scenarios under which hinted replicas become unavailable before they can be returned to the original replica nodeTo handle this and other threats to durability, Dynamo implements an anti-entropy (replica synchronization) protocol to keep the replicas synchronized.
To detect the inconsistencies between replicas faster and to minimize the amount of transferred data, Dynamo uses Merkle trees A Merkle tree is a hash tree where leaves are hashes of the values of individual keysParent nodes higher in the tree are hashes of their respective children. The principal advantage of Merkle tree is that each branch of the tree can be checked independently without requiring nodes to download the entire tree or the entire data setMoreover, Merkle trees help in reducing the amount of data that needs to be transferred while checking for inconsistencies among replicas. For instance, if the hash values of the root of two trees are equal, then the values of the leaf nodes in the tree are equal and the nodes require no synchronizationIf not, it implies that the values of some replicas are differentIn such cases, the nodes may exchange the hash values of children and the process continues until it reaches the leaves of the trees, at which point the hosts can identify the keys that are “out of sync”Merkle trees minimize the amount of data that needs to be transferred for synchronization and reduce the number of disk reads performed during the anti-entropy process.
Dynamo uses Merkle trees for anti-entropy as follows: Each node maintains a separate Merkle tree for each key range (the set of keys covered by a virtual node) it hostsThis allows nodes to compare whether the keys within a key range are up-to-dateIn this scheme, two nodes exchange the root of the Merkle tree corresponding to the key ranges that they host in commonSubsequently, using the tree traversal scheme described above the nodes determine if they have any differences and perform the appropriate synchronization actionThe disadvantage with this scheme is that many key ranges change when a node joins or leaves the system thereby requiring the tree(s) to be recalculatedThis issue is addressed, however, by the refined partitioning scheme described in Section 6.2.
In Amazon’s environment node outages (due to failures and maintenance tasks) are often transient but may last for extended intervalsA node outage rarely signifies a permanent departure and therefore should not result in rebalancing of the partition assignment or repair of the unreachable replicasSimilarly, manual error could result in the unintentional startup of new Dynamo nodesFor these reasons, it was deemed appropriate to use an explicit mechanism to initiate the addition and removal of nodes from a Dynamo ringAn administrator uses a command line tool or a browser to connect to a Dynamo node and issue a membership change to join a node to a ring or remove a node from a ringThe node that serves the request writes the membership change and its time of issue to persistent storeThe membership changes form a history because nodes can be removed and added back multiple timesA gossip-based protocol propagates membership changes and maintains an eventually consistent view of membershipEach node contacts a peer chosen at random every second and the two nodes efficiently reconcile their persisted membership change histories.
When a node starts for the first time, it chooses its set of tokens (virtual nodes in the consistent hash space) and maps nodes to their respective token setsThe mapping is persisted on disk and initially contains only the local node and token setThe mappings stored at different Dynamo nodes are reconciled during the same communication exchange that reconciles the membership change historiesTherefore, partitioning and placement information also propagates via the gossip-based protocol and each storage node is aware of the token ranges handled by its peersThis allows each node to forward a key’s read/write operations to the right set of nodes directly.
The mechanism described above could temporarily result in a logically partitioned Dynamo ringFor example, the administrator could contact node A to join A to the ring, then contact node B to join B to the ringIn this scenario, nodes A and B would each consider itself a member of the ring, yet neither would be immediately aware of the otherTo prevent logical partitions, some Dynamo nodes play the role of seedsSeeds are nodes that are discovered via an external mechanism and are known to all nodesBecause all nodes eventually reconcile their membership with a seed, logical partitions are highly unlikelySeeds can be obtained either from static configuration or from a configuration serviceTypically seeds are fully functional nodes in the Dynamo ring.
Failure detection in Dynamo is used to avoid attempts to communicate with unreachable peers during get() and put() operations and when transferring partitions and hinted replicasFor the purpose of avoiding failed attempts at communication, a purely local notion of failure detection is entirely sufficient: node A may consider node B failed if node B does not respond to node A’s messages (even if B is responsive to node C's messages)In the presence of a steady rate of client requests generating inter-node communication in the Dynamo ring, a node A quickly discovers that a node B is unresponsive when B fails to respond to a message; Node A then uses alternate nodes to service requests that map to B's partitions; A periodically retries B to check for the latter's recoveryIn the absence of client requests to drive traffic between two nodes, neither node really needs to know whether the other is reachable and responsive.
Decentralized failure detection protocols use a simple gossip-style protocol that enable each node in the system to learn about the arrival (or departure) of other nodesFor detailed information on decentralized failure detectors and the parameters affecting their accuracy, the interested reader is referred to Early designs of Dynamo used a decentralized failure detector to maintain a globally consistent view of failure stateLater it was determined that the explicit node join and leave methods obviates the need for a global view of failure stateThis is because nodes are notified of permanent node additions and removals by the explicit node join and leave methods and temporary node failures are detected by the individual nodes when they fail to communicate with others (while forwarding requests).
When a new node (say X) is added into the system, it gets assigned a number of tokens that are randomly scattered on the ringFor every key range that is assigned to node X, there may be a number of nodes (less than or equal to N) that are currently in charge of handling keys that fall within its token rangeDue to the allocation of key ranges to X, some existing nodes no longer have to some of their keys and these nodes transfer those keys to XLet us consider a simple bootstrapping scenario where node X is added to the ring shown in Figure 2 between A and BWhen X is added to the system, it is in charge of storing keys in the ranges (F, G], (G, A] and (A, X]As a consequence, nodes B, C and D no longer have to store the keys in these respective rangesTherefore, nodes B, C, and D will offer to and upon confirmation from X transfer the appropriate set of keysWhen a node is removed from the system, the reallocation of keys happens in a reverse process.
Operational experience has shown that this approach distributes the load of key distribution uniformly across the storage nodes, which is important to meet the latency requirements and to ensure fast bootstrapping. Finally, by adding a confirmation round between the source and the destination, it is made sure that the destination node does not receive any duplicate transfers for a given key range.
In Dynamo, each storage node has three main software components: request coordination, membership and failure detection, and a local persistence engine所有这些组件都是用Java实现的。
Dynamo’s local persistence component allows for different storage engines to be plugged inEngines that are in use are Berkeley betway88体育官网 (BDB) Transactional Data Store, BDB Java Edition, MySQL, and an in-memory buffer with persistent backing storeThe main reason for designing a pluggable persistence component is to choose the storage engine best suited for an application’s access patternsFor instance, BDB can handle objects typically in the order of tens of kilobytes whereas MySQL can handle objects of larger sizesApplications choose Dynamo’s local persistence engine based on their object size distributionThe majority of Dynamo’s production instances use BDB Transactional Data Store.
The request coordination component is built on top of an event-driven messaging substrate where the message processing pipeline is split into multiple stages similar to the SEDA architecture All communications are implemented using Java NIO channelsThe coordinator executes the read and write requests on behalf of clients by collecting data from one or more nodes (in the case of reads) or storing data at one or more nodes (for writes)Each client request results in the creation of a state machine on the node that received the client requestThe state machine contains all the logic for identifying the nodes responsible for a key, sending the requests, waiting for responses, potentially doing retries, processing the replies and packaging the response to the clientEach state machine instance handles exactly one client requestFor instance, a read operation implements the following state machine: (i) send read requests to the nodes, (ii) wait for minimum number of required responses, (iii) if too few replies were received within a given time bound, fail the request, (iv) otherwise gather all the data versions and determine the ones to be returned and (v) if versioning is enabled, perform syntactic reconciliation and generate an opaque write context that contains the vector clock that subsumes all the remaining versionsFor the sake of brevity the failure handling and retry states are left out.
After the read response has been returned to the caller the state machine waits for a small period of time to receive any outstanding responsesIf stale versions were returned in any of the responses, the coordinator updates those nodes with the latest version这个过程被称为阅读修理because it repairs replicas that have missed a recent update at an opportunistic time and relieves the anti-entropy protocol from having to do it.
As noted earlier, write requests are coordinated by one of the top N nodes in the preference listAlthough it is desirable always to have the first node among the top N to coordinate the writes thereby serializing all writes at a single location, this approach has led to uneven load distribution resulting in SLA violationsThis is because the request load is not uniformly distributed across objectsTo counter this, any of the top N nodes in the preference list is allowed to coordinate the writesIn particular, since each write usually follows a read operation, the coordinator for a write is chosen to be the node that replied fastest to the previous read operation which is stored in the context information of the requestThis optimization enables us to pick the node that has the data that was read by the preceding read operation thereby increasing the chances of getting “read-your-writes” consistencyIt also reduces variability in the performance of the request handling which improves the performance at the 99.9 percentile.
Dynamo is used by several services with different configurations. These instances differ by their version reconciliation logic, and read/write quorum characteristicsThe following are the main patterns in which Dynamo is used:
特定于业务逻辑的对帐：This is a popular use case for DynamoEach data object is replicated across multiple nodesIn case of divergent versions, the client application performs its own reconciliation logicThe shopping cart service discussed earlier is a prime example of this categoryIts business logic reconciles objects by merging different versions of a customer’s shopping cart.
基于时间戳的对帐：This case differs from the previous one only in the reconciliation mechanismIn case of divergent versions, Dynamo performs simple timestamp based reconciliation logic of “last write wins”; i.e., the object with the largest physical timestamp value is chosen as the correct versionThe service that maintains customer’s session information is a good example of a service that uses this mode.
高性能读取引擎：While Dynamo is built to be an “always writeable” data store, a few services are tuning its quorum characteristics and using it as a high performance read engineTypically, these services have a high read request rate and only a small number of updates在这个配置中,通常R将1 N和WFor these services, Dynamo provides the ability to partition and replicate their data across multiple nodes thereby offering incremental scalabilitySome of these instances function as the authoritative persistence cache for data stored in more heavy weight backing storesServices that maintain product catalog and promotional items fit in this category.
The main advantage of Dynamo is that its client applications can tune the values of N, R and W to achieve their desired levels of performance, availability and durabilityFor instance, the value of N determines the durability of each objectA typical value of N used by Dynamo’s users is 3.
The values of W and R impact object availability, durability and consistencyFor instance, if W is set to 1, then the system will never reject a write request as long as there is at least one node in the system that can successfully process a write requestHowever, low values of W and R can increase the risk of inconsistency as write requests are deemed successful and returned to the clients even if they are not processed by a majority of the replicasThis also introduces a vulnerability window for durability when a write request is successfully returned to the client even though it has been persisted at only a small number of nodes.
Traditional wisdom holds that durability and availability go hand-in-hand但是，这不一定是真的For instance, the vulnerability window for durability can be decreased by increasing WThis may increase the probability of rejecting requests (thereby decreasing availability) because more storage hosts need to be alive to process a write request.
The common (N,R,W) configuration used by several instances of Dynamo is (3,2,2)These values are chosen to meet the necessary levels of performance, durability, consistency, and availability SLAs.
All the measurements presented in this section were taken on a live system operating with a configuration of (3,2,2) and running a couple hundred nodes with homogenous hardware configurationsAs mentioned earlier, each instance of Dynamo contains nodes that are located in multiple datacenters. These datacenters are typically connected through high speed network linksRecall that to generate a successful get (or put) response R (or W) nodes need to respond to the coordinatorClearly, the network latencies between datacenters affect the response time and the nodes (and their datacenter locations) are chosen such that the applications target SLAs are met.
While Dynamo’s principle design goal is to build a highly available data store, performance is an equally important criterion in Amazon’s platformAs noted earlier, to provide a consistent customer experience, Amazon’s services set their performance targets at higher percentiles (such as the 99.9th or 99.99th percentiles)A typical SLA required of services that use Dynamo is that 99.9% of the read and write requests execute within 300ms.
Since Dynamo is run on standard commodity hardware components that have far less I/O throughput than high-end enterprise servers, providing consistently high performance for read and write operations is a non-trivial taskThe involvement of multiple storage nodes in read and write operations makes it even more challenging, since the performance of these operations is limited by the slowest of the R or W replicasFigure 4 shows the average and 99.9th percentile latencies of Dynamo’s read and write operations during a period of 30 daysAs seen in the figure, the latencies exhibit a clear diurnal pattern which is a result of the diurnal pattern in the incoming request rate (i.e., there is a significant difference in request rate between the daytime and night)Moreover, the write latencies are higher than read latencies obviously because write operations always results in disk accessAlso, the 99.9th percentile latencies are around 200 ms and are an order of magnitude higher than the averagesThis is because the 99.9th percentile latencies are affected by several factors such as variability in request load, object sizes, and locality patterns.
Figure 4: Average and 99.9 percentiles of latencies for read and write requests during our peak request season of December 2006The intervals between consecutive ticks in the x-axis correspond to 12 hoursLatencies follow a diurnal pattern similar to the request rate and 99.9 percentile latencies are an order of magnitude higher than averages.
While this level of performance is acceptable for a number of services, a few customer-facing services required higher levels of performanceFor these services, Dynamo provides the ability to trade-off durability guarantees for performanceIn the optimization each storage node maintains an object buffer in its main memoryEach write operation is stored in the buffer and gets periodically written to storage by a作家线程. In this scheme, read operations first check if the requested key is present in the bufferIf so, the object is read from the buffer instead of the storage engine.
This optimization has resulted in lowering the 99.9th percentile latency by a factor of 5 during peak traffic even for a very small buffer of a thousand objects (see Figure 5)Also, as seen in the figure, write buffering smoothes out higher percentile latenciesObviously, this scheme trades durability for performanceIn this scheme, a server crash can result in missing writes that were queued up in the bufferTo reduce the durability risk, the write operation is refined to have the coordinator choose one out of the N replicas to perform a “durable write”Since the coordinator waits only for W responses, the performance of the write operation is not affected by the performance of the durable write operation performed by a single replica.
Figure 5: Comparison of performance of 99.9th percentile latencies for buffered vsnon-buffered writes over a period of 24 hoursThe intervals between consecutive ticks in the x-axis correspond to one hour.
Dynamo uses consistent hashing to partition its key space across its replicas and to ensure uniform load distributionA uniform key distribution can help us achieve uniform load distribution assuming the access distribution of keys is not highly skewedIn particular, Dynamo’s design assumes that even where there is a significant skew in the access distribution there are enough keys in the popular end of the distribution so that the load of handling popular keys can be spread across the nodes uniformly through partitioningThis section discusses the load imbalance seen in Dynamo and the impact of different partitioning strategies on load distribution.
To study the load imbalance and its correlation with request load, the total number of requests received by each node was measured for a period of 24 hours - broken down into intervals of 30 minutesIn a given time window, a node is considered to be “in-balance”, if the node’s request load deviates from the average load by a value a less than a certain threshold (here 15%)否则该节点被视为“不平衡”Figure 6 presents the fraction of nodes that are “out-of-balance” (henceforth, “imbalance ratio”) during this time periodFor reference, the corresponding request load received by the entire system during this time period is also plottedAs seen in the figure, the imbalance ratio decreases with increasing loadFor instance, during low loads the imbalance ratio is as high as 20% and during high loads it is close to 10%Intuitively, this can be explained by the fact that under high loads, a large number of popular keys are accessed and due to uniform distribution of keys the load is evenly distributedHowever, during low loads (where load is 1/8th of the measured peak load), fewer popular keys are accessed, resulting in a higher load imbalance.
Figure 6: Fraction of nodes that are out-of-balance (i.e., nodes whose request load is above a certain threshold from the average system load) and their corresponding request loadThe interval between ticks in x-axis corresponds to a time period of 30 minutes.
This section discusses how Dynamo’s partitioning scheme has evolved over time and its implications on load distribution.
Strategy 1: T random tokens per node and partition by token value: This was the initial strategy deployed in production (and described in Section 4.2)In this scheme, each node is assigned T tokens (chosen uniformly at random from the hash space)The tokens of all nodes are ordered according to their values in the hash spaceEvery two consecutive tokens define a rangeThe last token and the first token form a range that "wraps" around from the highest value to the lowest value in the hash space因为令牌是随机选择的，所以范围的大小不同As nodes join and leave the system, the token set changes and consequently the ranges changeNote that the space needed to maintain the membership at each node increases linearly with the number of nodes in the system.
While using this strategy, the following problems were encounteredFirst, when a new node joins the system, it needs to “steal” its key ranges from other nodesHowever, the nodes handing the key ranges off to the new node have to scan their local persistence store to retrieve the appropriate set of data itemsNote that performing such a scan operation on a production node is tricky as scans are highly resource intensive operations and they need to be executed in the background without affecting the customer performanceThis requires us to run the bootstrapping task at the lowest priorityHowever, this significantly slows the bootstrapping process and during busy shopping season, when the nodes are handling millions of requests a day, the bootstrapping has taken almost a day to completeSecond, when a node joins/leaves the system, the key ranges handled by many nodes change and the Merkle trees for the new ranges need to be recalculated, which is a non-trivial operation to perform on a production systemFinally, there was no easy way to take a snapshot of the entire key space due to the randomness in key ranges, and this made the process of archival complicatedIn this scheme, archiving the entire key space requires us to retrieve the keys from each node separately, which is highly inefficient.
The fundamental issue with this strategy is that the schemes for data partitioning and data placement are intertwinedFor instance, in some cases, it is preferred to add more nodes to the system in order to handle an increase in request loadHowever, in this scenario, it is not possible to add nodes without affecting data partitioningIdeally, it is desirable to use independent schemes for partitioning and placementTo this end, following strategies were evaluated:
Strategy 2: T random tokens per node and equal sized partitions:In this strategy, the hash space is divided into Q equally sized partitions/ranges and each node is assigned T random tokensQ is usually set such that Q >> N and Q >> S*T, where S is the number of nodes in the systemIn this strategy, the tokens are only used to build the function that maps values in the hash space to the ordered lists of nodes and not to decide the partitioningA partition is placed on the first N unique nodes that are encountered while walking the consistent hashing ring clockwise from the end of the partition图7说明了N = 3的策略In this example, nodes A, B, C are encountered while walking the ring from the end of the partition that contains key k1The primary advantages of this strategy are: (i) decoupling of partitioning and partition placement, and (ii) enabling the possibility of changing the placement scheme at runtime.
Figure 7: Partitioning and placement of keys in the three strategiesA, B, and C depict the three unique nodes that form the preference list for the key k1 on the consistent hashing ring (N=3)The shaded area indicates the key range for which nodes A, B, and C form the preference list. Dark arrows indicate the token locations for various nodes.
Strategy 3: Q/S tokens per node, equal-sized partitions: Similar to strategy 2, this strategy divides the hash space into Q equally sized partitions and the placement of partition is decoupled from the partitioning schemeMoreover, each node is assigned Q/S tokens where S is the number of nodes in the systemWhen a node leaves the system, its tokens are randomly distributed to the remaining nodes such that these properties are preservedSimilarly, when a node joins the system it "steals" tokens from nodes in the system in a way that preserves these properties.
The efficiency of these three strategies is evaluated for a system with S=30 and N=3However, comparing these different strategies in a fair manner is hard as different strategies have different configurations to tune their efficiencyFor instance, the load distribution property of strategy 1 depends on the number of tokens (i.e., T) while strategy 3 depends on the number of partitions (i.e., Q)One fair way to compare these strategies is to evaluate the skew in their load distribution while all strategies use the same amount of space to maintain their membership informationFor instance, in strategy 1 each node needs to maintain the token positions of all the nodes in the ring and in strategy 3 each node needs to maintain the information regarding the partitions assigned to each node.
In our next experiment, these strategies were evaluated by varying the relevant parameters (T and Q)The load balancing efficiency of each strategy was measured for different sizes of membership information that needs to be maintained at each node, where负载均衡效率is defined as the ratio of average number of requests served by each node to the maximum number of requests served by the hottest node.
结果如图8所示As seen in the figure, strategy 3 achieves the best load balancing efficiency and strategy 2 has the worst load balancing efficiencyFor a brief time, Strategy 2 served as an interim setup during the process of migrating Dynamo instances from using Strategy 1 to Strategy 3Compared to Strategy 1, Strategy 3 achieves better efficiency and reduces the size of membership information maintained at each node by three orders of magnitudeWhile storage is not a major issue the nodes gossip the membership information periodically and as such it is desirable to keep this information as compact as possibleIn addition to this, strategy 3 is advantageous and simpler to deploy for the following reasons: (i)Faster bootstrapping/recovery:Since partition ranges are fixed, they can be stored in separate files, meaning a partition can be relocated as a unit by simply transferring the file (avoiding random accesses needed to locate specific items)This simplifies the process of bootstrapping and recovery. (ii)易于存档: Periodical archiving of the dataset is a mandatory requirement for most of Amazon storage servicesArchiving the entire dataset stored by Dynamo is simpler in strategy 3 because the partition files can be archived separatelyBy contrast, in Strategy 1, the tokens are chosen randomly and, archiving the data stored in Dynamo requires retrieving the keys from individual nodes separately and is usually inefficient and slowThe disadvantage of strategy 3 is that changing the node membership requires coordination in order to preserve the properties required of the assignment.
Figure 8: Comparison of the load distribution efficiency of different strategies for system with 30 nodes and N=3 with equal amount of metadata maintained at each nodeThe values of the system size and number of replicas are based on the typical configuration deployed for majority of our services.
As noted earlier, Dynamo is designed to tradeoff consistency for availabilityTo understand the precise impact of different failures on consistency, detailed data is required on multiple factors: outage length, type of failure, component reliability, workload etcPresenting these numbers in detail is outside of the scope of this paperHowever, this section discusses a good summary metric: the number of divergent versions seen by the application in a live production environment.
Divergent versions of a data item arise in two scenarios. The first is when the system is facing failure scenarios such as node failures, data center failures, and network partitionsThe second is when the system is handling a large number of concurrent writers to a single data item and multiple nodes end up coordinating the updates concurrentlyFrom both a usability and efficiency perspective, it is preferred to keep the number of divergent versions at any given time as low as possibleIf the versions cannot be syntactically reconciled based on vector clocks alone, they have to be passed to the business logic for semantic reconciliationSemantic reconciliation introduces additional load on services, so it is desirable to minimize the need for it.
In our next experiment, the number of versions returned to the shopping cart service was profiled for a period of 24 hoursDuring this period, 99.94% of requests saw exactly one version; 0.00057% of requests saw 2 versions; 0.00047% of requests saw 3 versions and 0.00009% of requests saw 4 versions这表明很少创建不同的版本。
Experience shows that the increase in the number of divergent versions is contributed not by failures but due to the increase in number of concurrent writersThe increase in the number of concurrent writes is usually triggered by busy robots (automated client programs) and rarely by humansThis issue is not discussed in detail due to the sensitive nature of the story.
As mentioned in Section 5, Dynamo has a request coordination component that uses a state machine to handle incoming requestsClient requests are uniformly assigned to nodes in the ring by a load balancerAny Dynamo node can act as a coordinator for a read requestWrite requests on the other hand will be coordinated by a node in the key’s current preference list. This restriction is due to the fact that these preferred nodes have the added responsibility of creating a new version stamp that causally subsumes the version that has been updated by the write requestNote that if Dynamo’s versioning scheme is based on physical timestamps, any node can coordinate a write request.
An alternative approach to request coordination is to move the state machine to the client nodesIn this scheme client applications use a library to perform request coordination locallyA client periodically picks a random Dynamo node and downloads its current view of Dynamo membership state. Using this information the client can determine which set of nodes form the preference list for any given keyRead requests can be coordinated at the client node thereby avoiding the extra network hop that is incurred if the request were assigned to a random Dynamo node by the load balancerWrites will either be forwarded to a node in the key’s preference list or can be coordinated locally if Dynamo is using timestamps based versioning.
An important advantage of the client-driven coordination approach is that a load balancer is no longer required to uniformly distribute client loadFair load distribution is implicitly guaranteed by the near uniform assignment of keys to the storage nodesObviously, the efficiency of this scheme is dependent on how fresh the membership information is at the clientCurrently clients poll a random Dynamo node every 10 seconds for membership updatesA pull based approach was chosen over a push based one as the former scales better with large number of clients and requires very little state to be maintained at servers regarding clientsHowever, in the worst case the client can be exposed to stale membership for duration of 10 secondsIn case, if the client detects its membership table is stale (for instance, when some members are unreachable), it will immediately refresh its membership information.
Table 2 shows the latency improvements at the 99.9th percentile and averages that were observed for a period of 24 hours using client-driven coordination compared to the server-driven approachAs seen in the table, the client-driven coordination approach reduces the latencies by at least 30 milliseconds for 99.9th percentile latencies and decreases the average by 3 to 4 millisecondsThe latency improvement is because the client-driven approach eliminates the overhead of the load balancer and the extra network hop that may be incurred when a request is assigned to a random nodeAs seen in the table, average latencies tend to be significantly lower than latencies at the 99.9th percentileThis is because Dynamo’s storage engine caches and write buffer have good hit ratiosMoreover, since the load balancers and network introduce additional variability to the response time, the gain in response time is higher for the 99.9th percentile than the average.
Table 2: Performance of client-driven and server-driven coordination approaches.
Each node performs different kinds of background tasks for replica synchronization and data handoff (either due to hinting or adding/removing nodes) in addition to its normal foreground put/get operations. In early production settings, these background tasks triggered the problem of resource contention and affected the performance of the regular put and get operationsHence, it became necessary to ensure that background tasks ran only when the regular critical operations are not affected significantlyTo this end, the background tasks were integrated with an admission control mechanism. Each of the background tasks uses this controller to reserve runtime slices of the resource (e.gbetway88体育官网），共享所有后台任务A feedback mechanism based on the monitored performance of the foreground tasks is employed to change the number of slices that are available to the background tasks.
The admission controller constantly monitors the behavior of resource accesses while executing a "foreground" put/get operation. Monitored aspects include latencies for disk operations, failed betway88体育官网 accesses due to lock-contention and transaction timeouts, and request queue wait timesThis information is used to check whether the percentiles of latencies (or failures) in a given trailing time window are close to a desired thresholdFor example, the background controller checks to see how close the 99th percentile betway88体育官网 read latency (over the last 60 seconds) is to a preset threshold (say 50ms)The controller uses such comparisons to assess the resource availability for the foreground operationsSubsequently, it decides on how many time slices will be available to background tasks, thereby using the feedback loop to limit the intrusiveness of the background activitiesNote that a similar problem of managing background tasks has been studied in .
This section summarizes some of the experiences gained during the process of implementation and maintenance of DynamoMany Amazon internal services have used Dynamo for the past two years and it has provided significant levels of availability to its applicationsIn particular, applications have received successful responses (without timing out) for 99.9995% of its requests and no data loss event has occurred to date.
Moreover, the primary advantage of Dynamo is that it provides the necessary knobs using the three parameters of (N,R,W) to tune their instance based on their needs.Unlike popular commercial data stores, Dynamo exposes data consistency and reconciliation logic issues to the 必威体育精装版app官网ersAt the outset, one may expect the application logic to become more complexHowever, historically, Amazon’s platform is built for high availability and many applications are designed to handle different failure modes and inconsistencies that may ariseHence, porting such applications to use Dynamo was a relatively simple taskFor new applications that want to use Dynamo, some analysis is required during the initial stages of the 必威体育精装版app官网ment to pick the right conflict resolution mechanisms that meet the business case appropriatelyFinally, Dynamo adopts a full membership model where each node is aware of the data hosted by its peersTo do this, each node actively gossips the full routing table with other nodes in the systemThis model works well for a system that contains couple of hundreds of nodesHowever, scaling such a design to run with tens of thousands of nodes is not trivial because the overhead in maintaining the routing table increases with the system sizeThis limitation might be overcome by introducing hierarchical extensions to DynamoAlso, note that this problem is actively addressed by O(1) DHT systems(e.g., ).
This paper described Dynamo, a highly available and scalable data store, used for storing state of a number of core services of Amazon.com’s e-commerce platformDynamo has provided the desired levels of availability and performance and has been successful in handling server failures, data center failures and network partitionsDynamo is incrementally scalable and allows service owners to scale up and down based on their current request loadDynamo allows service owners to customize their storage system to meet their desired performance, durability and consistency SLAs by allowing them to tune the parameters N, R, and W.
The production use of Dynamo for the past year demonstrates that decentralized techniques can be combined to provide a single highly-available systemIts success in one of the most challenging application environments shows that an eventual-consistent storage system can be a building block for highly-available applications.
The authors would like to thank Pat Helland for his contribution to the initial design of DynamoWe would also like to thank Marvin Theimer and Robert van Renesse for their commentsFinally, we would like to thank our shepherd, Jeff Mogul, for his detailed comments and inputs while preparing the camera ready version that vastly improved the quality of the paper.
 Adya, A., Bolosky, WJ., Castro, M., Cermak, G., Chaiken, R., Douceur, JR.，Howell，J.，Lorch，JR., Theimer, M., and Wattenhofer, RP2002. Farsite: federated, available, and reliable storage for an incompletely trusted environment.SIGOPS OperSYST启示录36，SI（Dec2002), 1-14.
 Bernstein, P.A., and Goodman, NAn algorithm for concurrency control and recovery in replicated distributed betway88体育官网sACM Transon betway88体育官网 Systems, 9(4):596-615, December 1984
 Chang, F., Dean, J., Ghemawat, S., Hsieh, WC.，Wallach，DA., Burrows, M., Chandra, T., Fikes, A., and Gruber, RË2006年Bigtable: a distributed storage system for structured data在Proceedings of the 7th Conference on USENIX Symposium on Operating Systems Design and Implementation - Volume 7（西雅图，华盛顿州，2006年11月6日至8日）USENIX Association, Berkeley, CA, 15-15.
 Douceur, J[R和Bolosky，WĴ2000Process-based regulation of low-importance processes.SIGOPS OperSYST启示录34,2（4月2000), 26-27.
 Fox, A., Gribble, SD.，Chawathe，Y.，Brewer，EA., and Gauthier, P. 1997基于群集的可扩展网络服务在Proceedings of the Sixteenth ACM Symposium on Operating Systems Principles(Saint Malo, France, October 05 - 08, 1997)W中号韦特，艾德SOSP '97ACM Press, New York, NY, 78-91.
 Ghemawat, S., Gobioff, H., and Leung, S2003The Google file system. InProceedings of the Nineteenth ACM Symposium on Operating Systems Principles（美国纽约州博尔顿登陆，2003年10月19日至22日）SOSP '03ACM Press, New York, NY, 29-43.
 Gray, J., Helland, P., O'Neil, P., and Shasha, D1996年The dangers of replication and a solution在Proceedings of the 1996 ACM SIGMOD international Conference on Management of Data(Montreal, Quebec, Canada, June 04 - 06, 1996)Ĵ威德姆，艾德SIGMOD '96ACM Press, New York, NY, 173-182.
 Gupta, I., Chandra, TD.和Goldszmidt，G小号2001年On scalable and efficient distributed failure detectors在Proceedings of the Twentieth Annual ACM Symposium on Principles of Distributed Computing(Newport, Rhode Island, United States)PODC '01ACM出版社，纽约，纽约，170-179。
 Kubiatowicz, J., Bindel, D., Chen, Y., Czerwinski, S., Eaton, P., Geels, D., Gummadi, R., Rhea, S., Weatherspoon, H., Wells, C., and Zhao, B2000. OceanStore: an architecture for global-scale persistent storage.SIGARCH ComputArchit新闻28,5（Dec2000），190-201。
 Karger, D., Lehman, E., Leighton, T., Panigrahy, R., Levine, M., and Lewin, D1997. Consistent hashing and random trees: distributed caching protocols for relieving hot spots on the World Wide Web在Proceedings of the Twenty-Ninth Annual ACM Symposium on theory of Computing(El Paso, Texas, United States, May 04 - 06, 1997)STOC '97ACM Press，New York，NY，654-663。
 Lindsay, B.G., etal., “Notes on Distributed betway88体育官网s”, Research Report RJ2571(33471), IBM Research, July 1979
 Lamport, L时间，时钟和分布式系统中事件的顺序ACM Communications, 21(7), pp558-565,1978。
 Merkle, R基于传统加密功能的数字签名Proceedings of CRYPTO, pages 369–378Springer-Verlag，1988。
 Ramasubramanian, V., and Sirer, EGBeehive: O(1)lookup performance for power-law query distributions in peer-to-peer overlays在Proceedings of the 1st Conference on Symposium on Networked Systems Design and Implementation,San Francisco, CA, March 29 - 31, 2004.
 Reiher, P., Heidemann, J., Ratner, D., Skinner, G., and Popek, G1994年Resolving file conflicts in the Ficus file system在Proceedings of the USENIX Summer 1994 Technical Conference on USENIX Summer 1994 Technical Conference - Volume 1（马萨诸塞州波士顿，1994年6月6日至10日）USENIX Association, Berkeley, CA, 12-12..
 Rowstron, A., and Druschel, PPastry: Scalable, decentralized object location and routing for large-scale peer-to-peer systems.Proceedings of Middleware, pages 329-350, November, 2001.
 Rowstron, A., and Druschel, PStorage management and caching in PAST, a large-scale, persistent peer-to-peer storage utilityProceedings of Symposium on Operating Systems Principles, October 2001.
 Saito, Y., Frølund, S., Veitch, A., Merchant, A., and Spence, S2004年FAB: building distributed enterprise disk arrays from commodity components.SIGOPS Oper. Syst启示录38,5（Dec2004），48-58。
 Satyanarayanan, M., Kistler, J.J., Siegel, E.HCoda：弹性分布式文件系统IEEE Workshop on Workstation Operating Systems, Nov1987年。
 Stoica, I., Morris, R., Karger, D., Kaashoek, MF.和Balakrishnan，H2001年Chord: A scalable peer-to-peer lookup service for internet applications在Proceedings of the 2001 Conference on Applications, Technologies, Architectures, and Protocols For Computer Communications(San Diego, California, United States)SIGCOMM '01ACM出版社，纽约，纽约，149-160。
 Terry, DB.，Theimer，MM.，Petersen，K.，Demers，AJ.，Spreitzer，MJ., and Hauser, CH1995年Managing update conflicts in Bayou, a weakly connected replicated storage system在Proceedings of the Fifteenth ACM Symposium on Operating Systems Principles(Copper Mountain, Colorado, United States, December 03 - 06, 1995)中号乙琼斯，艾德SOSP '95ACM Press, New York, NY, 172-182.
 Thomas, RHA majority consensus approach to concurrency control for multiple copy betway88体育官网sACM Transactions on betway88体育官网 Systems 4 (2): 180-209, 1979.
 Weatherspoon, H., Eaton, P., Chun, B., and Kubiatowicz, J2007年Antiquity: exploiting a secure log for wide-area distributed storage.SIGOPS OperSYST启示录41,3（Jun2007），371-384。
 Welsh, M., Culler, D., and Brewer, E2001年SEDA: an architecture for well-conditioned, scalable internet services在Proceedings of the Eighteenth ACM Symposium on Operating Systems Principles(Banff, Alberta, Canada, October 21 - 24, 2001)SOSP '01ACM出版社，纽约，纽约，230-243。