DAX: DynamoDB Accelerator
Learn what DAX is and what it’s used for.
There are situations when the read or write speed is not as fast as an application needs it to be. For this reason, AWS provides us with the possibility of putting a component between our application and the database that allows us to improve the speed of interaction with our data. That component is a DynamoDB Accelerator (DAX). In this lesson, we are going to discuss what DAX is.
What is cache?
Before talking about what a DAX is, let’s first talk about what a cache is. When we read from a traditional database, so to speak, the information we’re reading is being stored on a hard disk which can either be solid state drives (SSD) or hard disk drives (HDD). The problem with this is that the access speed can often be slow. For this reason, there are other types of databases where the information is stored in RAM.
This type of database that stores information in RAM is called in-memory or cache database. The access speed in this type of system is much faster than disk access.
However, one consideration to keep in mind with a cache database is that, because the information is stored in memory, it can be lost if the device running the application shuts down. For this reason, it’s very important to consider creating backup systems or information redundancy in such a way that, in the event of failure, our data won’t be lost.
Cache patterns
In the software industry, we can find some patterns that we can implement when we use caches. Let’s look at some of them briefly:
Cache aside
This type of pattern is the most common. In this case, the application is responsible for synchronizing the main database with the cache. As the image below shows, the application first reads the database in memory and, if it doesn’t find the information it’s looking for, it goes and reads the database on disk. When it receives the information, the application stores the new record in the in-memory database.
Get hands-on with 1400+ tech skills courses.