This page describes how a Memorystore for Redis instance behaves during a
version upgrade, how an upgrade affects your application, and when to upgrade.
For more information about how to upgrade the instance's version, see [Upgrade the Redis version of an instance](https://docs.cloud.google.com/memorystore/docs/redis/upgrading-instance-version).

Depending on the instance's tier, upgrading the version can have performance and
storage implications for your application. Current memory usage also limits when
you can upgrade the instance.

## Best practices for upgrading an instance's version

This section provides guidance for upgrading the version of an instance.

- Upgrade the instance to version 7.0 and later because Certificate Authority
  rotation no longer drops connections. For more information, see
  [Certificate Authority rotation](https://docs.cloud.google.com/memorystore/docs/redis/about-in-transit-encryption.md.txt#certificate_authority_rotation).

- Before you upgrade, export the instance's data. For more information, see
  [Export data from a Redis instance](https://docs.cloud.google.com/memorystore/docs/redis/export-data.md.txt).

- To improve the speed and reliability of the upgrade for Standard Tier
  instances, perform the upgrade during periods of low instance traffic. For more information
  about monitoring instance traffic, see [Monitor instances](https://docs.cloud.google.com/memorystore/docs/redis/monitoring-instances).

- When you upgrade a Standard Tier instance, keep the instance write load to a
  minimum. A high write load might cause upgrades to take significantly longer or
  fail.

- To manage the memory of the instance during the upgrade, follow our best
  practices for memory management. For more information, see
  [Memory management best practices](https://docs.cloud.google.com/memorystore/docs/redis/memory-management-best-practices.md.txt).

- To understand how the new version affects your application, review the
  supported versions. For more information, see [Supported versions](https://docs.cloud.google.com/memorystore/docs/redis/supported-versions.md.txt).

## Version upgrade behavior

A version upgrade preserves data for both Basic and Standard Tier instances.
Upgrading an instance's version causes a short connection reset of a couple of
minutes or less, making the instance temporarily unavailable. You might also
experience a delay of several minutes where core metrics don't appear.

After the upgrade completes, the instance becomes fully available and metrics
reporting resumes. To reconnect to the instance, incorporate retry logic in your
application's code. The IP address and connection string remain the same.

Because of the short connection reset, a small amount of stale or inconsistent
data might not write to or update the cache while the instance is unavailable.

### Write load during an upgrade

To minimize the performance impact on your application, upgrade the instance
during a period of low traffic. A high write load or high memory pressure might
cause the upgrade to take significantly longer or fail. For more information,
see [Scaling and version upgrade operations](https://docs.cloud.google.com/memorystore/docs/redis/memory-management-best-practices.md.txt#scaling_and_version_upgrade_operations).

### Expired keys

When you upgrade a Standard Tier instance, Memorystore for Redis doesn't
sync expired keys. If you have expired keys in the instance before you upgrade,
then you have fewer keys after the upgrade completes.