twemproxy icon indicating copy to clipboard operation
twemproxy copied to clipboard

maximum number of server_connections

Open sachinpkale opened this issue 12 years ago • 9 comments

We have following setup of twemproxy on production: 5 service instances 1 twemproxy instance 4 redis instances Service instances are connected to twemproxy with max_active_connections = 1000. Currently, we are having server_connections: 1000 in the twemproxy configuration. But, as we are having 5 service instances each with max 1000 connections, should we increase the server_connections value to 5000?

sachinpkale avatar Aug 11 '14 05:08 sachinpkale

@sachinpkale

you can use server_connections = 1 for most cases.

twemproxy will multiplex/pipeline client requests on the only connection. this is as fast as you use more server_connections.

idning avatar Aug 11 '14 05:08 idning

wouldn't server_connections = 1 be bottleneck if there are too many parallel requests?

sachinpkale avatar Aug 11 '14 06:08 sachinpkale

redis use single process, no matter you use 1 connection or many connections, redis will process it one by one.

so, no bottleneck here.

idning avatar Aug 11 '14 06:08 idning

Then, what is the use of server_connections field in case of redis? is it meant to use only for memcached?

sachinpkale avatar Aug 11 '14 07:08 sachinpkale

yes, It make sence for memcached,

I can't find more reasons to use server_connections>1

idning avatar Aug 11 '14 08:08 idning

Ok. I will make the change. Thanks for you help.

sachinpkale avatar Aug 11 '14 08:08 sachinpkale

@idning what 's meaning of "server_connections" for memcached? Twemproxy is also single thread.

xinyu7git avatar Apr 03 '15 06:04 xinyu7git

@xinyu7git

twemproxy is single thread. but server_connections are meaningful for memcached. because memcached is multi threaded for read(in different slab)

so.

  1. client A request large data set for memcached A
  2. client B request large data set for memcached A

in server_connections == 1, client B should wait for finishing Task A. but server_connections > 1, client B can work with memcached A

charsyam avatar Apr 03 '15 07:04 charsyam

nobody reads docs anymore https://github.com/twitter/twemproxy/blob/master/notes/recommendation.md#server_connections--1

manjuraj avatar Apr 03 '15 23:04 manjuraj