This page explains how to scale instances, and how scaling works for
Memorystore for Memcached.

You can scale the number of nodes in a cluster down to a minimum of 1 node or
up to a maximum of 20 nodes. You cannot scale a node's memory capacity or
number of vCPUs.

### Scaling out

When you scale out your cluster, unless you use [Auto Discovery](https://docs.cloud.google.com/memorystore/docs/memcached/auto-discovery-overview)
you must manually add the IP addresses of the new nodes to your application so
the application can access them. Also, Memorystore for Memcached does not rebalance the
data in your nodes. You must manage any data rebalancing you wish to perform.

### Scaling in

If you scale in your instance, you will lose the data that is stored in the
nodes that are deleted from your cluster.

During a scale in operation, Memorystore removes nodes from the end of the
node list. For example, if you are scaling from 12 nodes to 8 nodes, nodes 9-12
will be deleted from the instance.

You can view the node list on your Memcached instance's **node list**
tab in the Google Cloud console.

You can also view the node list by running the following command, replacing
<var translate="no">variables</var> with appropriate values:

```
gcloud memcache instances describe instance-id --region=us-region
```

#### Managing nodes when scaling in

Your application's node management strategy affects what actions you need to
take when scaling in your cluster.

If you manually manage the addition and removal of Memcached nodes in your
application, you must adjust your code by removing references to the nodes that
will be deleted before scaling in the cluster.

If you use [Auto Discovery](https://docs.cloud.google.com/memorystore/docs/memcached/auto-discovery-overview),
node addition and removal is handled for you automatically.

## Scaling the number of nodes in your cluster

### Console

1. Go to the Memorystore for Memcached page in the Google Cloud console.

   <br />

   [Memorystore for Memcached](https://console.cloud.google.com/memorystore/memcached/instances)
2. Click the Instance ID of the instance you want to resize.

3. Click **Edit**.

4. In the **Nodes** field, enter your desired number of nodes.

5. Click **Save**.

### Gcloud

Enter the following command, replacing the <var translate="no">variables</var>
with the appropriate values:

```
gcloud memcache instances update instance-id --region=region --node-count=desired-number-of-nodes
```

For example:

```
gcloud memcache instances update myinstance --region=us-central1 --node-count=6
```

## What's next

- View available [Memcached configurations](https://docs.cloud.google.com/memorystore/docs/memcached/memcached-configs).
- [Monitor your Memcached instances](https://docs.cloud.google.com/memorystore/docs/memcached/monitoring-instances).