This page describes maintenance simulation and explains how to run a simulated
maintenance event on Memorystore for Valkey. For more information about maintenance
updates and maintenance windows, see
[About maintenance](https://docs.cloud.google.com/memorystore/docs/valkey/about-maintenance.md.txt).

To ensure that your applications correctly handle a planned maintenance event,
Memorystore for Valkey offers a *simulate maintenance event* feature. This feature
lets you simulate the maintenance process by performing planned failovers on
all nodes within the instance. This process is similar to a regular maintenance
operation. We strongly recommend that you use this feature in a test environment
or during periods of low traffic. For an overview of the maintenance process,
see [Gradual deployment strategy](https://docs.cloud.google.com/memorystore/docs/valkey/about-maintenance.md.txt#gradual_deployment_strategy)
and [Create-before-destroy lifecycle strategy](https://docs.cloud.google.com/memorystore/docs/valkey/about-maintenance.md.txt#create-before-destroy_lifecycle_strategy).

By observing your application's behavior during a simulated maintenance event,
you can identify potential issues and verify that your application can
handle maintenance correctly. For more information about best practices
regarding client configurations, see [Configure your client application](https://docs.cloud.google.com/memorystore/docs/valkey/about-maintenance.md.txt#configure_your_client_application).

## Run maintenance simulation on an instance

### gcloud


To run a maintenance simulation on Memorystore for Valkey,
use the
[`gcloud memorystore instances update`](https://docs.cloud.google.com/sdk/gcloud/reference/memorystore/instances/update.md.txt)
command:

```
gcloud memorystore instances update INSTANCE_ID \
--location=REGION_ID \
--simulate-maintenance-event
```

Replace the following:

- <var translate="no">INSTANCE_ID</var>: the ID of the instance for which you want to run a simulated maintenance
- <var translate="no">REGION_ID</var>: the region where your instance is located