Informazioni sulla scalabilità della capacità delle istanze
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa pagina descrive il comportamento dell'istanza Memorystore for Redis Cluster
durante lo scaling.
Puoi scalare la capacità della tua istanza nei seguenti modi:
Puoi modificare il numero di shard per la tua istanza. Questa operazione è chiamata scalabilità
orizzontale. Puoi scalare un'istanza orizzontalmente in uno dei seguenti modi:
Scale out: aumenta la capacità dell'istanza, che dispone di più memoria e potenza di elaborazione per gestire un volume maggiore di dati o traffico. La capacità dell'istanza è determinata dal numero di shard
nell'istanza.
Scalando l'istanza, l'applicazione può gestire una domanda maggiore senza un calo delle prestazioni. Per scalare orizzontalmente un'istanza, aggiungi
shard all'istanza.
Riduzione dello scale: riduci la capacità della tua istanza, il che diminuisce sia la potenza di elaborazione sia la quantità di memoria disponibile per archiviare i dati. Ciò si verifica
quando le richieste di dati della tua applicazione diminuiscono e devi ridurre l'utilizzo delle risorse per risparmiare sui costi. Per ridurre le dimensioni di un'istanza, diminuisci il numero di shard nell'istanza.
Puoi modificare il tipo di nodo per l'istanza. Si tratta di scalabilità verticale.
Puoi scalare un'istanza verticalmente in uno dei seguenti modi:
Scalabilità verticale: aumenta la capacità dell'istanza. La capacità dell'istanza è determinata dal tipo di nodo dell'istanza. Per scalare un'istanza, cambia il tipo di nodo con un tipo di nodo più grande. Ad esempio, aumenta le dimensioni dell'istanza
da un tipo di nodo redis-standard-small a un tipo di nodo redis-highmem-medium.
Scale down: riduci la capacità dell'istanza. Per ridurre le dimensioni di un'istanza, modifica il tipo di nodo in un tipo di nodo più piccolo. Ad esempio, ridimensiona la tua
istanza da un tipo di nodo redis-highmem-medium a un tipo di nodo redis-standard-small.
Impatto dello scaling
Durante un'operazione di scalabilità, la disponibilità dell'istanza non viene interessata.
Tuttavia, quando modifichi il numero di shard nell'istanza, Memorystore for Redis Cluster ribilancia lo spazio delle chiavi dell'istanza. Ciò
potrebbe causare un aumento della latenza durante l'operazione di scalabilità.
Inoltre, l'impatto dello scalabilità verticale dell'istanza modificando il tipo di nodo
è simile a quello che si verifica con un'operazione di manutenzione.
Scenari di errore
Se si verifica un errore durante l'operazione di scalabilità, il motivo è probabilmente uno dei seguenti scenari:
Vuoi aggiornare il conteggio degli shard per la tua istanza, ma non hai
abbastanza memoria libera per il tipo di nodo redis-shared-core-nano per la tua istanza.
Per risolvere il problema, puoi scalare la tua istanza o liberare memoria dai nodi
dell'istanza. Per liberare memoria:
Sostituisci IP_ADDRESS e PORT_NUMBER con i valori che hai annotato nel passaggio precedente.
Prendi nota dell'indirizzo IP e del numero di porta di un nodo che non ha
spazio libero sufficiente. L'ID di questo nodo corrisponde a un ID visualizzato nell'errore.
Per connetterti a questo nodo, utilizza il seguente comando:
redis-cli -h IP_ADDRESS -p PORT_NUMBER
Sostituisci IP_ADDRESS e PORT_NUMBER con i valori che hai annotato nel passaggio precedente.
Nel prompt, inserisci il comando info memory.
Nell'output vengono visualizzati i valori dei parametri used_memory e maxmemory. used_memory è la quantità di memoria utilizzata dal nodo e maxmemory è la quantità di memoria disponibile per il nodo.
Dividi il valore del parametro used_memory per il valore del parametro
maxmemory e verifica che il quoziente sia superiore al 98%.
Inserisci di nuovo il comando info memory. Nell'output, il valore del
parametro used_memory è inferiore.
Dividi il valore del parametro used_memory per il valore del parametro
maxmemory e verifica che il quoziente sia ora inferiore al 98%.
In caso contrario, elimina altre chiavi.
Per tutti gli altri nodi che non hanno spazio libero sufficiente, ripeti i passaggi da 4 a 11
di questa procedura.
Hai eseguito lo scale up a un numero inferiore di shard che non hanno la capacità di contenere
tutte le chiavi che Memorystore for Redis Cluster archivia nell'istanza originale. Per risolvere il problema, esegui lo scale up a un numero maggiore di shard in grado di contenere tutte le chiavi archiviate. Per ulteriori informazioni su come aumentare il numero di
shard per l'istanza, consulta Scalare il conteggio degli shard.
Hai eseguito lo scale a un tipo di nodo più piccolo che non ha la capacità di contenere tutti i dati archiviati da Memorystore for Redis Cluster nel tipo di nodo originale. In questo caso, Memorystore for Redis Cluster
ti fornisce un tipo di nodo consigliato per fare lo scale down verticale.
Hai aggiornato il tipo di nodo per l'istanza e hai sovrascritto le impostazioni predefinite per il tipo di nodo originale o queste impostazioni sono già state sovrascritte. Tuttavia, il nuovo tipo di nodo scalato non supporta i valori per le impostazioni predefinite oppure le impostazioni non sono valide per il tipo di nodo. In questo caso, Memorystore for Redis Cluster restituisce un errore. Per risolvere il problema, modifica
manualmente le impostazioni in modo che siano valide per il nuovo tipo di nodo.
Hai scalato l'istanza durante un periodo di elevata pressione di scrittura (ad esempio,
durante il test di carico). Per risolvere il problema, esegui lo scale durante i periodi di traffico ridotto delle istanze.
Hai uno slot che contiene una chiave di grandi dimensioni e vuoi eseguire la migrazione di questa chiave
a un altro nodo. Tuttavia, questo nodo non dispone di memoria sufficiente per supportare
la chiave. Di conseguenza, non puoi aggiornare il cluster. Per risolvere il problema, riduci le dimensioni della chiave e riprova l'operazione di aggiornamento.
Il numero di slot di proprietà di un nodo di un cluster non è noto, ma è nota solo la gamma di slot. Memorystore for Redis Cluster restituisce un messaggio di errore. In questo caso,
riduci le dimensioni della chiave e riprova l'operazione di aggiornamento.
Hai eseguito lo scale out a un numero inferiore di shard, ma Memorystore for Redis Cluster non ha memoria sufficiente per soddisfare questa richiesta. Per risolvere il problema, esegui fare lo scale in fino al conteggio di shard originale più elevato.
Best practice
Per aiutarti a scalare la capacità della tua istanza e per aumentare la velocità e l'affidabilità della scalabilità dell'istanza, esegui lo scale up durante i periodi di traffico ridotto, quando possibile. Per scoprire come monitorare il traffico delle istanze, consulta Monitorare i cluster.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# About scaling instance capacity\n\nThis page describes how your Memorystore for Redis Cluster instance behaves\nduring scaling.\n\nYou can scale the capacity for your instance in the following ways:\n\n- You can change the number of shards for your instance. This is *horizontal\n scaling*. You can scale an instance horizontally in one of the following ways:\n\n - **Scale out**: increase the capacity of your instance, which gives the\n instance more memory and processing power to handle a larger volume of data or\n traffic. Your instance's capacity is determined by the number of shards in\n your instance.\n\n By scaling your instance out, your application can handle an increased\n demand without performance degradation. To scale an instance out, add\n shards to the instance.\n - **Scale in**: reduce the capacity of your instance, which decreases both the\n processing power and the amount of memory available to store data. This occurs\n when your application's data demands decrease and you need to lower your\n resource usage to save costs. To scale an instance in, reduce the number of\n shards in the instance.\n\n- You can change the node type for your instance. This is *vertical scaling*.\n You can scale an instance vertically in one of the following ways:\n\n - **Scale up** : increase the capacity of your instance. Your instance's capacity is determined by your instance's node type. To scale an instance up, change the node type to a larger node type. For example, scale your instance up from a `redis-standard-small` node type to a `redis-highmem-medium` node type.\n - **Scale down** : reduce the capacity of your instance. To scale an instance\n down, change the node type to a smaller node type. For example, scale your\n instance down from a `redis-highmem-medium` node type to a `redis-standard-small`\n node type.\n\n | **Important:** If you want to scale the node type for your instance down, and you haven't overwritten the default settings for the original node type, then Memorystore for Redis Cluster modifies the default settings to those of the scaled node type.\n\n| **Note:** For more information about the different types and sizes of shards and nodes, see [Cluster and node specification](/memorystore/docs/cluster/cluster-node-specification). To learn more about scaling a Memorystore for Redis Cluster instance, see [Scale instance capacity](/memorystore/docs/cluster/scale-instance-capacity).\n\nImpact of scaling\n-----------------\n\nDuring a scaling operation, the availability of your instance isn't impacted.\nHowever, when you change the number of shards in your instance, Memorystore for Redis Cluster rebalances the instance's keyspace. This\nmight cause increased latency during the scaling operation.\n\nAlso, the impact of scaling your instance vertically by changing the node type\nis similar to what happens with a [maintenance](/memorystore/docs/cluster/about-maintenance) operation.\n\nFailure scenarios\n-----------------\n\nIf you encounter an error during the scaling operation, then it's likely because\nof one of the following scenarios:\n\n- You want to update the shard count for your instance, but you don't have\n enough free memory for the `redis-shared-core-nano` node type for your instance.\n\n To resolve this issue, you can either [scale your instance up](/memorystore/docs/cluster/scale-instance-capacity#scale_the_node_type) or free memory from the nodes of\n your instance. To free memory, do the following:\n 1. [Connect to a Memorystore for Redis Cluster instance](/memorystore/docs/cluster/connect-cluster-instance).\n 2. To get details about the instance, including the IP address and port number, use the [`gcloud redis clusters describe`](/sdk/gcloud/reference/redis/clusters/describe) command.\n 3. Make a note of the IP address and port number of the instance.\n 4. To get information about the nodes of the instance, use the following\n command:\n\n ```\n redis-cli -h IP_ADDRESS -p PORT_NUMBER cluster nodes\n ```\n\n Replace \u003cvar translate=\"no\"\u003eIP_ADDRESS\u003c/var\u003e and \u003cvar translate=\"no\"\u003ePORT_NUMBER\u003c/var\u003e with the values that\n you noted in the previous step.\n 5. Make a note of the IP address and port number of a node that doesn't have\n enough free space. This node's ID matches an ID that appears in the error.\n\n 6. To connect to this node, use the following command:\n\n ```\n redis-cli -h IP_ADDRESS -p PORT_NUMBER\n ```\n\n Replace \u003cvar translate=\"no\"\u003eIP_ADDRESS\u003c/var\u003e and \u003cvar translate=\"no\"\u003ePORT_NUMBER\u003c/var\u003e with the values\n that you noted in the previous step.\n 7. At the prompt, enter the `info memory` command.\n\n In the output, values for the `used_memory` and `maxmemory` parameters appear. `used_memory` is how much memory the node uses and `maxmemory` is how much\n memory is available for the node.\n 8. Divide the value of the `used_memory` parameter by the value of the\n `maxmemory` parameter, and verify that the quotient is greater than 98%.\n\n 9. To free up space for the node, [delete some of the node's keys](https://redis.io/docs/latest/commands/del/).\n\n 10. Enter the `info memory` command again. In the output, the value of the\n `used_memory` parameter is smaller.\n\n 11. Divide the value of the `used_memory` parameter by the value of the\n `maxmemory` parameter, and verify that the quotient is now less than 98%.\n If it isn't, then delete more keys.\n\n 12. For any other nodes that don't have enough free space, repeat steps 4 - 11\n of this procedure.\n\n | **Caution** : We recommend that you use the `redis-shared-core-nano` node type for development or testing purposes only. If you run Memorystore for Redis Cluster in a production environment, then we recommend using the `redis-standard-small`, `redis-highmem-medium`, or `redis-highmem-xlarge` node types. For more information about these node types, see [Choose a node type](/memorystore/docs/cluster/cluster-node-specification#choose_a_node_type).\n- You scaled to a smaller shard count that doesn't have the capacity to hold\n all of the keys that Memorystore for Redis Cluster stores in the\n original instance. To resolve this, scale to a larger shard count that can\n hold all of the stored keys. For more information about increasing the number of\n shards for your instance, see [Scale the shard count](/memorystore/docs/cluster/scale-instance-capacity#scale_the_shard_count).\n\n- You scaled to a smaller node type that doesn't have the capacity to hold all\n of the data that Memorystore for Redis Cluster stores in the original\n node type. If this occurs, then Memorystore for Redis Cluster\n provides you with a recommended node type to scale down vertically.\n\n- You updated the node type for your instance and either you overwrite the default\n [settings](/memorystore/docs/cluster/supported-instance-configurations) for the\n original node type or these settings are overwritten already. However, the new,\n scaled node type either doesn't support the values for the default settings or\n the settings aren't valid for the node type. If this occurs, then Memorystore for Redis Cluster returns an error. To resolve this, modify\n the settings manually so that they're valid for the new node type.\n\n- You scaled your instance during a period of high write pressure (for example,\n during load testing). To resolve this, scale during periods of low instance\n traffic.\n\n- You have a slot which contains a large key, and you want to migrate this key\n to another node. However, this node doesn't have sufficient memory to support\n the key. As a result, you can't update your cluster. To resolve this, reduce the\n size of the key and retry the update operation.\n\n- The slot number that a node of a cluster owns isn't known, but only the slot\n range is known. Memorystore for Redis Cluster returns an error message. If this occurs,\n then reduce the size of the key and retry the update operation.\n\nBest practices\n--------------\n\nTo help you scale the capacity for your instance, and to increase the speed and\nreliability of scaling your instance, scale it during low periods of traffic,\nwhenever you can. To learn how to monitor instance traffic, see [Monitor clusters](/memorystore/docs/cluster/monitor-instances)."]]