liveBook · Manning

In-memory database

As explained in Amazon Web Services in Action, Third Edition: An in-depth guide to AWS

An in-memory data store keeps data primarily in volatile memory to provide low-latency reads and writes.

An in-memory database keeps data in memory so an application can read and write it with very little latency. It can serve as a fast layer beside a relational database: the database remains the primary store, while the in-memory layer handles frequently accessed or transient data. section 11.0 section 11.1.1

Game leaderboard

A game can keep player scores in a Redis sorted set, which orders entries by score as they are inserted. Reading the leaderboard from Redis avoids repeatedly querying and sorting millions of scores in the relational database. Player profiles and other heavily read data can be cached there too. section 11.0

For a managed AWS deployment, Amazon ElastiCache runs Redis or Memcached clusters. A minimal single-node ElastiCache cluster in CloudFormation uses AWS::ElastiCache::CacheCluster with an engine, node type, node count, subnet group, and security group. Its nodes have private IP addresses, so testing requires a client such as an EC2 instance in the same VPC. section 11.1.1 section 11.7

Forum caching

Discourse uses PostgreSQL as its main data store and Redis for cached and transient data. A CloudFormation deployment brings together the VPC, cache cluster, database instance, EC2 instance, and their network settings. section 11.4

Choose a deployment by asking whether you need backup and restore, replication for availability, or sharding for more memory or throughput. Cached items may expire or be refreshed with write-through updates; a full cache may evict items. Memcached suits replaceable data but loses a failed node’s contents and cannot back them up. MemoryDB offers a Redis-compatible alternative with strong persistence guarantees. section 11.2 section 11.2.1 section 11.7

Table 11.2 Comparing ElastiCache and MemoryDB engines and deployment options (view table figure)

Service

Engine

Deployment Option

Backup/Restore

Replication

Sharding

ElastiCache

Memcached

Default

No

No

Yes

 

Redis

Single Node

Yes

No

No

 

 

Cluster Mode disabled

Yes

Yes

No

 

 

Cluster Mode enabled

Yes

Yes

Yes

MemoryDB

Redis

Default

Yes

Yes

Yes

Compare ElastiCache and MemoryDB deployment options by engine, backup and restore, replication, and sharding. section 11.2

How Amazon Web Services in Action, Third Edition: An in-depth guide to AWS covers it

How deep it goes
Works through a minimal CloudFormation cluster and deployment choices, but leaves cache-freshness techniques at a summary level.
Examples
Uses a Redis game leaderboard, game sessions, and a Discourse deployment with PostgreSQL and Redis.
What it assumes
Defines VPCs and subnets in plain terms while introducing CloudFormation configuration and an EC2 client for private cluster access.
What you can do after
Operate/configure a basic ElastiCache cluster with CloudFormation and evaluate engine and deployment options against persistence and availability needs.
How it connects
Connects Redis and Memcached to caching, relational databases, sharding, replication, and data persistence.

Also explained in

Compare how 5 books explain in-memory database →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Amazon Web Services in Action, Third Edition: An in-depth guide to AWS. The section links point to the parts of the book it draws on.