0

I'm getting a Timeout error while trying to run this code :

        List<HashEntry> entries = new List<HashEntry>();            

        for (i = 0; i < 10000; i++)
        {
            var extension = new Extension
            {
                Name = RandomString(30),
                LastName = RandomString(30),
                Number = random.Next(),

            };
            entries.Add(new HashEntry(extension.Name, JsonConvert.SerializeObject(extension)));                

        }

        cache.HashSet("extensions", entries.ToArray());

This exception occurs on the last line :

An unhandled exception of type 'System.TimeoutException' occurred in StackExchange.Redis.dll

Additional information: Timeout performing HMSET extensions, inst: 0, mgr: Inactive, queue: 2, qu=1, qs=1, qc=0, wr=1/1, in=0/0

Rodrigo Longo
  • 1,369
  • 10
  • 15
  • This blog post may help you figure out what is going wrong: http://azure.microsoft.com/blog/2015/02/10/investigating-timeout-exceptions-in-stackexchange-redis-for-azure-redis-cache/ Make sure your SyncTimeout value makes sense for your scenario. I tried your code from my local machine to a redis cache in azure and it took on average 500ms round-trip for that size of HashSet. If I were running the client in the same region in Azure, I would expect that time to reduce by quite a bit. – JonCole Apr 27 '15 at 15:09

1 Answers1

0

The solution was to add the "synctimeout" parameter in the connection configuration.

Rodrigo Longo
  • 1,369
  • 10
  • 15