3

I'm are storing ConnectionMultiplexer static object in ASP.NET MVC website getting ~500req/sec which are hitting Redis instance on RedisLabs. Once in a while I see errors saying SocketFailure on EVAL and increased connection count on RedisLabs dashboard. Should I have dispose old ConnectionMultiplexer instance and recreate new or try reconnect manually after those exceptions?

Matteo
  • 37,680
  • 11
  • 100
  • 115
pauliusnrk
  • 593
  • 7
  • 18

1 Answers1

2

The system should attempt to reconnect automatically. What it does not do is retry your commands, because it has no way of knowing what did and did not complete at the server (because: the socket failed; for all it knows, the "ok" response could have already been sent by redis).

So, you should not need to dispose/reconnect. You can monitor the connection failure/reconnect via events published on the multiplexer instance. You can also use the .IsConnected() method on a database (this takes a key for server targeting reasons, but if you are only talking to one server, you could pass anything as the key).

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • Thanks for a fast answer. And what about those increased connections count? I'm running 5 asp.net instances and normally seeing 10 connections, but after SocketFailure error connection count increases to +70? What worries me is that ConnectionMultiplexer is opening new connection and leaves hanging old ones. – pauliusnrk Sep 03 '14 at 11:34
  • @paul that is curious; is there any way I can repro? – Marc Gravell Sep 05 '14 at 22:07
  • We'd be happy to help in any way - let me/support@redislabs.com know if you need us :) – Itamar Haber Sep 11 '14 at 08:09