Azure Redis Timeouts - Client Side Issues

Published 01-04-2021 07:57 AM 2,881 Views
Microsoft

 

Overview

There are many reasons that may cause timeouts on Redis client side, due to client, network or server side causes, and the error message also may differ based on Client library used. 

 

Timeouts in Azure Cache for Redis occurs on client side when client application cannot receive the response from Redis server side timely.
Anytime, when client application doesn’t receive response before one of the timeout values expire, a timeout will occur and will be logged on client application logs as Redis timeout error message.

 

As Redis service acts as a Memory cache for client applications, the performance on Redis calls should be high, with low response times. For that reason, timeout values used in the client application are usually low.
This means any stress or overload on client side will affect firstly Redis service, other than other applications, causing higher latency on Redis requests, and for that reason some Redis timeouts may occur. 

 

Order by most common issues, below are the most common Client side causes: 

1- Traffic Burst

2- Large Key Value Sizes

3- High Client CPU Load

4- Client Network Bandwidth Exceeded

5- Client Timeout Configurations

6- Idle Connections

7- High Client Memory Usage

 

For Network or Server side Redis timeout causes, please see these Tech Community articles:

Azure Redis Timeouts - Server Side Issues
Azure Redis Timeouts - Network Issues

 

 

1- Traffic Burst

Bursts of traffic combined with poor thread settings at client side can result in delays in processing data already sent by Redis Server but not yet consumed on the client side - this can cause Redis timeouts on client side.
Different client libraries can deal with this in different ways.

   

Traffic burst and ThreadPool settings on Stackexchange.Redis:

To deal with traffic burst and manage threadpool, Stackexchange.Redis client library have two types of threads:

Worker threads: used for processing commands on Task.Run(…) or ThreadPool.QueueUserWorkItem(…) methods.
IOCP (I/O Completion Port) threads: used when asynchronous IO happens (e.g. reading from the network).

 

Each type defines minimum number of threads and by default, the minimum is set to the number of cores in a client machine.
ThreadPool provides new threads on demand until it reaches a minimum.
When the number of IOCP or Worker used threads (Busy) reach the minimum (Min), the new threads will be throttled.
When throttle occurs, the rate at which it injects new threads is one thread per 500 milliseconds.
When client application gets burst of traffic that needs more threads than the minimum, then some threads will be throttled, and some timeouts may occur on Redis client.

Stackexchange.Redis exceptions contain useful information about a number of minimum and busy threads, for example:

Timeout performing EVAL, inst: 187, mgr: Inactive, err: never, queue: 74, qu: 1, qs: 73, qc: 0, wr: 0, wq: 0, in: 1536, ar: 0, IOCP: (Busy=1,Free=999,Min=2,Max=1000), WORKER: (Busy=40,Free=32687,Min=2,Max=32767), clientName: RD123456789ABC

 

In the above example, the number of busy Worker threads is 40 and the minimum is set to 2.
So, 38 threads * 500 ms = 19s; the 40th thread waited at least 19s to be created.
This exception has been thrown because Redis operation waited too long for a free thread.

 

Each application may need to adjust the “Min” value based on the usage and on the load.

 

 

How to monitor Traffic burst, from Client side:

- At network level, traffic bursts may be monitored by any network traffic analyzer to identify unexpected spikes on network usage;
- Stackexchange.Redis client library logs may be used to investigate higher “Busy” values than “Min”, on IOCP or Worker thread pools, as described above;
- ThreadPoolLogger application may be used to monitor and adjust “Min” values based on the “Busy” on bursts on traffic. 

https://github.com/JonCole/SampleCode/blob/master/ThreadPoolMonitor/ThreadPoolLogger.cs

 

 

How to adjust "Min" ThreadPool settings on Stackexchange.Redis:

There are two different ways to configure thread pool settings on Stackexchange.Redis:

 

