ElastiCache

  • ElastiCache is a web service that makes it easy to deploy, operate and scale in-memory cache in the cloud.
  • ElastiCache improves the performance of the application by allowing retrieving the information from the fast, managed in-memory cache then the slow disk based database.
  • ElastiCache can improve the latency and throughput for the read-heavy application workloads or compute intensive work loads.
  • Caching improves application performance by storing critical piece of data in memory for low latency access.
  • ElastiCache has to be used with RDS
  • ElastiCache is very good choice if your database is particularly read-heavy and not prone to frequent change.
  • Redshift is very good for OLAP transactions.

Types of ElastiCache

  • MemCached
    • A widely adapted memory objects cache system. ElastiCache protocol is complaint with the MemCached.
    • All tools that work with MemCached environments will work in ElastiCache.
    • MemCache supports Multi-thread
    • MemCache doesnt have Multi-AZ capacity
  • Redis
    • A popular open-source in-memory keyvalue store that supports data structure such as sorted sets and list.
    • It supports Sorted set and list.
    • ElastiCache supports Master-Slave replication and Multi AZ which can be achieve cross AZ redundancy

Caching Strategy

Two types of strategies are available

  • Lazy loading
  • Write Throughput

Lazy Loading

  • Loads the data in cache only when required.
  • If the data is in cache, Elastic Cache will return the data or else it will return Null.
  • Lazy loading with TTL
    • Specify the number of seconds until the key or data expires to avoid keeping stale data in cache.
    • Lazy Loading treats an expired key as a cache miss and causes the application to retrieve the data from the database and write it back to the cache with a new TTL.
    • Lazy Loading does not eliminate the stale data but to avoid the stale data.

Write Through Cache

Write Through Cache adds and updates the cache whenever the data is written to the database.

DynamoDB

  • DynamoDB is fast and flexible NoSQL DB. It can be used for all application that needs consistent, single-digit millisecond latency at any scale. It is fully managed database.  And supports both document and key-value data model.
  • Stored in SSD storage.
  • Spread across three geographically distinct data centers.
  • Eventual Consistent Read (Default).
    • Consistency across all copies of the data is usually reached within 1 second. Repeating a read after a short time should return an updated data.
  • Strongly consistent Read.
    • Returns a result that reflects all writes that received successful response prior the read.
  • DynamoDB pricing
    • Provisioned Throughput capacity.
      • Write Throughput $0.0065 per hour for every 10 units.
      • Read Throughput $0.0065 per hour for every 50 units.
    • Storage cost of $0.25GB per month.


Aurora

  • Aurora runs only in AWS infrastructure.
  • Aurora is MySQL compatible, and can provide 5-times better performance than MySQL.
  • Aurora can deliver High Availability and performance.
  • Aurora provides better Scaling.
  • Aurora starts with 10GB and can scales in 10GB increments to 64 TB (Storage Auto Scaling)
  • Compute resource can upscale to 32v CPUs and 244 GB of Memory.
  • Aurora maintains two copies of the data in each AZ and maintains 3 AZ, so total 6 copies of the data.
  • Aurora is designed to handle transparently the loss of up to two copies of data without impacting the write availability and up to three copies without impacting the read availability.
  • Aurora is a self-healing, Data blocks and disks are continuously scanned for errors and repaired automatically.
  • Two types of Replicas for Aurora
    • Aurora Replicas (currently 15)
    • MySQL read Replicas (Currently 5)
  • Replicas priority login works in Tier 0 > Tier 1 > …. > Tier 15.
  • DB Cluster Identifier will be the DNS end point for the database instance.
  • Replication instance will have the DNS name as end point. In case of failure of the Cluster end point, it will automatically use the replication instance end point, no need to update the connection string.

DynamoDB Accelerator (DAX)

DyanmoDB Accelerator (DAX)

  • It is a fully managed, clustered in-memory cache for DynamoDB.
  • It is only used for Read operation, can increase 10x Read operation performance.
  • Microsecond performance for millions of request per second.
  • Ideal for Read-heavy or Brusty workloads

How it works

  • DAX is a write through cache service, i.e. it writes the data in cache as well as the backend DynamoDB table.
  • Your application and point to the DAX cluster instead of the actual backend table.
  • If the data you are looking in cache, the data is returned back from the cache and not from the actual table.
  • If the item is not in the cache, the DAX will perform eventually consistent GetItem operation against the DynamoDB.
  • Retrieval of the data from the DAX reduces the read load from actual DynamoDB table.
  • It also helps in reducing the Provisioned read capacity.

Not Suitable for

  • It is suitable for eventually consistent read operation, so it will not work with the application using Strongly Consistent.
  • Write intensive application
  • Application with fewer read operations
  • Application that do not require microsecond read operations.

Database Overview

  • AWS database types
    • RDS – OLTP        
      • SQL
      • MySQL
      • PostgreSQL
      • Oracle
      • Aurora
      • MariaDB
    • No SQL Database
      • DynamoDB
    • RedShift – OLAP
    • Elastic Cache – In Memory Cache
      • MemCached
      • Redis
  • Encryption of the Database
    • Encryption at REST is supported for MySQL, Oracle, SQL, PostgreSQL, MariaDB and Aurora.
    • Encryption is done by AWS KMS service (Key Management Service).
    • Once the RDS instance is encrypted. The data stored at REST in the underlying storage is encrypted.
    • This is applicable for Automated, Read Replicas and Snapshots.
    • At present, Encryption of the existing database is not supported. To use Amazon RDS encryption for the existing database, you must first create a snapshot, make a copy of that snapshot and encrypt the copy.