saur
saur

Reputation: 103

TimeoutException during setting cache in StackExchange.Redis

I am trying to set key-value pairs in Azure Redis cache using StackExchange.Redis client in Visual Studio. This is the code I have:

ConnectionMultiplexer connection=ConnectionMultiplexer.Connect("connection_name,ssl=true,password=some_password");

IDatabase cache = connection.GetDatabase();      
for (int i = 0; i < 500; i++)
{
cache.StringSet("key" + i, "value" + i);
}

However, I get TimeoutException while the code is setting some random key value pair. What could be the issue and how should I resolve it? Thanks.

Upvotes: 2

Views: 795

Answers (2)

Philip P.
Philip P.

Reputation: 2394

This is Azure Redis, managed service. In the past there were definitely issues like this reported with smallest sizes, e.g Basic 250MB. If you use this size, try with bigger size, say Standard 2.5GB.

Upvotes: 0

Marc Gravell
Marc Gravell

Reputation: 1063864

  • could be a server stall ("slowlog get" and the Redis server logs are the first things to look at)
  • could be a network infrastructure stall
  • could be a library glitch
  • could just be blocked on data (perhaps try a slightly higher timeout)

The error message should include a bunch of numbers. If you can tell me those numbers, I might be able to say more.

Upvotes: 1

Related Questions