Does StackExchange.Redis.ConnectionMultiplexer create multiple connections for Azure Redis Enterprise?

Shaun Wallace 20 Reputation points Microsoft Employee
2024-07-08T20:57:54.97+00:00

I'm noticing in the Azure Portal the metrics for my Azure Redis Enterprise cache shows more connected clients than I have servers in my environment. I don't see a bug in my code where I would be creating multiple ConnectionMultiplexers. Under the covers does the ConnectionMultiplexer create multiple connections?

Azure Cache for Redis
Azure Cache for Redis
An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.
259 questions
0 comments No comments
{count} votes

Accepted answer
  1. Oury Ba-MSFT 19,581 Reputation points Microsoft Employee
    2024-07-08T23:04:30.8633333+00:00

    @Shaun Wallace Thank you for reaching out.

    Seems like you are seeing more connected clients than you have servers in your environment for your Azure Redis Enterprise cache.

    Yes, by default each ConnectionMultiplexer instance in StackExchange.Redis creates at least 2 connections to each cache. One for interactive commands, and one for pub/sub messages. To condense those into a single connection you can switch to use RESP3 instead of RESP2.

     When using OSS Clustering mode, the number of connections will be even higher, as each ConnectionMultiplexer connects to all shards in the cache per the Redis clustering specification.

    Hope that helps.

    Regards,

    Oury

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.