Hi all,
I have recently started using lua and openresty. I am trying to build an API gateway through openresty. One of the issues I am facing is handling concurrent requests in lua-resty-redis. Whenever the nginx server receives a request (request B) after a blocking request (request A) a new redis connection is created for the latest request( B ). I am using set_keepalive method of resty.redis to keep the pool of 10 connections alive for 100 seconds. What I am not able to deduce is when the connection from this pool will be used and when will be a new connection created. As of now whenever a new request comes after a blocking request a new connection is being created. This connection might be from the pool or it might be a new one.
I used get_reused_times method to check whether request B was using the previous connection. It turns out it is not.
Also if some one could explain me how it is related to Worker connections I will be thankful.
All in all I just want to know when a new connection would be created and when a connection from the pool would be used.
Thanks in advance.
P.S : This the first time I am posting a message in an opensource community, so please don't mind anything.
Shashwat.