A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/azure/azure-cache-for-redis/cache-how-to-scale below:

Scale an Azure Cache for Redis instance - Azure Cache for Redis

Azure Cache for Redis has different tier offerings that provide flexibility in the choice of cache size and features. Through scaling, you can change the size, tier, and number of nodes after creating a cache instance to match your application needs. This article shows you how to scale your cache using the Azure portal, plus tools such as Azure PowerShell and Azure CLI.

You can use the monitoring features of Azure Cache for Redis to monitor the health and performance of your cache. Use that information to determine when to scale the cache.

You can monitor the following metrics to determine if you need to scale.

You can scale up/down to a different pricing tier with the following restrictions:

Scale up and down using the Azure portal
  1. To scale your cache, browse to the cache in the Azure portal and select Scale from the Resource menu.

  2. Choose a pricing tier in the working pane and then choose Select.

  3. While the cache is scaling to the new tier, a Scaling Redis Cache notification is displayed.

  4. When scaling is complete, the status changes from Scaling to Running.

Note

When you scale a cache up or down using the portal, both maxmemory-reserved and maxfragmentationmemory-reserved settings automatically scale in proportion to the cache size. For example, if maxmemory-reserved is set to 3 GB on a 6-GB cache, and you scale to 12-GB cache, the settings automatically get updated to 6 GB during scaling. When you scale down, the reverse happens.

Scale up and down using PowerShell

You can scale your Azure Cache for Redis instances with PowerShell by using the Set-AzRedisCache cmdlet when the Sizeor Sku properties are modified. The following example shows how to scale a cache named myCache to a 6-GB cache in the same tier.

   Set-AzRedisCache -ResourceGroupName myGroup -Name myCache -Size 6GB

For more information on scaling with PowerShell, see To scale an Azure Cache for Redis using PowerShell.

Scale up and down using Azure CLI

To scale your Azure Cache for Redis instances using Azure CLI, call the az redis update command. Use the sku.capacity property to scale within a tier, for example from a Standard C0 to Standard C1 cache:

az redis update --cluster-name myCache --resource-group myGroup --set "sku.capacity"="2"

Use the 'sku.name' and 'sku.family' properties to scale up to a different tier, for instance from a Standard C1 cache to a Premium P1 cache:

az redis update --cluster-name myCache --resource-group myGroup --set "sku.name"="Premium" "sku.capacity"="1" "sku.family"="P"

For more information on scaling with Azure CLI, see Change settings of an existing Azure Cache for Redis.

Note

When you scale a cache up or down programatically (e.g., using PowerShell or Azure CLI), any maxmemory-reserved or maxfragmentationmemory-reserved are ignored as part of the update request. Only your scaling change is honored. You can update these memory settings after the scaling operation completes.

Create a new cache that is scaled out using clustering

Clustering is enabled during cache creation from the working pane, when you create a new Azure Cache for Redis.

  1. Use the Create an open-source Redis cache quickstart guide to start creating a new cache using the Azure portal.

  2. In the Advanced tab for a premium cache instance, configure the settings for non-TLS port, clustering, and data persistence. To enable clustering, select Enable.

    You can have up to 30 shards in the cluster. After selecting Enable, slide the slider or type a number between 1 and 30 for Shard count and select OK.

    Each shard is a primary/replica cache pair managed by Azure. The total size of the cache is calculated by multiplying the number of shards by the cache size selected in the pricing tier.

    Once the cache is created, you connect to it and use it just like a nonclustered cache. Redis distributes the data throughout the Cache shards. If diagnostics is enabled, metrics are captured separately for each shard and can be viewed in Azure Cache for Redis using the Resource menu.

  3. Finish creating the cache using the quickstart guide.

It takes a while for the cache to create. You can monitor progress on the Azure Cache for Redis Overview page. When Status shows as Running, the cache is ready to use.

For sample code on working with clustering with the StackExchange.Redis client, see the clustering.cs portion of the Hello World sample.

Scale a running Premium cache in or out

To change the cluster size on a premium cache that you created earlier, and is already running with clustering enabled, select Cluster size from the Resource menu.

To change the cluster size, use the slider or type a number between 1 and 30 in the Shard count text box. Then, select OK to save.

Increasing the cluster size increases max throughput and cache size. Increasing the cluster size doesn't increase the max. connections available to clients.

Scale out and in using PowerShell

You can scale out your Azure Cache for Redis instances with PowerShell by using the Set-AzRedisCache cmdlet when the ShardCount property is modified. The following example shows how to scale out a cache named myCache out to use three shards (that is, scale out by a factor of three)

   Set-AzRedisCache -ResourceGroupName myGroup -Name myCache -ShardCount 3

