Leonardo
Leonardo

Reputation: 11391

Redis Connection - Multiplex it or not?

In terms of performance, is it better to multiplex 1 connection object across multiple requests or to give each request it's own connection?

Upvotes: 1

Views: 3079

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1062780

Well, what redis client are you using? StackExchange.Redis is explicitly designed to be multiplexed and shared between multiple requests (or any other parallel load); other clients may not be, and may require you to lease from a pool per request (or for some portion of a request). There is quite a lot of overhead involved in establishing a connection with redis (optionally DNS, sockets, optionally TLS, and a bit of chit-chat backwards and forwards to determine the redis server configuration), so you don't want to completely establish a new underlying connection per request (even if it is fast).

Upvotes: 2

Related Questions