Search code examples
google-cloud-platformgoogle-cloud-memorystore

Google Cloud Memory Store (Redis) usage


  1. I can be sure that my data will not be deleted for some reason, is it safe to use memory storage (Redis), or should I replicate data to the cloud data storage?

  2. When I increase memory capacity all my data are safe?


Solution

  • The events that could cause data loss (i.e. a memory flush for some reason) in Memorystore, mostly only affect Memorystore "Basic" instances.

    Memorystore has two instance tiers: Basic and Standard.

    Basic tier instaces are affected by the following events, which will cause a full cache flush:

    • Instance scaling (i.e. upgrading or downgrading the instance capacity)
    • Maintenance
    • Instance restarts (triggered manually)

    However, the Standard instance tier has a High Availability configuration, that includes a failover to replicate the data asynchronously. In Standard instances, in the case of any of the above events happens, the replica will be promoted to the main instance, and the memory will remain unaffected. However, the only data that might be lost are the writes that weren't propagated to the replica during the failover (due to the asynchronous nature of the replication). Nonetheless, the failover process is usually short and takes around 30 seconds to complete.

    As well, you can configure the behaviour of the instances when they reach maximum memory capacity, and use the maxmemory-policy=noeviction flag when configuring them, in order to avoid the instance to drop memory if this event happens. See the official Redis documentation for more details.

    You mentioned replicating the data to Cloud Storage, but currently there is no way to replicate the data outside of Memorystore.

    Regarding your second question, as I mentioned above, in a Standard tier instance, there won't be any data loss when changing the capacity of the instance.

    In short: if you want the maximum possible data and instance uptime reliability, and avoid inconvenient memory flushes, Memorystore provides it when using Standard tier instances.