[Yandex Cloud documentation](../../index.md) > [Yandex Managed Service for Valkey™](../index.md) > [Concepts](index.md) > Storage

# Storage in Yandex Managed Service for Valkey™



Yandex Managed Service for Valkey™ allows you to use network and local storage drives for database clusters. Network drives are based on network blocks, i.e., virtual drives in the Yandex Cloud infrastructure. Local drives are physically located on the database host servers.

When creating a cluster, you can select the following disk types for data storage:

* **Network SSDs** (`network-ssd`): Compromise solution: slower than local SSDs, network SSDs ensure data integrity in the event of Yandex Cloud hardware failure.
* **Non-replicated SSDs** (`network-ssd-nonreplicated`): Network SSDs with higher performance achieved by eliminating redundancy.

  This disk type is unavailable for **Intel Broadwell**. For a list of host classes and corresponding platforms, see [Valkey™ host classes](instance-types.md).

  You can only expand this type of storage in 93 GB increments.


* **Ultra high-speed network SSDs with three replicas** (`network-ssd-io-m3`): Network disks that deliver performance equivalent to non-replicated SSDs while ensuring redundancy.

  You can only increase the size of these disks in 93 GB increments.


* **Local SSDs** (`local-ssd`): Highest-performing disks.

  You can expand such a storage as follows:
  * For **Intel Broadwell** and **Intel Cascade Lake**: Only in 100 GB increments.
  * For **Intel Ice Lake** and **AMD Zen 4**: Only in 368 GB increments.

  For a list of host classes and corresponding platforms, see [Valkey™ host classes](instance-types.md).

  For clusters with hosts residing in the `ru-central1-d` [availability zone](../../overview/concepts/geo-scope.md), local SSD storage is not available if using Intel Cascade Lake.

[Block](https://en.wikipedia.org/wiki/Block_(data_storage)) size for all disk types is 4 KB.

{% note info %}

Up to 5% of disk space is reserved for system use, so the disks may have less available space than indicated when creating a cluster.


For more information about sizes and performance of different disk types, see [this Yandex Compute Cloud guide](../../compute/concepts/limits.md#compute-limits-disks).


{% endnote %}

## Selecting disk type when creating a cluster {#storage-type-selection}

The number of hosts you can create together with a Valkey™ cluster depends on the disk type you select and whether you enabled [sharding](sharding.md):

| Disk type                                                             | Non-sharded cluster  | Sharded cluster    |
| ------------------------------------------------------------------------- | --------------------------------- | ----------------------------------|
| Network SSDs (`network-ssd`), ultra high-speed network SSDs with three replicas (`network-ssd-io-m3`)                           | 1 host or more                         | 1 host or more (1 shard × 1 host)     |
| Local SSDs (`local-ssd`)                           | 3 hosts or more                        | 2 hosts or more (1 shard × 2 hosts)    |
| Non-replicated SSDs (`network-ssd-nonreplicated`)     | 3 hosts or more                        | 3 hosts or more (1 shard × 3 hosts)    |

Learn about the limits on the number of hosts per cluster or shard in [Quotas and limits](limits.md).


## Managing disk space {#manage-storage-space}

When the storage is 100% full, cluster hosts automatically switch to read-only mode. In this mode, data write requests fail. To release the cluster from read-only mode, [increase the storage size](../operations/update.md#change-disk-size) or contact [support](https://center.yandex.cloud/support).

### Monitoring the transition to read-only mode {#read-only-monitor}

To monitor the cluster storage usage, set up alerts in Yandex Monitoring:

1. Navigate to the folder dashboard and select **Monitoring**.
1. [Create a notification channel](../../monitoring/operations/alert/create-channel.md).
1. [Create an alert](../../monitoring/operations/alert/create-alert.md) with the following properties:

   * Metric expression: `disk.used_bytes / disk.total_bytes * 100`.

   * **Alert condition**: Set alert trigger conditions:

      * **Aggregation function**: `Maximum` (maximum metric value over the period).
      * **Comparison function**: `Greater than or equals`.
      * **Warning**: `90` (90 % of storage size).
      * **Alarm**: `95` (95 % of storage size).
      * **Evaluation window**: Metric value calculation period.
      * **Evaluation delay**: Preferred time shift backward, in seconds. Allows to exclude incorrectly triggered alerts with several metrics collected at different time intervals. To learn more about the calculation delay, see [this Yandex Monitoring guide](../../monitoring/concepts/alerting/alert.md#evaluation-delay).

   * **Notifications**: Add the notification channel you created earlier.

### Automatic storage expansion {#auto-rescale}

Automatic increase of storage size prevents situations where free disk space has been used up and hosts have switched to read-only mode. The storage size increases upon reaching the specified threshold percentage of the total capacity. There are two thresholds:

* Scheduled expansion threshold: When reached, the storage expands during the next [maintenance window](maintenance.md#maintenance-window). If this threshold is set, [configure](../operations/update.md#change-additional-settings) the maintenance schedule.
* Immediate expansion threshold: When reached, the storage size increases immediately.

You can use either one or both thresholds. If you set both, make sure the immediate increase threshold is higher than the scheduled one.

Upon reaching the specified threshold, the storage expands differently depending on the disk type:

* For network SSDs, by the higher of the two values: 20 GB or 20% of the current disk size.
* For non-replicated SSDs and ultra high-speed network SSDs with three replicas, by 93 GB.
* For local SSDs:

    * **Intel Broadwell** and **Intel Cascade Lake**, by 100 GB.
    * **Intel Ice Lake** and **AMD Zen 4**, by 368 GB.


If the threshold is reached again, the storage will be automatically expanded until it reaches the specified maximum. After that, you can set a new maximum storage size manually.

You can configure automatic storage expansion when [creating](../operations/cluster-create.md) or [updating a cluster](../operations/update.md#disk-size-autoscale).


{% note warning %}

* You cannot decrease the storage size after automatic expansion.
* During storage resizing, cluster hosts will be stopped and updated one at a time.

{% endnote %}



## Disk encryption {#disk-encryption}

When creating or restoring a cluster from a backup, you can encrypt the storage disk with a [custom KMS key](../../kms/concepts/key.md). To encrypt a disk of an already created cluster, disable encryption, or encrypt a disk with a different key, create a backup of the cluster and restore it with the new settings.

To create an encrypted disk, you need the `kms.keys.user` [role](../../kms/security/index.md#kms-keys-user) or higher.

If you deactivate the key used to encrypt a disk, access to the data will be suspended until you reactivate the key.

{% note alert %}

If you delete the key used to encrypt a disk or its [version](../../kms/concepts/version.md), you will irrevocably lose access to your data. For more information, see [this Key Management Service guide](../../kms/concepts/version.md#version-distruct).

{% endnote %}


## Use cases {#examples}

* [Using a Yandex Managed Service for Valkey™ cluster as a PHP session storage](../tutorials/valkey-as-php-sessions-storage.md)
* [Migrating a database from a third-party Valkey™ cluster](../tutorials/data-migration.md)