For more information on scaling with PowerShell, see To scale an Azure Cache for Redis using PowerShell.

Scale out and in using Azure CLI

To scale your Azure Cache for Redis instances using Azure CLI, call the az redis update command and use the shard-count property. The following example shows how to scale out a cache named myCache to use three shards (that is, scale out by a factor of three).

az redis update --cluster-name myCache --resource-group myGroup --set shard-count=3

For more information on scaling with Azure CLI, see Change settings of an existing Azure Cache for Redis.

Note

When you scale a cache up or down programmatically (e.g., using PowerShell or Azure CLI), any maxmemory-reserved or maxfragmentationmemory-reserved are ignored as part of the update request. Only your scaling change is honored. You can update these memory settings after the scaling operation completes.

Note

Scaling a cluster runs the MIGRATE command, which is an expensive command. For minimal impact, consider running this operation during off-peak hours. During the migration process, you see a spike in server load. Scaling a cluster is a long running process and the amount of time taken depends on the number of keys and size of the values associated with those keys. How to scale up and out - Enterprise and Enterprise Flash tiers

The Enterprise and Enterprise Flash tiers are able to scale up and scale out in one operation. Other tiers require separate operations for each action.

Caution

The Enterprise and Enterprise Flash tiers don't yet support scale down or scale in operations.

Scale using the Azure portal
  1. To scale your cache, browse to the cache in the Azure portal and select Scale from the Resource menu.

  2. To scale up, choose a different Cache type and then choose Save.

    Important

    You can only scale up at this time. You can't scale down.

  3. To scale out, increase the Capacity slider. Capacity increases in increments of two. This number reflects how many underlying Redis Enterprise nodes are being added. This number is always a multiple of two to reflect nodes being added for both primary and replica shards.

    Important

    You can only scale out, increasing capacity, at this time. You can't scale in.

  4. While the cache is scaling to the new tier, a Scaling Redis Cache notification is displayed.

  5. When scaling is complete, the status changes from Scaling to Running.

Scale using PowerShell

You can scale your Azure Cache for Redis instances with PowerShell by using the Update-AzRedisEnterpriseCache cmdlet. You can modify the Sku property to scale the instance up. You can modify the Capacity property to scale out the instance. The following example shows how to scale a cache named myCache to an Enterprise E20 (25 GB) instance with capacity of 4.

   Update-AzRedisEnterpriseCache -ResourceGroupName myGroup -Name myCache -Sku Enterprise_E20 -Capacity 4
Scale using Azure CLI

To scale your Azure Cache for Redis instances using Azure CLI, call the az redisenterprise update command. You can modify the sku property to scale the instance up. You can modify the capacity property to scale out the instance. The following example shows how to scale a cache named myCache to an Enterprise E20 (25 GB) instance with capacity of 4.

az redisenterprise update --cluster-name "myCache" --resource-group "myGroup" --sku "Enterprise_E20" --capacity 4
Scaling FAQ

The following list contains answers to commonly asked questions about Azure Cache for Redis scaling.

Can I scale to, from, or within a Premium cache? After scaling, do I have to change my cache name or access keys?

No, your cache name and keys don't change during a scaling operation.

How does scaling work? Do I lose data from my cache during scaling? Can I use all the features of Premium tier after scaling?

No, some features can only be set when you create a cache in Premium tier, and aren't available after scaling.

These features can't be added after you create the Premium cache:

To use any of these features, you must create a new cache instance in the Premium tier.

Is my custom databases setting affected during scaling?

If you configured a custom value for the databases setting during cache creation, keep in mind that some pricing tiers have different databases limits. Here are some considerations when scaling in this scenario:

While Standard, Premium, Enterprise, and Enterprise Flash caches have a SLA for availability, there's no SLA for data loss.

Is my cache available during scaling? Are there scaling limitations with geo-replication?

With passive geo-replication configured, you might notice that you can’t scale a cache or change the shards in a cluster. A geo-replication link between two caches prevents you from scaling operation or changing the number of shards in a cluster. You must unlink the cache to issue these commands. For more information, see Configure Geo-replication.

With active geo-replication configured, you can scale a cache with some limitations. All caches in a geo-replication group must be the same size and capacity. For more information, see Configure active geo-replication for Enterprise Azure Cache for Redis instances.

Operations that aren't supported

If a scaling operation fails, the service tries to revert the operation, and the cache reverts to the original size.

How long does scaling take?

Scaling time depends on a few factors. The following factors can affect how long scaling takes:

