lua-resty-redis icon indicating copy to clipboard operation
lua-resty-redis copied to clipboard

[Question] Difference between connect pool_size and set_keepalive pool_size

Open NicoAdrian opened this issue 3 years ago • 2 comments
trafficstars

I don't understand the difference between:

red:connect("unix:/path/to/unix.sock", { pool_size = 1000 })

and this:

red:set_keepalive(10000, 1000)

Both create a pool a 1000 reusable connections, am I right ? If so, why adding the pool_size option in set_keepalive and vice-versa ?

NicoAdrian avatar Mar 30 '22 16:03 NicoAdrian

the size from keepalive is deprecated, you can refer to https://github.com/openresty/lua-nginx-module#tcpsocksetkeepalive

zhuizhuhaomeng avatar Mar 31 '22 15:03 zhuizhuhaomeng

the size from keepalive is deprecated, you can refer to https://github.com/openresty/lua-nginx-module#tcpsocksetkeepalive

I don't even have access to the underlying socket, how am I supposed to set keepalive ?

Edit: Ok I got it, I must use pool_size from the connectmethod

NicoAdrian avatar Mar 31 '22 15:03 NicoAdrian