1. Using SetMinThreads() on Redis StackExchange (C#) configuration (client side):

Thread pool settings on Stackexchange.Redis can be configured using SetMinThreads() on Redis StackExchange (C#) configuration, on client side application:

 

private readonly int minWorkerThreads = 200;
private readonly int minIOThreads = 200;
void Application_Start(object sender, EventArgs e)
{
    // Code that runs on application startup
   (…)
   ThreadPool.SetMinThreads(minWorkerThreads, minIOThreads);
}

 

Note: The value specified in when calling SetMinThreads IS NOT a per-core setting. For example, if you have a 4-core machine and want to set minWorkerThreads and minIoThreads to 200 per CPU during run-time, you should use ThreadPool.SetMinThreads(200, 200).

 

2. Using <processModel> on Microsoft Internet Information Services (IIS) web server:

It is also possible to specify the minimum threads setting by using the minIoThreads or minWorkerThreads configuration setting under the <processModel> configuration element in Machine.config, usually located at %SystemRoot%\Microsoft.NET\Framework\[versionNumber]\CONFIG\.

 

<processModel>  on Machine.config

 

 

Setting the number of minimum threads in this way is generally not recommended, because it is a System-wide setting.

 

Note: The value specified in this configuration element is a per-core setting. For example, if you have a 4-core machine and want your minIoThreads setting to be 200 at runtime, you would use <processModel minIoThreads="50"/>.

 

 
2- Large Key Value Sizes

Redis cache is optimized to short key sizes (typical 1KB) and using larger key value sizes may cause Redis timeouts.

 

A large value size may be ok if making only few request at same time, but high number of requests with large key value sizes in a short time period can cause timeouts on Redis.

Because Redis is single-threaded system by design, processing any large key value will block all other requests that come after; if the first large key value takes more time than the expected, next requests will timeout.

 

In the following example, request 'A' and 'B' are sent quickly to the server. The server starts sending responses 'A' and 'B' quickly. Because of data transfer times, response 'B' must wait behind response 'A' times out even though the server responded quickly.

 
 

LuisFilipe_1-1609343212137.png

This is described in this documentation: Large request or response Size

 

Microsoft recommendation is to Optimize client application to use a large number of small values, rather than a few requests with large values.

In summary, large value sizes should be avoid and should be split in short key value sizes, making more requests.

 

How to verify Large Key Value Sizes used, from client side:

redis-cli.exe is a popular command-line tool for interacting with an Azure Cache for Redis as a client, and can be used to investigate large key value sizes used.

This tool is part of Redis-io distribution and also available for use with Azure Cache for Redis.

 

The only caveat of redis-cli.exe command-line tool is doesn't support TLS and Azure Cache for Redis only enable the TLS port (6380) by default. 
To use this tool, an SSL/TLS access can be used using SSL tunnel, or temporarily enabling the non-TLS port (6379) (this is not recommended for security reasons, as the access keys are sent via TCP in clear text).
To use an SSL tunnel, Stunnel tool can be used and this Tech Community documentation may help on that: Enable access for redis-cli.exe

 

Download and extract redis-cli.exe command-line tool from Windows zip file for the latest Redis.io distribution, available here Redis-x64-3.0.504.zip

LuisFilipe_0-1609345015837.png

 
 

Then you can run redis-cli with this syntax (-p 6379 for non-SSL connections, or -p 6380 for SSL connections):

 

redis-cli -h <RedisName>.redis.cache.windows.net -p 6379 -a <RedisAccessPassword> --bigkeys

 

 

In this special mode, redis-cli works as a key space analyzer. It scans the dataset for big keys, but also provides information about the data types that the data set consists of.

This mode is enabled with the --bigkeys option, and produces quite a verbose output:

 

# Scanning the entire keyspace to find biggest keys as well as
# average sizes per key type.  You can use -i 0.1 to sleep 0.1 sec
# per 100 SCAN commands (not usually needed).

[00.00%] Biggest string found so far 'key-419' with 3 bytes
[05.14%] Biggest list   found so far 'mylist' with 100004 items
[35.77%] Biggest string found so far 'counter:__rand_int__' with 6 bytes
[73.91%] Biggest hash   found so far 'myobject' with 3 fields

-------- summary -------

Sampled 506 keys in the keyspace!
Total key length in bytes is 3452 (avg len 6.82)

Biggest string found 'counter:__rand_int__' has 6 bytes
Biggest   list found 'mylist' has 100004 items
Biggest   hash found 'myobject' has 3 fields

504 strings with 1403 bytes (99.60% of keys, avg size 2.78)
1 lists with 100004 items (00.20% of keys, avg size 100004.00)
0 sets with 0 members (00.00% of keys, avg size 0.00)
1 hashs with 3 fields (00.20% of keys, avg size 3.00)
0 zsets with 0 members (00.00% of keys, avg size 0.00)

 

 

More info about redic-cli and --bigkeys option can be consulted here: redis-cli, the Redis command line interface

 

 

How to avoid using Large Key Value Sizes:

To avoid using Large Key Value Sizes, Microsoft recommendation is to optimize client application for a large number of small values, rather than a few large values.

Large value sizes should be avoided and should be split in short key value sizes, making more requests.

 

 

3- High Client CPU Load

High CPU usage on the client side can cause that the system cannot keep up with the work that it has been asked to perform. 

This could be a problem because if the CPU is busy, can't keep up with the work the application is asking it to do.
The response from Redis can come very quickly, but because the CPU isn't keeping up with the workload, the response sits in the client socket's kernel buffer waiting to be processed.

Microsoft recommendation is not having Client CPU above 80%.

   

How to verify High Client CPU Load:

- Monitor the client's system-wide CPU usage using metrics available in the Azure portal, in client environment blade (AppService, VM, AKS, etc);

- Monitor performance counters on client machine.

   

How to limit Client CPU usage:

- Investigate what is causing High CPU or CPU spikes on client side and modify the code logic.
Keep in mind that client CPU are usually not only used by Redis client application, but by other applications in the same AppService plan (in case of WebApps), or by other applications and operating system tasks, on VM's, VMSS's, AKS, etc.

- Upgrade your client to a larger VM size with more CPU capacity.

   

   

4- Client Network Bandwidth Exceeded

Client Network Bandwidth exceeded and some other network causes for Redis timeouts are explained on this Tech Community article: Azure Redis Timeouts - Network Issues

 

 

5- Client Timeout Configurations

Each Redis client library has its own configuration options and the ability to configure different timeout values. Each option and the respective default value can be different based on the client library used.
As example, StackExchange.Redis uses the below related configuration options that can throws a timeout.

Configuration string

Default value

Description

SyncTimeout

5 seconds

the amount of time to wait on a specific synchronous operation to complete

ResponseTimeout

SyncTimeout

deprecated - the amount of time before the connection be treated as dead - used for backwards compatibility

ConnectTimeout

5 seconds

the  amount of time used to the connection attempt (15 seconds recommended)

ConnectRetry

3

the number of times to repeat connect attempts during initial Connect

keepAlive

60 seconds

time at which to send a message to help keep sockets alive - see Idle Connections below

 

 

How to verify Redis Client Configurations:

To verify Redis Client Configurations you need to look for the connection string or the configuration object in the client application code, and check if the values used are the best for you case scenario and your workload.
Microsoft recommendation is to use only one connection and reuse connections.
Keep in mind that if not following Microsoft recommendations, client application may have different connection strings with different configuration values, in different parts of code. 

 

How to Configure Redis Client Timeout values:

StackExchange.Redis client library:
The connection to Azure Redis could be made through a connection string. Because there are lot of different ways to configure Redis, StackExchange.Redis offers a rich configuration model, which is invoked when calling Connect.

 

Specific to ConnectTimeout value on Stackexchange.Redis (the  amount of time used to the connection attempt), Microsoft recommends 15000ms, giving the system time to connect even under higher load conditions, but the default value is 5000ms. You may want to adjust this value.

 

The configuration can be either:

  • a ConfigurationOptions instance:

 

string configString = "redis236.redis.cache.windows.net, abortConnect=false, ssl=true, password=XXX";
var options = ConfigurationOptions.Parse(configString);
options.AllowAdmin = true;
options.abortConnect=false;
options.connectTimeout=15000;

 

 

  • a string representing the configuration:

 

string configString = "redis236.redis.cache.windows.net, abortConnect=false, ssl=true, password=XXX, connectTimeout=15000";

 

 

 

the switch between both configuration methods can be done trivially:

ConfigurationOptions options = ConfigurationOptions.Parse(configString);

or:

string configString = options.ToString();

 

Then use the configString or the ConfigurationOptions instance to create the connection with the new configuration values:

 

ConnectionMultiplexer redis = ConnectionMultiplexer.Connect(configString);
ConnectionMultiplexer redis = ConnectionMultiplexer.Connect(options);

 

 

Some other client library specific guidance:

   

 

6- Idle Connections

 

Azure Cache for Redis service configures a 10 minute idle server timeout for connections, independently of the client library used. This is defined on Server side and cannot be changed. 
In that case, if the connection is idle for 10 minutes then it will reset the connection and clients may see socket reset errors, timeouts or some other connection error messages, depending of client libraries used.

 

Some clients like StackExchange.Redis will do regular PING calls to Redis to keep the connection alive (see keepAlive configuration above).
Some clients don't do this, so application developers should implement this periodic ping call to avoid close idle connections.
This is discussed in Azure Redis Best Practices documentation

How to verify Idle Connections:

If you have idle connections without any Redis request during 10 minutes and you see socket reset error, timeout or some other connection error message, the most probably cause is not having any keep alive policy implemented.
You may also check for the specific client library used, if have any keepalive configuration option, as described for Stackexchange.Redis.

 

How to mitigate Idle Connections:

Adjust keepalive configuration option to 60 seconds (by default on Stackexchange.Redis), or the correspondent configuration value for different client libraries.
On some cases for some client libraries, you may need to implement your own keepalive process doing a periodic ping to Redis endpoint, to maintain the connation active.

 

 

7- High Client Memory Usage

Memory pressure on the client machine may be the cause of many kinds of performance problems that can delay processing of responses from the cache.
When this occur, the system may page data to disk, and page faulting causes the system to slow down significantly.

This may have higher impact on Redis calls, as is expected that Redis calls have high performance, with low response times. For that reason any memory pressure on client side will cause Redis timeouts prior than other services running on client environment.

 

How to verify High Client Memory Usage:

High Client Memory Usage can be verified at specific timestamp of Redis timeouts, monitoring memory usage on client machine to make sure that it doesn't exceed available memory.

Could be useful also, Monitor the client's Page Faults/Sec performance counter, as page faults can be caused by memory pressure.

 

How to limit Client Memory Usage:

Client Memory Usage can be reduced, reducing the number of running applications/processes at same time, or investigating the processes using higher amount of memory. If some process is using high amount of memory than the expected, this process/application should be troubleshooted to find the reason for that memory usage.

If all is expected, scaling the client environment to have more memory resources available should be implemented.

 

 

Conclusion:

Despite having different reasons to have Redis timeouts on connections to Azure Cache for Redis, some different causes on Client, Server or Network side can cause Redis timeouts, and some more details can be obtained in the documentation below.

 

For Network or Server side Redis timeout causes, please see these Tech Community articles:

Azure Redis Timeouts - Server Side Issues
Azure Redis Timeouts - Network Issues

 

   

Related documentation:

Timeout issues 

 

1- Traffic Burst

StackExchange.Redis timeout exceptions (GitHub article)  

ThreadPool Growth: Some Important Details (Jon Cole article)

Client-side issues        

BusyIO or BusyWorker threads in the timeout exception (GitHub discussion)    

ThreadPoolLogger code sample (from Jon Cole)

Traffic-burst

Recommendation ThreadPool settings

processModel Element

 

2- Large Key Value Sizes

Use the Redis command-line tool with Azure Cache for Redis

redis-cli, the Redis command line interface

Enable access for redis-cli.exe

Redis-x64-3.0.504.zip

 

3- High Client CPU Load

High Client CPU usage

 

5- Client Timeout Configurations

Redis Client handling - TCP keepalive

Azure Redis Best Practices documentation 
StackExchange.Redis configurations

 

6- Idle Connections

Azure Redis Best Practices documentation

 

 

I hope this can be useful !!!

 

 

 

%3CLINGO-SUB%20id%3D%22lingo-sub-2022203%22%20slang%3D%22en-US%22%3EAzure%20Redis%20Timeouts%20-%20Client%20Side%20Issues%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2022203%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EOverview%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThere%20are%20many%20reasons%20that%20may%20cause%20timeouts%20on%20Redis%20client%20side%2C%20due%20to%20client%2C%20network%20or%20server%20side%20causes%2C%20and%20the%20error%20message%20also%20may%20differ%20based%20on%20Client%20library%20used.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETimeouts%20in%20Azure%20Cache%20for%20Redis%20occurs%20on%20client%20side%20when%20client%20application%20cannot%20receive%20the%20response%20from%20Redis%20server%20side%20timely.%3CBR%20%2F%3EAnytime%2C%20when%20client%20application%20doesn%E2%80%99t%20receive%20response%20before%20one%20of%20the%20timeout%20values%20expire%2C%20a%20timeout%20will%20occur%20and%20will%20be%20logged%20on%20client%20application%20logs%20as%20Redis%20timeout%20error%20message.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAs%20Redis%20service%20acts%20as%20a%20Memory%20cache%20for%20client%20applications%2C%20the%20performance%20on%20Redis%20calls%20should%20be%20high%2C%20with%20low%20response%20times.%20For%20that%20reason%2C%20timeout%20values%20used%20in%20the%20client%20application%20are%20usually%20low.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EThis%20means%20any%20stress%20or%20overload%20on%20client%20side%20will%20affect%20firstly%20Redis%20service%2C%20other%20than%20other%20applications%2C%20causing%20higher%20latency%20on%20Redis%20requests%2C%20and%20for%20that%20reason%20some%20Redis%20timeouts%20may%20occur.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOrder%20by%20most%20common%20issues%2C%20below%20are%20the%20most%20common%20Client%20side%20causes%3A%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E1-%20Traffic%26nbsp%3BBurst%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E2-%20Large%20Key%20Value%20Sizes%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E3-%20High%20Client%20CPU%20Load%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E4-%20Client%20Network%20Bandwidth%26nbsp%3BExceeded%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E5-%20Client%20Timeout%20Configurations%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E6-%20Idle%20Connections%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E7-%20High%20Client%20Memory%20Usage%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20Network%20or%20Server%20side%20Redis%20timeout%20causes%2C%20please%20see%20these%26nbsp%3B%3CFONT%20size%3D%223%22%3E%3CSPAN%3ETech%20Community%20articles%3A%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-paas-blog%2Fazure-redis-timeouts-server-side-issues%2Fba-p%2F2022202%22%20target%3D%22_blank%22%3EAzure%20Redis%20Timeouts%20-%20Server%20Side%20Issues%3C%2FA%3E%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-paas-blog%2Fazure-redis-timeouts-network-issues%2Fba-p%2F2022222%22%20target%3D%22_blank%22%3EAzure%20Redis%20Timeouts%20-%20Network%20Issues%3C%2FA%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20style%3D%22background-color%3A%20%230072c6%3B%20width%3A%20100%25%3B%22%20border%3D%221%22%20width%3D%22100%25%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22100%25%22%3E%3CFONT%20size%3D%224%22%20color%3D%22%23FFFFFF%22%3E%3CSTRONG%3E1-%20Traffic%26nbsp%3BBurst%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3EBursts%20of%20traffic%20combined%20with%20poor%26nbsp%3Bthread%20settings%20at%20client%20side%20can%20result%20in%20delays%20in%20processing%20data%20already%20sent%20by%20Redis%20Server%20but%20not%20yet%20consumed%20on%20the%20client%20side%20-%20this%20can%20cause%20Redis%20timeouts%20on%20client%20side.%3CBR%20%2F%3EDifferent%20client%20libraries%20can%20deal%20with%20this%20in%20different%20ways.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3ETraffic%20burst%20and%20ThreadPool%20settings%20on%20Stackexchange.Redis%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3ETo%20deal%20with%20traffic%20burst%20and%20manage%20threadpool%2C%26nbsp%3BStackexchange.Redis%20client%20library%20have%20two%20types%20of%20threads%3A%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%E2%80%A2%20%3CSTRONG%3EWorker%3C%2FSTRONG%3E%20threads%3A%20used%20for%20processing%20commands%20on%20Task.Run(%E2%80%A6)%20or%20ThreadPool.QueueUserWorkItem(%E2%80%A6)%20methods.%20%3CBR%20%2F%3E%E2%80%A2%20%3CSTRONG%3EIOCP%3C%2FSTRONG%3E%20(I%2FO%20Completion%20Port)%20threads%3A%20used%20when%20asynchronous%20IO%20happens%20(e.g.%20reading%20from%20the%20network).%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEach%20type%20defines%20minimum%20number%20of%20threads%20and%20by%20default%2C%20the%20minimum%20is%20set%20to%20the%20number%20of%20cores%20in%20a%20client%20machine.%20%3CBR%20%2F%3EThreadPool%20provides%20new%20threads%20on%20demand%20until%20it%20reaches%20a%20minimum.%20%3CBR%20%2F%3EWhen%20the%20number%20of%20IOCP%20or%20Worker%20used%20threads%20(Busy)%20reach%20the%20minimum%20(Min)%2C%20the%20new%20threads%20will%20be%20throttled.%3CBR%20%2F%3EWhen%20throttle%20occurs%2C%20the%20rate%20at%20which%20it%20injects%20new%20threads%20is%20one%20thread%20per%20500%20milliseconds.%20%3CBR%20%2F%3EWhen%20client%20application%20gets%20burst%20of%20traffic%20that%20needs%20more%20threads%20than%20the%20minimum%2C%20then%20some%20threads%20will%20be%20throttled%2C%20and%20some%20timeouts%20may%20occur%20on%20Redis%20client.%3C%2FP%3E%0A%3CP%3EStackexchange.Redis%20exceptions%20contain%20useful%20information%20about%20a%20number%20of%20minimum%20and%20busy%20threads%2C%20for%20example%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CTABLE%20border%3D%221%22%20width%3D%22100%25%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22100%25%22%3E%3CP%3E%3CFONT%20size%3D%222%22%3ETimeout%20performing%20EVAL%2C%20inst%3A%20187%2C%20mgr%3A%20Inactive%2C%20err%3A%20never%2C%20queue%3A%2074%2C%20qu%3A%201%2C%20qs%3A%2073%2C%20qc%3A%200%2C%20wr%3A%200%2C%20wq%3A%200%2C%20in%3A%201536%2C%20ar%3A%200%2C%20IOCP%3A%20(Busy%3D1%2CFree%3D999%2CMin%3D2%2CMax%3D1000)%2C%20%3CSTRONG%3EWORKER%3C%2FSTRONG%3E%3A%20(%3CSTRONG%3E%3CFONT%20color%3D%22%23FF0000%22%3EBusy%3D40%3C%2FFONT%3E%3C%2FSTRONG%3E%2CFree%3D32687%2C%3CSTRONG%3E%3CFONT%20color%3D%22%23FF0000%22%3EMin%3D2%3C%2FFONT%3E%3C%2FSTRONG%3E%2CMax%3D32767)%2C%20clientName%3A%20RD123456789ABC%3C%2FFONT%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20above%20example%2C%20the%20number%20of%20busy%20Worker%20threads%20is%2040%20and%20the%20minimum%20is%20set%20to%202.%20%3CBR%20%2F%3ESo%2C%2038%20threads%20*%20500%20ms%20%3D%2019s%3B%20the%2040th%20thread%20waited%20at%20least%2019s%20to%20be%20created.%20%3CBR%20%2F%3EThis%20exception%20has%20been%20thrown%20because%20Redis%20operation%20waited%20too%20long%20for%20a%20free%20thread.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEach%20application%20may%20need%20to%20adjust%20the%20%E2%80%9CMin%E2%80%9D%20value%20based%20on%20the%20usage%20and%20on%20the%20load.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3EHow%20to%20monitor%20Traffic%20burst%2C%20from%20Client%20side%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3E-%20At%20network%20level%2C%20traffic%20bursts%20may%20be%20monitored%20by%20any%20network%20traffic%20analyzer%20to%20identify%20unexpected%20spikes%20on%20network%20usage%3B%3CBR%20%2F%3E-%20Stackexchange.Redis%20client%20library%20logs%20may%20be%20used%20to%20investigate%20higher%20%E2%80%9CBusy%E2%80%9D%20values%20than%20%E2%80%9CMin%E2%80%9D%2C%20on%20IOCP%20or%20Worker%20thread%20pools%2C%20as%20described%20above%3B%3CBR%20%2F%3E-%20ThreadPoolLogger%20application%20may%20be%20used%20to%20monitor%20and%20adjust%20%E2%80%9CMin%E2%80%9D%20values%20based%20on%20the%20%E2%80%9CBusy%E2%80%9D%20on%20bursts%20on%20traffic.%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FJonCole%2FSampleCode%2Fblob%2Fmaster%2FThreadPoolMonitor%2FThreadPoolLogger.cs%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FJonCole%2FSampleCode%2Fblob%2Fmaster%2FThreadPoolMonitor%2FThreadPoolLogger.cs%3C%2FA%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3EHow%20to%20adjust%20%22Min%22%20ThreadPool%20settings%20on%20Stackexchange.Redis%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3EThere%20are%20two%20different%20ways%20to%20configure%20thread%20pool%20settings%20on%26nbsp%3BStackexchange.Redis%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3E%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3E%3CSTRONG%3E1.%20Using%26nbsp%3BSetMinThreads()%20on%20Redis%20StackExchange%20(C%23)%20configuration%20(client%20side)%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3EThread%20pool%20settings%20on%26nbsp%3BStackexchange.Redis%20can%20be%20configured%20using%26nbsp%3BSetMinThreads()%20on%20Redis%20StackExchange%20(C%23)%20configuration%2C%20on%20client%20side%20application%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Eprivate%20readonly%20int%20minWorkerThreads%20%3D%20200%3B%0Aprivate%20readonly%20int%20minIOThreads%20%3D%20200%3B%0Avoid%20Application_Start(object%20sender%2C%20EventArgs%20e)%0A%7B%0A%20%20%20%20%2F%2F%20Code%20that%20runs%20on%20application%20startup%0A%20%20%20(%E2%80%A6)%0A%20%20%20ThreadPool.SetMinThreads(minWorkerThreads%2C%20minIOThreads)%3B%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSTRONG%3ENote%3A%3C%2FSTRONG%3E%20The%20value%20specified%20in%20when%20calling%20SetMinThreads%20%3CSTRONG%3EIS%20NOT%3C%2FSTRONG%3E%20a%26nbsp%3Bper-core%26nbsp%3Bsetting.%20For%20example%2C%20if%20you%20have%20a%204-core%20machine%20and%20want%20to%20set%26nbsp%3BminWorkerThreads%26nbsp%3Band%26nbsp%3BminIoThreads%26nbsp%3Bto%20200%20per%20CPU%20during%20run-time%2C%20you%20should%20use%26nbsp%3BThreadPool.SetMinThreads(200%2C%20200).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3E%3CSTRONG%3E2.%20Using%20%3CPROCESSMODEL%3E%20on%20Microsoft%20Internet%20Information%20Services%20(IIS)%20web%20server%3A%3C%2FPROCESSMODEL%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CFONT%20size%3D%223%22%3EIt%20is%20also%20possible%20to%20specify%20the%20minimum%20threads%20setting%20by%20using%20the%20minIoThreads%20or%26nbsp%3BminWorkerThreads%26nbsp%3Bconfiguration%20setting%26nbsp%3Bunder%20the%26nbsp%3B%3CPROCESSMODEL%3E%26nbsp%3Bconfiguration%20element%20in%26nbsp%3BMachine.config%2C%20usually%20located%20at%26nbsp%3B%25SystemRoot%25%5CMicrosoft.NET%5CFramework%5C%5BversionNumber%5D%5CCONFIG%5C.%3C%2FPROCESSMODEL%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3E%3CPROCESSMODEL%3E%20%20on%20Machine.config%3C%2FPROCESSMODEL%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3ESetting%20the%20number%20of%20minimum%20threads%20in%20this%20way%20is%20generally%20not%20recommended%2C%20because%20it%20is%20a%20System-wide%20setting.%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSTRONG%3ENote%3A%3C%2FSTRONG%3E%20The%20value%20specified%20in%20this%20configuration%20element%20is%20a%26nbsp%3Bper-core%26nbsp%3Bsetting.%20For%20example%2C%20if%20you%20have%20a%204-core%20machine%20and%20want%20your%26nbsp%3BminIoThreads%26nbsp%3Bsetting%20to%20be%20200%20at%20runtime%2C%20you%20would%20use%26nbsp%3B%3CPROCESSMODEL%20miniothreads%3D%22%26quot%3B50%26quot%3B%2F%22%3E.%3C%2FPROCESSMODEL%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorLuisFilipe_4%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CTABLE%20style%3D%22background-color%3A%20%230072c6%3B%20width%3A%20100%25%3B%22%20border%3D%221%22%20width%3D%22100%25%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22100%25%22%3E%3CFONT%20size%3D%224%22%20color%3D%22%23FFFFFF%22%3E%3CSTRONG%3E2-%20Large%20Key%20Value%20Sizes%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3ERedis%20cache%20is%20optimized%20to%20short%20key%20sizes%20(typical%201KB)%20and%20using%20larger%20key%20value%20sizes%20may%20cause%20Redis%20timeouts.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EA%20large%20value%20size%20may%20be%20ok%20if%20making%20only%20few%20request%20at%20same%20time%2C%20but%20high%20number%20of%20requests%20with%20large%20key%20value%20sizes%20in%20a%20short%20time%20period%20can%20cause%20timeouts%20on%20Redis.%3C%2FP%3E%0A%3CP%3EBecause%20Redis%20is%20single-threaded%20system%20by%20design%2C%20processing%20any%20large%20key%20value%20will%20block%20all%20other%20requests%20that%20come%20after%3B%20if%20the%20first%26nbsp%3Blarge%20key%20value%20takes%20more%20time%20than%20the%20expected%2C%20next%20requests%20will%20timeout.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20following%20example%2C%20request%20'A'%20and%20'B'%20are%20sent%20quickly%20to%20the%20server.%20The%20server%20starts%20sending%20responses%20'A'%20and%20'B'%20quickly.%20Because%20of%20data%20transfer%20times%2C%20response%20'B'%20must%20wait%20behind%20response%20'A'%20times%20out%20even%20though%20the%20server%20responded%20quickly.%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorLuisFilipe_5%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%20id%3D%22tinyMceEditorLuisFilipe_1%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22LuisFilipe_1-1609343212137.png%22%20style%3D%22width%3A%20488px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243495iCD0F9FC87F15C23B%2Fimage-dimensions%2F488x116%3Fv%3D1.0%22%20width%3D%22488%22%20height%3D%22116%22%20role%3D%22button%22%20title%3D%22LuisFilipe_1-1609343212137.png%22%20alt%3D%22LuisFilipe_1-1609343212137.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThis%20is%20described%20in%20this%20documentation%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-cache-for-redis%2Fcache-troubleshoot-client%23large-request-or-response-size%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ELarge%20request%20or%20response%20Size%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMicrosoft%20recommendation%20is%20to%20Optimize%20client%20application%20to%20use%20a%20large%20number%20of%20small%20values%2C%20rather%20than%20a%20few%20requests%20with%20large%20values.%3C%2FP%3E%0A%3CP%3EIn%20summary%2C%20large%20value%20sizes%20should%20be%20avoid%20and%20should%20be%20split%20in%20short%20key%20value%20sizes%2C%20making%20more%20requests.%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3EHow%20to%20verify%20Large%20Key%20Value%20Sizes%20used%2C%20from%20client%20side%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3Eredis-cli.exe%20is%20a%20popular%20command-line%20tool%20for%20interacting%20with%20an%20Azure%20Cache%20for%20Redis%20as%20a%20client%2C%20and%20can%20be%20used%20to%20investigate%20large%20key%20value%20sizes%20used.%3C%2FP%3E%0A%3CP%3EThis%20tool%20is%20part%20of%20Redis-io%20distribution%20and%20also%20available%20for%20use%20with%20Azure%20Cache%20for%20Redis.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20only%20caveat%20of%20redis-cli.exe%26nbsp%3Bcommand-line%20tool%20is%20doesn't%20support%20TLS%20and%26nbsp%3BAzure%20Cache%20for%20Redis%20only%20enable%20the%20TLS%20port%20(6380)%20by%20default.%26nbsp%3B%3CBR%20%2F%3ETo%20use%20this%20tool%2C%20an%26nbsp%3B%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3ESSL%2FTLS%20access%20can%20be%20used%20using%20SSL%20tunnel%2C%20or%20temporarily%20e%3C%2FSPAN%3Enabling%20the%20non-TLS%20port%20(6379)%20(this%20is%20not%20recommended%20for%20security%20reasons%2C%20as%20the%20access%20keys%20are%20sent%20via%20TCP%20in%20clear%20text).%3CBR%20%2F%3ETo%20use%20an%20SSL%20tunnel%2C%26nbsp%3BStunnel%20tool%20can%20be%20used%20and%20this%20Tech%20Community%20documentation%20may%20help%20on%20that%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-cache-for-redis%2Fcache-how-to-redis-cli-tool%23enable-access-for-redis-cliexe%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EEnable%20access%20for%20redis-cli.exe%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDownload%20and%20extract%20redis-cli.exe%20command-line%20tool%20from%20Windows%20zip%20file%20for%20the%20latest%20Redis.io%20distribution%2C%20available%20here%26nbsp%3B%3CA%20class%3D%22d-flex%20flex-items-center%20min-width-0%22%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoftarchive%2Fredis%2Freleases%2Fdownload%2Fwin-3.0.504%2FRedis-x64-3.0.504.zip%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20class%3D%22pl-2%20flex-auto%20min-width-0%20text-bold%22%3ERedis-x64-3.0.504.zip%3C%2FSPAN%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22LuisFilipe_0-1609345015837.png%22%20style%3D%22width%3A%20529px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243500iD1FE27BDAC1F70C0%2Fimage-dimensions%2F529x296%3Fv%3D1.0%22%20width%3D%22529%22%20height%3D%22296%22%20role%3D%22button%22%20title%3D%22LuisFilipe_0-1609345015837.png%22%20alt%3D%22LuisFilipe_0-1609345015837.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorLuisFilipe_0%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%20id%3D%22tinyMceEditorLuisFilipe_1%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3EThen%20you%20can%20run%20redis-cli%20with%20this%20syntax%20(-p%206379%20for%20non-SSL%20connections%2C%20or%20-p%206380%20for%20SSL%20connections)%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Eredis-cli%20-h%20%3CREDISNAME%3E.redis.cache.windows.net%20-p%206379%20-a%20%3CREDISACCESSPASSWORD%3E%20--bigkeys%3C%2FREDISACCESSPASSWORD%3E%3C%2FREDISNAME%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20special%20mode%2C%20redis-cli%20works%20as%20a%20key%20space%20analyzer.%20It%20scans%20the%20dataset%20for%20big%20keys%2C%20but%20also%20provides%20information%20about%20the%20data%20types%20that%20the%20data%20set%20consists%20of.%3C%2FP%3E%0A%3CP%3EThis%20mode%20is%20enabled%20with%20the%20--bigkeys%20option%2C%20and%20produces%20quite%20a%20verbose%20output%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3E%23%20Scanning%20the%20entire%20keyspace%20to%20find%20biggest%20keys%20as%20well%20as%0A%23%20average%20sizes%20per%20key%20type.%20%20You%20can%20use%20-i%200.1%20to%20sleep%200.1%20sec%0A%23%20per%20100%20SCAN%20commands%20(not%20usually%20needed).%0A%0A%5B00.00%25%5D%20Biggest%20string%20found%20so%20far%20'key-419'%20with%203%20bytes%0A%5B05.14%25%5D%20Biggest%20list%20%20%20found%20so%20far%20'mylist'%20with%20100004%20items%0A%5B35.77%25%5D%20Biggest%20string%20found%20so%20far%20'counter%3A__rand_int__'%20with%206%20bytes%0A%5B73.91%25%5D%20Biggest%20hash%20%20%20found%20so%20far%20'myobject'%20with%203%20fields%0A%0A--------%20summary%20-------%0A%0ASampled%20506%20keys%20in%20the%20keyspace!%0ATotal%20key%20length%20in%20bytes%20is%203452%20(avg%20len%206.82)%0A%0ABiggest%20string%20found%20'counter%3A__rand_int__'%20has%206%20bytes%0ABiggest%20%20%20list%20found%20'mylist'%20has%20100004%20items%0ABiggest%20%20%20hash%20found%20'myobject'%20has%203%20fields%0A%0A504%20strings%20with%201403%20bytes%20(99.60%25%20of%20keys%2C%20avg%20size%202.78)%0A1%20lists%20with%20100004%20items%20(00.20%25%20of%20keys%2C%20avg%20size%20100004.00)%0A0%20sets%20with%200%20members%20(00.00%25%20of%20keys%2C%20avg%20size%200.00)%0A1%20hashs%20with%203%20fields%20(00.20%25%20of%20keys%2C%20avg%20size%203.00)%0A0%20zsets%20with%200%20members%20(00.00%25%20of%20keys%2C%20avg%20size%200.00)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMore%20info%20about%20redic-cli%20and%20--bigkeys%20option%20can%20be%20consulted%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fredis.io%2Ftopics%2Frediscli%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Eredis-cli%2C%20the%20Redis%20command%20line%20interface%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3EHow%20to%20avoid%20using%20Large%20Key%20Value%20Sizes%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3ETo%20avoid%20using%20Large%20Key%20Value%20Sizes%2C%20Microsoft%20recommendation%20is%20to%20optimize%20client%20application%20for%20a%20large%20number%20of%20small%20values%2C%20rather%20than%20a%20few%20large%20values.%3C%2FP%3E%0A%3CP%3ELarge%20value%20sizes%20should%20be%20avoided%20and%20should%20be%20split%20in%20short%20key%20value%20sizes%2C%20making%20more%20requests.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20style%3D%22background-color%3A%20%230072c6%3B%20width%3A%20100%25%3B%22%20border%3D%221%22%20width%3D%22100%25%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22100%25%22%3E%3CFONT%20size%3D%224%22%20color%3D%22%23FFFFFF%22%3E%3CSTRONG%3E3-%20High%20Client%20CPU%20Load%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3EHigh%20CPU%20usage%20on%20the%20client%20side%20can%20cause%20that%20the%20system%20cannot%20keep%20up%20with%20the%20work%20that%20it%20has%20been%20asked%20to%20perform.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20could%20be%20a%20problem%20because%20if%20the%20CPU%20is%20busy%2C%20can't%20keep%20up%20with%20the%20work%20the%20application%20is%20asking%20it%20to%20do.%20%3CBR%20%2F%3EThe%20response%20from%20Redis%20can%20come%20very%20quickly%2C%20but%20because%20the%20CPU%20isn't%20keeping%20up%20with%20the%20workload%2C%20the%20response%20sits%20in%20the%20client%20socket's%20kernel%20buffer%20waiting%20to%20be%20processed.%3C%2FP%3E%0A%3CP%3EMicrosoft%20recommendation%20is%20not%20having%20Client%20CPU%20above%2080%25.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3EHow%20to%20verify%20High%20Client%20CPU%20Load%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E-%20Monitor%20the%20client's%20system-wide%20CPU%20usage%20using%20metrics%20available%20in%20the%20Azure%20portal%2C%20in%20client%20environment%20blade%20(AppService%2C%20VM%2C%20AKS%2C%20etc)%3B%3C%2FP%3E%0A%3CP%3E-%20Monitor%20performance%20counters%20on%20client%20machine.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2014.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3EHow%20to%20limit%20Client%20CPU%20usage%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E-%20Investigate%20what%20is%20causing%20High%20CPU%20or%20CPU%20spikes%20on%20client%20side%20and%20modify%20the%20code%20logic.%20%3CBR%20%2F%3EKeep%20in%20mind%20that%20client%20CPU%20are%20usually%20not%20only%20used%20by%20Redis%20client%20application%2C%20but%20by%20other%20applications%20in%20the%20same%20AppService%20plan%20(in%20case%20of%20WebApps)%2C%20or%20by%20other%20applications%20and%20operating%20system%20tasks%2C%20on%20VM's%2C%20VMSS's%2C%20AKS%2C%20etc.%3C%2FP%3E%0A%3CP%3E-%20Upgrade%20your%20client%20to%20a%20larger%20VM%20size%20with%20more%20CPU%20capacity.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20style%3D%22background-color%3A%20%230072c6%3B%20width%3A%20100%25%3B%22%20border%3D%221%22%20width%3D%22100%25%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22100%25%22%3E%3CFONT%20size%3D%224%22%20color%3D%22%23FFFFFF%22%3E%3CSTRONG%3E4-%20Client%20Network%20Bandwidth%26nbsp%3BExceeded%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3EClient%20Network%20Bandwidth%20exceeded%20and%20some%20other%20network%20causes%20for%20Redis%20timeouts%20are%20explained%20on%20this%20Tech%20Community%20article%3A%26nbsp%3B%3CSTRONG%3E%3CA%20id%3D%22link_9%22%20class%3D%22page-link%20lia-link-navigation%20lia-custom-event%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-paas-blog%2Fazure-redis-timeouts-network-issues%2Fba-p%2F2022222%22%20target%3D%22_blank%22%3EAzure%20Redis%20Timeouts%20-%20Network%20Issues%3C%2FA%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20style%3D%22background-color%3A%20%230072c6%3B%20width%3A%20100%25%3B%22%20border%3D%221%22%20width%3D%22100%25%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22100%25%22%3E%3CFONT%20size%3D%224%22%20color%3D%22%23FFFFFF%22%3E%3CSTRONG%3E5-%20Client%20Timeout%20Configurations%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3EEach%20Redis%20client%20library%20has%20its%20own%20configuration%20options%20and%20the%20ability%20to%20configure%20different%20timeout%20values.%20Each%20option%20and%20the%20respective%20default%20value%20can%20be%20different%20based%20on%20the%20client%20library%20used.%3CBR%20%2F%3EAs%20example%2C%20StackExchange.Redis%20uses%20the%20below%20related%20configuration%20options%20that%20can%20throws%20a%20timeout.%3C%2FP%3E%0A%3CDIV%20style%3D%22direction%3A%20ltr%3B%22%3E%0A%3CTABLE%20style%3D%22direction%3A%20ltr%3B%20border-collapse%3A%20collapse%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%20title%3D%22%22%20border%3D%221%22%20summary%3D%22%22%20cellspacing%3D%220%22%20cellpadding%3D%220%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%201.7034in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%20text-align%3A%20center%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3EConfiguration%20string%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%201.6604in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%20text-align%3A%20center%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3EDefault%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%207.4916in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%20text-align%3A%20center%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3EDescription%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%201.7034in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3ESyncTimeout%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%201.6604in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E5%20seconds%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%207.4631in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3Ethe%20amount%20of%20time%20to%20wait%20on%20a%20specific%20synchronous%20operation%20to%20complete%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%201.7034in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EResponseTimeout%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%201.6604in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3ESyncTimeout%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%207.4631in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%3Edeprecated%20-%20%3C%2FSPAN%3E%3CSPAN%3Ethe%20amount%20of%20time%20before%20the%20connection%20be%20treated%20as%20dead%20-%20%3C%2FSPAN%3E%3CSPAN%3Eused%20for%20backwards%20compatibility%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%201.7034in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EConnectTimeout%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%201.6604in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E5%20seconds%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%207.4631in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3Ethe%26nbsp%3B%20amount%20of%20time%20used%20to%20the%20connection%20attempt%20(15%20seconds%20recommended)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%201.7034in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EConnectRetry%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%201.6604in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E3%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%207.4631in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3Ethe%20number%20of%20times%20to%20repeat%20connect%20attempts%20during%20initial%20Connect%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%201.7034in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%20lang%3D%22pt%22%3EkeepAlive%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%201.6604in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E60%20seconds%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22vertical-align%3A%20top%3B%20width%3A%207.4631in%3B%20padding%3A%204pt%204pt%204pt%204pt%3B%20border%3A%201pt%20solid%20%23A3A3A3%3B%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%20lang%3D%22pt%22%3Etime%20at%20which%20to%20send%20a%20message%20to%20help%20keep%20sockets%20alive%20-%20see%20Idle%20Connections%20below%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3EHow%20to%20verify%20Redis%20Client%20Configurations%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3ETo%20verify%26nbsp%3BRedis%20Client%20Configurations%20you%20need%20to%20look%20for%20the%20connection%20string%20or%20the%20configuration%20object%20in%20the%20client%20application%20code%2C%20and%20check%20if%20the%20values%20used%20are%20the%20best%20for%20you%20case%20scenario%20and%20your%20workload.%3CBR%20%2F%3EMicrosoft%20recommendation%20is%20to%20use%20only%20one%20connection%20and%20reuse%20connections.%3CBR%20%2F%3EKeep%20in%20mind%20that%20if%20not%20following%20Microsoft%20recommendations%2C%20client%20application%20may%20have%20different%20connection%20strings%20with%20different%20configuration%20values%2C%20in%20different%20parts%20of%20code.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3EHow%20to%20Configure%20Redis%20Client%20Timeout%20values%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EStackExchange.Redis%20client%20library%3A%3C%2FSTRONG%3E%3CBR%20%2F%3EThe%20connection%20to%20Azure%20Redis%20could%20be%20made%20through%20a%20connection%20string.%20Because%20there%20are%20lot%20of%20different%20ways%20to%20configure%20Redis%2C%20StackExchange.Redis%20offers%20a%20rich%20configuration%20model%2C%20which%20is%20invoked%20when%20calling%20Connect.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESpecific%20to%26nbsp%3BConnectTimeout%20value%20on%20Stackexchange.Redis%20(the%26nbsp%3B%20amount%20of%20time%20used%20to%20the%20connection%20attempt)%2C%20Microsoft%20recommends%2015000ms%2C%26nbsp%3Bgiving%20the%20system%20time%20to%20connect%20even%20under%20higher%20load%20conditions%2C%20but%20the%20default%20value%20is%205000ms.%20You%20may%20want%20to%20adjust%20this%20value.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20configuration%20can%20be%20either%3A%3C%2FP%3E%0A%3CUL%20type%3D%22disc%22%3E%0A%3CLI%3Ea%20ConfigurationOptions%20instance%3A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Estring%20configString%20%3D%20%22redis236.redis.cache.windows.net%2C%20abortConnect%3Dfalse%2C%20ssl%3Dtrue%2C%20password%3DXXX%22%3B%0Avar%20options%20%3D%20ConfigurationOptions.Parse(configString)%3B%0Aoptions.AllowAdmin%20%3D%20true%3B%0Aoptions.abortConnect%3Dfalse%3B%0Aoptions.connectTimeout%3D15000%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3Ea%20string%20representing%20the%20configuration%3A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Estring%20configString%20%3D%20%22redis236.redis.cache.windows.net%2C%20abortConnect%3Dfalse%2C%20ssl%3Dtrue%2C%20password%3DXXX%2C%20connectTimeout%3D15000%22%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ethe%20switch%20between%20both%20configuration%20methods%20can%20be%20done%20trivially%3A%3C%2FP%3E%0A%3CDIV%3E%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3EConfigurationOptions%20options%20%3D%20ConfigurationOptions.Parse(configString)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FDIV%3E%0A%3CP%3Eor%3A%3C%2FP%3E%0A%3CDIV%3E%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Estring%20configString%20%3D%20options.ToString()%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThen%20use%20the%20configString%20or%20the%20ConfigurationOptions%20instance%20to%20create%20the%20connection%20with%20the%20new%20configuration%20values%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3EConnectionMultiplexer%20redis%20%3D%20ConnectionMultiplexer.Connect(configString)%3B%0AConnectionMultiplexer%20redis%20%3D%20ConnectionMultiplexer.Connect(options)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%3CSTRONG%3ESome%20other%20client%20library%20specific%20guidance%3A%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fgist.github.com%2FJonCole%2F925630df72be1351b21440625ff2671f%23file-redis-bestpractices-stackexchange-redis-md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%20data-linktype%3D%22external%22%3EStackExchange.Redis%20(.NET)%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fgist.github.com%2Fwarrenzhu25%2F1beb02a09b6afd41dff2c27c53918ce7%23file-azure-redis-java-best-practices-md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%20data-linktype%3D%22external%22%3EJava%20-%20Which%20client%20should%20I%20use%3F%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fgist.github.com%2Fwarrenzhu25%2F181ccac7fa70411f7eb72aff23aa8a6a%23file-azure-redis-lettuce-best-practices-md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%20data-linktype%3D%22external%22%3ELettuce%20(Java)%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fgist.github.com%2FJonCole%2F925630df72be1351b21440625ff2671f%23file-redis-bestpractices-java-jedis-md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%20data-linktype%3D%22external%22%3EJedis%20(Java)%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fgist.github.com%2FJonCole%2F925630df72be1351b21440625ff2671f%23file-redis-bestpractices-node-js-md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%20data-linktype%3D%22external%22%3ENode.js%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fgist.github.com%2FJonCole%2F925630df72be1351b21440625ff2671f%23file-redis-bestpractices-php-md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%20data-linktype%3D%22external%22%3EPHP%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fgist.github.com%2FJonCole%2F925630df72be1351b21440625ff2671f%23file-redis-bestpractices-session-state-provider-md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%20data-linktype%3D%22external%22%3EASP.NET%20Session%20State%20Provider%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20style%3D%22background-color%3A%20%230072c6%3B%20width%3A%20100%25%3B%22%20border%3D%221%22%20width%3D%22100%25%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22100%25%22%3E%3CFONT%20size%3D%224%22%20color%3D%22%23FFFFFF%22%3E%3CSTRONG%3E6-%20Idle%20Connections%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20Cache%20for%20Redis%20service%20configures%20a%2010%20minute%20idle%20server%20timeout%20for%20connections%2C%20independently%20of%20the%20client%20library%20used.%20This%20is%20defined%20on%20Server%20side%20and%20cannot%20be%20changed.%26nbsp%3B%3CBR%20%2F%3EIn%20that%20case%2C%20if%20the%20connection%20is%20idle%20for%2010%20minutes%20then%20it%20will%20reset%20the%20connection%20and%20clients%20may%20see%20socket%20reset%20errors%2C%20timeouts%20or%20some%20other%20connection%20error%20messages%2C%20depending%20of%20client%20libraries%20used.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESome%20clients%20like%20StackExchange.Redis%20will%20do%20regular%20PING%20calls%20to%20Redis%20to%20keep%20the%20connection%20alive%20(see%20keepAlive%20configuration%20above).%20%3CBR%20%2F%3ESome%20clients%20don't%20do%20this%2C%20so%20application%20developers%20should%20implement%20this%20periodic%20ping%20call%20to%20avoid%20close%20idle%20connections.%3CBR%20%2F%3EThis%20is%20discussed%20in%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-cache-for-redis%2Fcache-best-practices%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Redis%20Best%20Practices%20documentation%3C%2FA%3E.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3EHow%20to%20verify%20Idle%20Connections%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EIf%20you%20have%20idle%20connections%20without%20any%20Redis%20request%20during%2010%20minutes%20and%20you%26nbsp%3Bsee%20socket%20reset%20error%2C%20timeout%20or%20some%20other%20connection%20error%20message%2C%20the%20most%20probably%20cause%20is%20not%20having%20any%20keep%20alive%20policy%20implemented.%3CBR%20%2F%3EYou%20may%20also%20check%20for%20the%20specific%20client%20library%20used%2C%20if%20have%20any%20keepalive%20configuration%20option%2C%20as%20described%20for%20Stackexchange.Redis.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3EHow%20to%20mitigate%20Idle%20Connections%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EAdjust%26nbsp%3Bkeepalive%20configuration%20option%20to%2060%20seconds%20(by%20default%20on%20Stackexchange.Redis)%2C%20or%20the%20correspondent%20configuration%20value%20for%20different%20client%20libraries.%3CBR%20%2F%3EOn%20some%20cases%20for%20some%20client%20libraries%2C%20you%20may%20need%20to%20implement%20your%20own%20keepalive%20process%20doing%20a%20periodic%20ping%20to%20Redis%20endpoint%2C%20to%20maintain%20the%20connation%20active.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20style%3D%22background-color%3A%20%230072c6%3B%20width%3A%20100%25%3B%22%20border%3D%221%22%20width%3D%22100%25%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22100%25%22%3E%3CFONT%20size%3D%224%22%20color%3D%22%23FFFFFF%22%3E%3CSTRONG%3E7-%20High%20Client%20Memory%20Usage%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3EMemory%20pressure%20on%20the%20client%20machine%20may%20be%20the%20cause%20of%20many%20kinds%20of%20performance%20problems%20that%20can%20delay%20processing%20of%20responses%20from%20the%20cache.%20%3CBR%20%2F%3EWhen%20this%20occur%2C%20the%20system%20may%20page%20data%20to%20disk%2C%20and%26nbsp%3Bpage%20faulting%20causes%20the%20system%20to%20slow%20down%20significantly.%3C%2FP%3E%0A%3CP%3EThis%20may%20have%20higher%20impact%20on%20Redis%20calls%2C%20as%20is%20expected%20that%20Redis%20calls%20have%20high%20performance%2C%20with%20low%20response%20times.%20For%20that%20reason%20any%20memory%20pressure%20on%20client%20side%20will%20cause%20Redis%20timeouts%20prior%20than%20other%20services%20running%20on%20client%20environment.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3EHow%20to%20verify%20High%20Client%20Memory%20Usage%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EHigh%20Client%20Memory%20Usage%20can%20be%20verified%20at%20specific%20timestamp%20of%20Redis%20timeouts%2C%20monitoring%20memory%20usage%20on%20client%20machine%20to%20make%20sure%20that%20it%20doesn't%20exceed%20available%20memory.%3C%2FP%3E%0A%3CP%3ECould%20be%20useful%20also%2C%20Monitor%20the%20client's%20Page%20Faults%2FSec%20performance%20counter%2C%20as%20page%20faults%20can%20be%20caused%20by%20memory%20pressure.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3EHow%20to%20limit%20Client%20Memory%20Usage%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EClient%20Memory%20Usage%20can%20be%20reduced%2C%20reducing%20the%20number%20of%20running%20applications%2Fprocesses%20at%20same%20time%2C%20or%20investigating%20the%20processes%20using%20higher%20amount%20of%20memory.%20If%20some%20process%20is%20using%20high%20amount%20of%20memory%20than%20the%20expected%2C%20this%20process%2Fapplication%20should%20be%20troubleshooted%20to%20find%20the%20reason%20for%20that%20memory%20usage.%3C%2FP%3E%0A%3CP%3EIf%20all%20is%20expected%2C%20scaling%20the%20client%20environment%20to%20have%20more%20memory%20resources%20available%20should%20be%20implemented.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3EConclusion%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23000000%22%3E%3CSPAN%3EDespite%20having%20different%20reasons%20to%20have%20Redis%20timeouts%20on%20connections%20to%20Azure%20Cache%20for%20Redis%2C%20some%20different%20causes%20on%20Client%2C%20Server%20or%20Network%20side%20can%20cause%20Redis%20timeouts%2C%20and%20some%26nbsp%3B%3C%2FSPAN%3Emore%20details%20can%20be%20obtained%20in%20the%20documentation%20below.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFor%20Network%20or%20Server%20side%20Redis%20timeout%20causes%2C%20please%20see%20these%26nbsp%3B%3CFONT%20size%3D%223%22%3E%3CSPAN%3ETech%20Community%20articles%3A%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-paas-blog%2Fazure-redis-timeouts-server-side-issues%2Fba-p%2F2022202%22%20target%3D%22_blank%22%3EAzure%20Redis%20Timeouts%20-%20Server%20Side%20Issues%3C%2FA%3E%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-paas-blog%2Fazure-redis-timeouts-network-issues%2Fba-p%2F2022222%22%20target%3D%22_blank%22%3EAzure%20Redis%20Timeouts%20-%20Network%20Issues%3C%2FA%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3ERelated%20documentation%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-cache-for-redis%2Fcache-troubleshoot-timeouts%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETimeout%20issues%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1-%20Traffic%26nbsp%3BBurst%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%20lang%3D%22pt%22%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fuglide%2Fazure-content%2Fblob%2Fmaster%2Farticles%2Fredis-cache%2Fcache-how-to-troubleshoot.md%23stackexchangeredis-timeout-exceptions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EStackExchange.Redis%20timeout%20exceptions%3C%2FA%3E%26nbsp%3B(GitHub%20article)%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%20lang%3D%22pt%22%3E%3CA%20href%3D%22https%3A%2F%2Fgist.github.com%2FJonCole%2Fe65411214030f0d823cb%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EThreadPool%20Growth%3A%20Some%20Important%20Details%3C%2FA%3E%26nbsp%3B(Jon%20Cole%20article)%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%20lang%3D%22pt%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-cache-for-redis%2Fcache-troubleshoot-client%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EClient-side%20issues%3C%2FA%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%20lang%3D%22pt%22%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FStackExchange%2FStackExchange.Redis%2Fblob%2Fmaster%2Fdocs%2FTimeouts.md%23are-you-seeing-high-number-of-busyio-or-busyworker-threads-in-the-timeout-exception%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EBusyIO%20or%20BusyWorker%20threads%20in%20the%20timeout%20exception%3C%2FA%3E%26nbsp%3B(GitHub%20discussion)%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%20lang%3D%22pt%22%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FJonCole%2FSampleCode%2Fblob%2Fmaster%2FThreadPoolMonitor%2FThreadPoolLogger.cs%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EThreadPoolLogger%20code%20sample%3C%2FA%3E%26nbsp%3B(from%20Jon%20Cole)%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%20lang%3D%22pt%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-cache-for-redis%2Fcache-troubleshoot-client%23traffic-burst%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETraffic-burst%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%20lang%3D%22pt%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-cache-for-redis%2Fcache-faq%23recommendation%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ERecommendation%20ThreadPool%20settings%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%20lang%3D%22pt%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fprevious-versions%2Fdotnet%2Fnetframework-4.0%2F7w2sway1(v%3Dvs.100)%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EprocessModel%20Element%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%20lang%3D%22pt%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2-%20Large%20Key%20Value%20Sizes%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CA%20href%3D%22https%3A%2F%2Fredis.io%2Ftopics%2Frediscli%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Eredis-cli%2C%20the%20Redis%20command%20line%20interface%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-cache-for-redis%2Fcache-how-to-redis-cli-tool%23enable-access-for-redis-cliexe%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EEnable%20access%20for%20redis-cli.exe%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CA%20class%3D%22d-flex%20flex-items-center%20min-width-0%22%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoftarchive%2Fredis%2Freleases%2Fdownload%2Fwin-3.0.504%2FRedis-x64-3.0.504.zip%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20class%3D%22pl-2%20flex-auto%20min-width-0%20text-bold%22%3ERedis-x64-3.0.504.zip%3C%2FSPAN%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E3-%20High%20Client%20CPU%20Load%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CFONT%20size%3D%223%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-cache-for-redis%2Fcache-troubleshoot-client%23high-client-cpu-usage%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EHigh%20Client%20CPU%20usage%3C%2FA%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E5-%20Client%20Timeout%20Configurations%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CFONT%20size%3D%223%22%3E%3CA%20href%3D%22https%3A%2F%2Fredis.io%2Ftopics%2Fclients%23tcp-keepalive%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3ERedis%20Client%20handling%20-%20TCP%20keepalive%3C%2FA%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-cache-for-redis%2Fcache-best-practices%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Redis%20Best%20Practices%20documentation%3C%2FA%3E%26nbsp%3B%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fstackexchange.github.io%2FStackExchange.Redis%2FConfiguration.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EStackExchange.Redis%20configurations%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E6-%20Idle%20Connections%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-cache-for-redis%2Fcache-best-practices%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Redis%20Best%20Practices%20documentation%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20hope%20this%20can%20be%20useful%20!!!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2022203%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Azure%20Redis%20Timeouts%20-%20Client%20Side%20Issues.png%22%20style%3D%22width%3A%20543px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243463iEFA77E03AAD4EE93%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Azure%20Redis%20Timeouts%20-%20Client%20Side%20Issues.png%22%20alt%3D%22Azure%20Redis%20Timeouts%20-%20Client%20Side%20Issues.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2022203%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Cache%20for%20Redis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Redis%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎May 24 2021 06:14 AM
Updated by: