I am curious why ConnectionMultiplexer.Connect(options)
attempts to connect 2 clients to the RedisDB instead of 1? Each time I connect I see that 2 additional clients connect to my RedisDB.
Asked
Active
Viewed 3,947 times
8

Matt
- 7,004
- 11
- 71
- 117
2 Answers
13
Because redis requires separate connections for interactive commands versus pub/sub subscriptions. If you aren't using pub/sub, you could tell the options to disable the SUBSCRIBE
command, in which case I believe the second connection is not established.

Marc Gravell
- 1,026,079
- 266
- 2,566
- 2,900
11
You can turn off second connection if you don't use redis pub/sub
var config = ConfigurationOptions.Parse(redisConnectionString);
config.CommandMap = CommandMap.Create(new HashSet<string> { "SUBSCRIBE" }, false);
connection = ConnectionMultiplexer.Connect(config);

Anubis
- 2,484
- 2
- 22
- 33