Scaling a cache isn't a trivial action and can take a long time. It can take one to two hours to scale a cache with one to two shards when it isn't under heavy loads. If you have more shards, the time to scale doesn't increase in a linear way.

How can I tell when scaling is complete?

In the Azure portal, you can see the scaling operation in progress. When scaling is complete, the status of the cache changes to Running.

Do I need to make any changes to my client application to use clustering?

Important

When using the Enterprise or Enterprise FLash tiers, you're given the choice of OSS Cluster Mode or Enterprise Cluster Mode. OSS Cluster Mode is the same as clustering on the Premium tier and follows the open source clustering specification. Enterprise Cluster Mode can be less performant, but uses Redis Enterprise clustering which doesn't require any client changes to use. For more information, see Clustering.

How are keys distributed in a cluster?

Per the Redis documentation on Keys distribution model: The key space is split into 16,384 slots. Each key is hashed and assigned to one of these slots, which are distributed across the nodes of the cluster. You can configure which part of the key is hashed to ensure that multiple keys are located in the same shard using hash tags.

For best performance and throughput, we recommend distributing the keys evenly. If you're using keys with a hash tag, it's the application's responsibility to ensure the keys are distributed evenly.

For more information, see Keys distribution model, Redis Cluster data sharding, and Keys hash tags.

For sample code about working with clustering and locating keys in the same shard with the StackExchange.Redis client, see the clustering.cs portion of the Hello World sample.

What is the largest cache size I can create?

The largest cache size you can have is 4.5 TB. This result is a clustered F1500 cache with capacity 9. For more information, see Azure Cache for Redis Pricing.

Do all Redis clients support clustering?

Many clients libraries support Redis clustering but not all. Check the documentation for the library you're using to verify you're using a library and version that support clustering. StackExchange.Redis is one library that does support clustering, in its newer versions. For more information on other clients, see the Playing with the cluster section of the Redis cluster tutorial.

The Redis clustering protocol requires each client to connect to each shard directly in clustering mode, and also defines new error responses such as MOVED na CROSSSLOTS. When you attempt to use a client library that doesn't support clustering with a cluster mode cache, the result can be many MOVED redirection exceptions or just break your application if you're making cross-slot multi-key requests.

Note

If you're using StackExchange.Redis as your client, verify that you're using the latest version of StackExchange.Redis 1.0.481 or later for clustering to work correctly. For more information on any issues with move exceptions, see move exceptions.

How do I connect to my cache when clustering is enabled?

You can connect to your cache using the same endpoints, ports, and keys that you use when connecting to a cache that doesn't have clustering enabled. Redis manages the clustering on the backend so you don't have to manage it from your client.

Can I directly connect to the individual shards of my cache?

The clustering protocol requires the client to make the correct shard connections, so the client should make share connections for you. With that said, each shard consists of a primary/replica cache pair, collectively known as a cache instance. You can connect to these cache instances using the Redis-CLI utility in the unstable branch of the Redis repository at GitHub. This version implements basic support when started with the -c switch. For more information, see Playing with the cluster on https://redis.io in the Redis cluster tutorial.

You need to use the -p switch to specify the correct port to connect to. Use the CLUSTER NODES command to determine the exact ports used for the primary and replica nodes. The following port ranges are used:

Can I configure clustering for a previously created cache?

Yes. First, ensure that your cache is in the Premium tier by scaling it up. Next, you can see the cluster configuration options, including an option to enable cluster. Change the cluster size after the cache is created, or after you enable clustering for the first time.

Important

You can't undo enabling clustering. And a cache with clustering enabled and only one shard behaves differently than a cache of the same size with no clustering.

All Enterprise and Enterprise Flash tier caches are always clustered.

Can I configure clustering for a basic or standard cache?

Clustering is only available for Premium, Enterprise, and Enterprise Flash caches.

Can I use clustering with the Redis ASP.NET Session State and Output Caching providers? I'm getting MOVE exceptions when using StackExchange.Redis and clustering, what should I do?

If you're using StackExchange.Redis and receive MOVE exceptions when using clustering, ensure that you're using StackExchange.Redis 1.1.603 or later.

What is the difference between OSS Clustering and Enterprise Clustering on Enterprise tier caches?

OSS Cluster Mode is the same as clustering on the Premium tier and follows the open source clustering specification. Enterprise Cluster Mode can be less performant, but uses Redis Enterprise clustering, which doesn't require any client changes to use. For more information, see Clustering.

How many shards do Enterprise tier caches use?

Unlike Basic, Standard, and Premium tier caches, Enterprise, and Enterprise Flash caches can take advantage of multiple shards on a single node. For more information, see Sharding configuration.

Next steps

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4