Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird beschrieben, wie sich Ihre Memorystore for Valkey-Instanz während der Skalierung verhält.
Sie können die Kapazität für Ihre Instanz auf folgende Weise skalieren:
Sie können die Anzahl der Shards für Ihre Instanz ändern. Das ist horizontale Skalierung. Sie können eine Instanz auf eine der folgenden Arten horizontal skalieren:
Hochskalieren: Erhöhen Sie die Kapazität Ihrer Instanz, um ihr mehr Arbeitsspeicher und Rechenleistung für die Verarbeitung größerer Datenmengen oder mehr Traffic zu geben. Die Kapazität Ihrer Instanz wird durch die Anzahl der Shards in Ihrer Instanz bestimmt.
Durch das horizontale Skalieren Ihrer Instanz kann Ihre Anwendung eine erhöhte Nachfrage ohne Leistungseinbußen bewältigen. Wenn Sie eine Instanz horizontal skalieren möchten, fügen Sie der Instanz Shards hinzu.
Herunterskalieren: Sie reduzieren die Kapazität Ihrer Instanz, wodurch sowohl die Rechenleistung als auch die Menge des verfügbaren Arbeitsspeichers zum Speichern von Daten verringert werden. Dies ist der Fall, wenn der Datenbedarf Ihrer Anwendung sinkt und Sie den Ressourcenverbrauch senken müssen, um Kosten zu sparen. Wenn Sie eine Instanz herunterskalieren möchten, müssen Sie die Anzahl der Shards in der Instanz verringern.
Sie können den Knotentyp für Ihre Instanz ändern. Das ist die vertikale Skalierung.
Sie können eine Instanz auf eine der folgenden Arten vertikal skalieren:
Vertikal skalieren: Erhöhen Sie die Kapazität Ihrer Instanz. Die Kapazität Ihrer Instanz wird durch den Knotentyp der Instanz bestimmt. Wenn Sie eine Instanz hochskalieren möchten, ändern Sie den Knotentyp in einen größeren Knotentyp. Sie können Ihre Instanz beispielsweise vom Knotentyp standard-small auf den Knotentyp highmem-medium hochskalieren.
Herunterskalieren: Die Kapazität Ihrer Instanz wird reduziert. Wenn Sie eine Instanz herunterskalieren möchten, ändern Sie den Knotentyp in einen kleineren Knotentyp. Sie können Ihre Instanz beispielsweise vom Knotentyp highmem-medium auf den Knotentyp standard-small herunterskalieren.
Auswirkungen der Skalierung
Während eines Skalierungsvorgangs wird die Verfügbarkeit Ihrer Instanz nicht beeinträchtigt.
Wenn Sie jedoch die Anzahl der Shards in Ihrer Instanz ändern, gleicht Memorystore for Valkey den Schlüsselbereich der Instanz neu aus. Dies kann während des Skalierungsvorgangs zu einer erhöhten Latenz führen.
Die Auswirkungen der vertikalen Skalierung Ihrer Instanz durch Ändern des Knotentyps sind ähnlich wie bei einem Wartungsvorgang.
Fehlerszenarien
Wenn beim Skalierungsvorgang ein Fehler auftritt, liegt das wahrscheinlich an einem der folgenden Szenarien:
Sie möchten die Anzahl der Shards für Ihre Instanz aktualisieren, haben aber nicht genügend freien Speicherplatz für den Knotentyp shared-core-nano für Ihre Instanz.
Um dieses Problem zu beheben, können Sie entweder Ihre Instanz hochskalieren oder Speicherplatz auf den Knoten Ihrer Instanz freigeben. So geben Sie Speicherplatz frei:
Ersetzen Sie IP_ADDRESS und PORT_NUMBER durch die Werte, die Sie im vorherigen Schritt notiert haben.
Notieren Sie sich die IP-Adresse und Portnummer eines Knotens, der nicht genügend freien Speicherplatz hat. Die ID dieses Knotens stimmt mit einer ID überein, die im Fehler angezeigt wird.
Verwenden Sie den folgenden Befehl, um eine Verbindung zu diesem Knoten herzustellen:
valkey-cli -h IP_ADDRESS -p PORT_NUMBER
Ersetzen Sie IP_ADDRESS und PORT_NUMBER durch die Werte, die Sie im vorherigen Schritt notiert haben.
Geben Sie bei der Eingabeaufforderung den Befehl info memory ein.
In der Ausgabe werden Werte für die Parameter used_memory und maxmemory angezeigt. used_memory gibt an, wie viel Arbeitsspeicher der Knoten verwendet, und maxmemory, wie viel Arbeitsspeicher für den Knoten verfügbar ist.
Dividieren Sie den Wert des Parameters used_memory durch den Wert des Parameters maxmemory und prüfen Sie, ob der Quotient größer als 98 % ist.
Geben Sie den Befehl info memory noch einmal ein. In der Ausgabe ist der Wert des Parameters used_memory kleiner.
Dividieren Sie den Wert des Parameters used_memory durch den Wert des Parameters maxmemory und prüfen Sie, ob der Quotient jetzt kleiner als 98 % ist.
Wenn nicht, löschen Sie weitere Schlüssel.
Wiederholen Sie die Schritte 4 bis 11 dieses Verfahrens für alle anderen Knoten, die nicht genügend freien Speicherplatz haben.
Sie haben die Anzahl der Shards auf einen kleineren Wert skaliert, der nicht die Kapazität hat, alle Schlüssel zu speichern, die in der ursprünglichen Instanz in Memorystore for Valkey gespeichert sind. Um dieses Problem zu beheben, müssen Sie die Anzahl der Shards erhöhen, damit alle gespeicherten Schlüssel darin Platz finden. Weitere Informationen zum Erhöhen der Anzahl der Shards für Ihre Instanz finden Sie unter Anzahl der Shards skalieren.
Sie haben auf einen kleineren Knotentyp skaliert, der nicht die Kapazität hat, alle Daten zu speichern, die in Memorystore for Valkey im ursprünglichen Knotentyp gespeichert sind. In diesem Fall empfiehlt Memorystore for Valkey einen Knotentyp für die vertikale Herunterskalierung.
Sie haben den Knotentyp für Ihre Instanz aktualisiert und entweder die Standardeinstellungen für den ursprünglichen Knotentyp überschrieben oder diese Einstellungen wurden bereits überschrieben. Der neue, skalierte Knotentyp unterstützt jedoch entweder die Werte für die Standardeinstellungen nicht oder die Einstellungen sind für den Knotentyp nicht gültig. In diesem Fall gibt Memorystore for Valkey einen Fehler zurück. Um das Problem zu beheben, müssen Sie die Einstellungen manuell so ändern, dass sie für den neuen Knotentyp gültig sind.
Sie haben Ihre Instanz während eines Zeitraums mit hoher Schreiblast skaliert, z. B. während eines Lasttests. Um dieses Problem zu beheben, sollten Sie die Skalierung in Zeiten mit geringem Instanz-Traffic durchführen.
Best Practices
Um die Kapazität Ihrer Instanz zu skalieren und die Geschwindigkeit und Zuverlässigkeit der Skalierung zu erhöhen, sollten Sie die Instanz nach Möglichkeit in Zeiten mit geringem Traffic skalieren. Informationen zum Überwachen von Instanz-Traffic finden Sie unter Instanzen überwachen.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-25 (UTC)."],[],[],null,["# About scaling instance capacity\n\nThis page describes how your Memorystore for Valkey 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 | **Note:** If you specify **Cluster Mode Disabled** when you [create an instance](/memorystore/docs/valkey/create-instances#create_an_instance), then Memorystore for Valkey doesn't partition the instance, but hosts it on a single shard. Therefore, horizontal scaling doesn't apply for the instance.\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 `standard-small` node type to a `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 `highmem-medium` node type to a `standard-small` node\n type.\n\n | **Important:** If you want to scale the node type\n | for your instance down, and you haven't overwritten the default settings for\n | the original node type, then Memorystore for Valkey modifies\n | 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 [Instance and node specification](/memorystore/docs/valkey/instance-node-specification). To learn more about scaling a Memorystore for Valkey instance, see [Scale instance capacity](/memorystore/docs/valkey/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 Valkey 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/valkey/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 `shared-core-nano` node type for your instance.\n\n To resolve this issue, you can either [scale your instance up](/memorystore/docs/valkey/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 Valkey instance](/memorystore/docs/valkey/connect-instance).\n 2. To get details about the instance, including the IP address and port number, use the [`gcloud memorystore instances describe`](/sdk/gcloud/reference/memorystore/instances/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 valkey-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 valkey-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://valkey.io/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 `shared-core-nano` node type for development or testing purposes only. If you run Memorystore for Valkey in a production environment, then we recommend using the `standard-small`, `highmem-medium`, or `highmem-xlarge` node types. For more information about these node types, see [Choose a node type](/memorystore/docs/valkey/instance-node-specification#choose-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 Valkey 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/valkey/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 Valkey stores in the original\n node type. If this occurs, then Memorystore for Valkey\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\n default [settings](/memorystore/docs/valkey/supported-instance-configurations)\n for the original node type or these settings are overwritten already. However,\n the new, scaled node type either doesn't support the values for the\n default settings or the settings aren't valid for the node type. If this occurs,\n then Memorystore for Valkey 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 instance. To resolve this, reduce\n the size of the key and retry the update operation.\n\n- The slot number that a node of an instance owns isn't known, but only the slot\n range is known. Memorystore for Valkey 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 instances](/memorystore/docs/valkey/monitor-instances)."]]