Memorystore Study Notes
Memorystore is Google Cloud's fully managed in-memory data store service offering Memorystore for Redis, for Valkey, and for Memcached. It provides sub-millisecond data access for caching, session management, gaming leaderboards, and real-time analytics without managing your own cache servers. Instances run inside your VPC for private, low-latency connectivity from Compute Engine, GKE, and other services.
Key facts
- Memorystore for Redis provides a managed Redis-compatible instance with support for data structures such as sorted sets, hashes, and pub/sub, plus optional persistence and replication features.
- High availability for Redis is achieved with a replica node in a different zone and automatic failover, so a primary failure promotes the replica with minimal disruption to applications.
- Memorystore for Memcached offers a distributed, multi-node cache optimized for simple key-value caching where data loss on node failure is acceptable because the cache can be repopulated.
- Instances are accessed via private IP addresses within a VPC network using Private Service Access or Private Service Connect, and are not exposed publicly by default for security.
- Redis tier and size determine memory capacity and performance, and scaling involves choosing a larger instance size, with sharding available in cluster configurations for larger datasets at the time of writing.
- Common patterns include database query caching to reduce load on Cloud SQL, storing user sessions for stateless web applications, and rate limiting counters that need fast atomic increments.
- Redis backups and import/export using RDB files stored in Cloud Storage allow migration and recovery, while Memcached has no persistence because it is a pure volatile cache.
- Eviction policies in Redis, such as least recently used, control what happens when memory fills, and monitoring memory utilization is essential to avoid unexpected key evictions.
- Because data lives in memory, Memorystore delivers microsecond to millisecond latency but costs more per gigabyte than disk-based storage, so it complements rather than replaces a primary database.
What the exam expects you to know
- Choose Memorystore for Redis when the scenario needs a managed cache with persistence options, advanced data structures, pub/sub, or sorted sets for leaderboards.
- Choose Memorystore for Memcached when the need is a simple, highly distributed, multi-threaded key-value cache for ephemeral data with no persistence requirement.
- Know that Memorystore is accessed privately over VPC, so connectivity questions involve Private Service Access, authorized networks, and firewall configuration.
- Recognize session storage and database offloading as the classic exam use cases, where Memorystore reduces latency and load but the system of record remains a database.
- Understand automatic failover in standard tier Redis versus basic tier without a replica, matching availability requirements in the scenario to the correct tier.
- Eliminate Memorystore as a primary durable database choice; exam questions about long-term system-of-record storage expect Cloud SQL, Firestore, or another persistent store.
Memorystore vs Cloud SQL: when to use which
Use Memorystore when you need extremely fast, in-memory access to frequently read data such as sessions, cached queries, or leaderboards, and you can tolerate rebuilding that data from a source system. Use Cloud SQL when you need durable, transactional, relational storage as the system of record with backups and strong consistency. In most architectures they are used together: Cloud SQL stores the truth and Memorystore accelerates reads in front of it. The exam expects this layered pattern rather than treating a cache as a replacement for the database. See also the Cloud SQL notes.
Useful gcloud commands
gcloud redis instances create my-cache --size=5 --region=us-central1 --tier=standard --redis-version=redis_7_0
gcloud redis instances list --region=us-central1
gcloud memcache instances create my-memcache --nodes=1 --node-cpu=1 --node-memory=1GB --region=us-central1Common exam traps
- Memcached has no persistence, replication, or advanced data structures; attributing Redis features to a Memcached instance is a frequent exam trap.
- Memorystore instances are not publicly accessible by default, so solutions proposing direct internet access without VPC connectivity are incorrect and insecure.
- A cache is not a durable database; storing the only copy of critical data in Memorystore risks loss during failover or eviction under memory pressure.
- Basic tier Redis has no replica and no automatic failover SLA, so it does not satisfy a high availability requirement despite being a managed service.
Frequently asked questions
When should I pick Redis over Memcached in Memorystore?
Pick Redis when you need persistence options, replication with failover, or rich data structures like sorted sets, lists, and pub/sub messaging. Pick Memcached when you only need a simple, distributed key-value cache that scales across many nodes and losing cached data is acceptable. The exam uses features mentioned in the scenario to distinguish the two engines.
How does Memorystore connect to my applications?
Memorystore instances receive a private IP address in your VPC and applications connect from resources in the same network, such as Compute Engine VMs or GKE clusters, using the Redis or Memcached protocol. Private Service Access or Private Service Connect establishes the private path. There is no public endpoint by default, which keeps cache traffic secure and low latency.
Can Memorystore replace my main database?
No, Memorystore is designed as a fast caching and real-time layer in front of a durable database, not as the sole system of record. Redis persistence reduces risk but eviction, failover, and memory limits mean authoritative data should live in Cloud SQL, Firestore, or another persistent store. Exam architectures pair Memorystore with a primary database for this reason.
Study aid disclaimer: Cloud Cert Notes is an independent educational study aid. It is not affiliated with, endorsed by, or sponsored by Google, Microsoft, Amazon, Oracle, or Alibaba. Google Cloud, Associate Cloud Engineer, and Cloud Digital Leader are trademarks of Google LLC; all other certification names and product names are trademarks of their respective owners. Always confirm service details against the official provider documentation before sitting an exam.