×
Study Notes — Google Cloud

Google Cloud
Memorystore

Reduce latency with scalable, secure, and highly available in-memory managed service for Redis and Memcached.

Availability: Regional
SLA: 99.9%
Author: Michaël Bettan
01

Overview & Use Cases

Memorystore provides caching data capabilities using a very low-latency storage mechanism. It acts as a front-end for databases and powers real-time applications with fast read/write speeds for real-time dashboards.

99.9%
SLA
300GB
Redis Limit
5,120GB
Memcached Limit
< 1ms
Latency

Online Games & Social Media

  • Session Store
  • Content Caching
  • Jobs & Queues
  • Distributed Lock
  • Fast Data Ingestion
  • Stream Processing

Stream Processing & Analytics

  • Real-time Analytics
  • Leaderboard
  • Recommendation Engine
  • Counters
  • Page ranking
02

Billing & Capabilities

Billing Factors

  • Service tier: basic or standalone (HA) for Redis
  • Provisioned capacity: how much storage and throughput is available.
  • Region: location where the instance is provisioned.
  • Replicas (public preview): how many nodes are there in a Standard Tier instance.
  • vCPUs / cores per node for Memcached
  • Memory provisioned per node for Memcached

Key Capabilities

  • 2 options: Redis & Memcached
  • Scalable & HA: replicated across zones
  • Deep Insights: monitor instances using Cloud Operations
  • Backup data: Easily backup instance data or import data into Memorystore from GCS buckets using RDB files
  • Interoperability: no code change required
03

Ecosystem & Integration

Memorystore integrates seamlessly with open-source projects and Google Cloud services, making High-Availability easy and allowing scaling up to 30GiB Storage and 12 GPS throughput.

Compute Integration

  • App Engine Standard
  • App Engine Flexible
  • Google Compute Engine (GCE)
  • Cloud Functions
  • Google Kubernetes Engine (GKE)

Redis Tiers

Tiers determine availability, cost, and performance.

  • Basic: Lower cost. Does not provide high availability.
  • Standard: Supports automatic failover for high availability and up to 5 read replicas for scaling reads.
04

Key Considerations & OSS Redis

Persistence Limitation

Memorystore does not support persistence, so it should not be used for applications that need to save data to persistent storage (RDB Snapshot in Preview).

Monitoring

Even though it’s a managed service, you must monitor the following:

  • Memory usage
  • # of expirable keys
  • Duration periods of memory overload
  • Cache-hit ratio

Memorystore vs. OSS Redis

  • Persisting to Disk (Preview)
  • Parameters are not customizable
  • Lack of redis commands
  • Standard Tier does not provide read from replica (Preview)
05

Redis vs Memcached

Feature Redis Memcached
Overall Powerful data types & commands Great for multi-thread and simplicity
Data Types Strings, list, sets, sorted set, hashes, bit arrays, geospatial and hyper logs strings
Memory Limit 300 GB 5,120 GB (256 GB x 20 nodes)
Data size limits 512 MB (string type) 1 MB
Latency Sub-milliseconds Sub-milliseconds
Faster in general
Distributed caching cluster Yes No
Multi-thread Yes Yes
Scaling Horizontal Vertical
Replication Yes No
Transaction Yes No
Data Persistence No (as of GA) No
06

Read Scalability & Clustering

Memorystore for Redis clusters distribute data across multiple nodes, improving read scalability.

Clustering

Optimizing for Read Scalability

07

Disaster Recovery

Production vs. Development
Always test failover and scaling in a dedicated development environment to avoid impacting production data and traffic.
force-data-loss mode
Employs a chain of failover strategies to aggressively execute the failover. It does not check the offset delta between the primary and replicas before initiating the failover; you can potentially lose more than 30MB of data changes → testing only.
limited-data-loss mode
Minimizes data loss by verifying that the difference in data between the primary and replica is below 30 MB before initiating the failover. The offset on the primary is incremented for each byte of data that must be synchronized to its replicas → not a complete test.
08

Exam Quick Reference

Self-Assessment Questions

Q1. Which Google Cloud services can integrate seamlessly with Memorystore without code changes?

App Engine, Google Compute Engine (GCE), Cloud Functions, and Google Kubernetes Engine (GKE).

Q2. What is the key difference between Basic and Standard Tiers for Redis?

Basic Tier is lower cost and does not provide high availability. Standard Tier supports automatic failover for HA and up to 5 read replicas.

Q3. Can Memorystore be used as a persistent storage database?

No. Memorystore does not support full data persistence (RDB Snapshot is in Preview), so it should not be used for applications that need to save data to persistent storage.

Q4. When comparing Memorystore to Memcached, what is a distinct feature of Redis regarding data types?

Redis provides powerful data types (Strings, lists, sets, hashes, etc.) while Memcached mainly supports simple string data types.

Q5. What does the force-data-loss failover mode do during testing?

It aggressively executes failover without checking the offset delta between primary and replica, potentially causing data loss (>30MB). It is meant for testing only.