Amazon DynamoDB Accelerator (DAX): Speed Up DynamoDB Response Times from Milliseconds to Microseconds without Application Rewrite.

• 1452 words

Today, I'm excited to announce the general availability of Amazon DynamoDB Accelerator (DAX), a fully managed, highly available, in-memory cache that can speed up DynamoDB response times from milliseconds to microseconds, even at millions of requests per second. You can add DAX to your existing DynamoDB applications with just a few clicks in the AWS Management Console – no application rewrites required.

DynamoDB has come a long way in the 5 years since we announced its availability in January 2012. As we said at the time, DynamoDB was a result of 15 years of learning in the area of large scale non-relational databases and cloud services. Based on this experience and learning, we built DynamoDB to be a fast, highly scalable NoSQL database to meet the needs of Internet-scale applications.

DynamoDB was the first service at AWS to use SSD storage. Development of DynamoDB was guided by the core set of distributed systems principles outlined in the Dynamo paper, resulting in an ultra-scalable and highly reliable database system. DynamoDB delivers predictable performance and single digit millisecond latencies for reads and writes to your application, whether you're just getting started and want to perform hundreds of reads or writes per second in dev and test, or you're operating at scale in production performing millions of reads and writes per second.

Saving crucial milliseconds

Having been closely involved in the design and development of DynamoDB over the years, I find it gratifying to see DynamoDB being used by more than 100,000 customers - including the likes of AirBnB, Amazon, Expedia, Lyft, Redfin, and Supercell. It delivers predictable performance, consistently in the single-digit milliseconds, to users of some of the largest, most popular, iconic applications in use today. I've had a chance to interact with many of these customers on the design of their apps. These interactions allow me to understand their emerging needs, which I take back to our development teams to further iterate on our services. Many of these customers have apps with near real-time requirements for accessing data that need even faster performance than single-digit milliseconds. These are the apps that have motivated us to develop DAX.

To give you some examples of my interactions, I've been talking to a few ad-tech companies lately, and their conversations are about how they can save milliseconds of performance. For their applications, they have 20-50 ms to decide whether or not to place a bid for an ad. Every millisecond that is spent querying a database and waiting for a key piece of data is time that they could otherwise use to make better decisions, process more data, or improve calculations to place a more accurate bid.

These high-throughput, low-latency requirements need caching, not as a consideration, but as a best practice. Caches reduce latencies to microseconds, increases throughput, and in many cases, help customers save money by reducing the amount of resources they have to overprovision for their databases.

Caching is not a new concept, and I have always wondered, why doesn't everyone cache?

I think the reasons are many, but most follow a similar trend. Although many developers are aware of the patterns and benefits of adding a cache to an application, it's not easy to implement such functionality correctly. It's also time consuming and costly. When you write an application, you might not need or design for caching on day one. Thus, caching has to be shoehorned into an application that is already operational and experiencing load that would necessitate the added benefits. Adding caching when your app is already experiencing load is not easy. As a result, we see many folks trying to squeeze out every last drop of performance, or significantly overprovision their database resources to avoid adding a cache.

Fully managed cache for DynamoDB

What if you could seamlessly add caching to your application without requiring a re-write?

Enter DynamoDB Accelerator. With the launch of DAX, you now get microsecond access to data that lives in DynamoDB. DAX is an in-memory cache in front of DynamoDB and has the identical API as DynamoDB. There's no need to rewrite your applications to access your cache. You just point your existing application at the DAX endpoint, and as a read-through/write-through cache, DAX seamlessly handles caching for you. Microsecond response times, millions of requests per second—and of course, it's a fully managed environment that is highly available over multiple Availability Zones so you no longer have to worry about managing your cache.

With DAX, we've created a fully managed caching service that is API-compatible with DynamoDB. What this means to you as a developer is that you don't have to re-write your DynamoDB application to use DAX. Instead, using the DAX SDK for Java, you just point your existing application at a DAX endpoint, and DAX handles the rest. As a read-through/write-through cache, DAX will intercept both reads and writes to DynamoDB. For read-through caching, when a read is issued to DAX, it will first check to see if that item is in cache. If it is, DAX returns the value with response times in microseconds. If the item is not in cache, DAX automatically fetches the item from DynamoDB, caches the result for subsequent reads, and returns the value to the application. This is done transparently to the developer. Similarly, for writes, DAX first writes the value to DynamoDB, cache the value in DAX, and then returns success to the application. This way, reads after writes are available for cache hits, which further simplifies the application. With cache eviction handled by time-to-live (TTL) and write-through evictions, you no longer need the code to perform this task. DAX provides all the benefits of a cache, with a much simpler developer experience.

The following is code for an application that talks to DynamoDB:

All you have to do is point your application at the DAX endpoint with three lines of code. You've added in-memory caching without performing brain surgery on the application.

Adding DAX is as simple as the following code:

Why doesn't everyone cache? Many times, it is too costly in terms of time and complexity because developers have to alter some of their most critical code paths. With DAX, you get faster reads, more throughput, and cost savings - without having to write any new code.

What's not to like? This is a fantastic addition for our DynamoDB customers. To get started with DAX today, see Amazon DynamoDB Accelerator (DAX).

Many of our customers share my excitement:

10 billion matches later, Tinder has changed the way people meet around the world. "For Tinder, performance is absolutely key. We are major users of DynamoDB. We love its simplicity and ability to scale with consistent performance," said Maria Zhang, VP of Engineering at Tinder. "With DAX, AWS has taken performance to a new level, with response times in microseconds. We really like how DAX integrates seamlessly with DynamoDB, is API-compatible, and doesn't require us to write any new code. We are excited for the General Availability of DAX."

Careem is a car-booking service and app that serves more than 40 cities and 11 countries in the broader Middle East. The company uses a number of AWS services, including Amazon DynamoDB to store locations of its captains, promotions, and configurations._ _"We have been involved early on during the DAX public preview, and have been running our production workload on DAX with no issues," said Tafseer-ul-Islam Siddiqui, Software Architect at Careem. "We are using DAX to scale our reads across our network of services. As a write-through cache, DAX has simplified our application stack and has removed the need for building a central service for our caching needs. A key feature that motivated our adoption of DAX was that it is API-compatible with DynamoDB and thus required minimal changes to use with our existing app - you only need to change the DynamoDB client to the DAX client. Our team was really impressed with the built-in failover and replication support."

Canon INC. Office Imaging Products Development Planning & Management Center provides mission-critical cloud services connecting to business machines for worldwide customers across four continents. "Amazon DynamoDB Accelerator (DAX) is a very wonderful service to improve the user experience of Amazon DynamoDB," said Takashi Yagita, Principal Engineer, Office Imaging Products Development Planning & Management Center, Canon INC. "Our developers like the excellent design concept of DAX SDK, which enables us to switch from DynamoDB and start using DAX seamlessly. Our team has succeeded in keeping the DynamoDB capacity units far lower while improving the data access speed by DAX. We welcome that DAX is generally available."

This is a really a fantastic addition for our DynamoDB customers. To get started with DAX today, please see https://aws.amazon.com/dynamodb/dax/.