Does lua-nginx support this kind of nginx load balancing

34 views
Skip to first unread message

Peng Liu

unread,
Aug 19, 2016, 12:49:30 AM8/19/16
to openresty-en
Hi,

I have a scenario as follow: we prepare to use nginx for backend server load balance. The sessions in the backend server have states. So, we need to enable session sticky in nginx. The backend server also has a configuration for max allowed session number, default is 50.  When the session number reaches the maximum, the backend server won't allow new session to create. Our backend server exposes a URL for client to check whether new session could be created. The URL sample is http://IP:port/Status/Action?getattibute=AcceptNewConnection. If the the max session number is reached, the response body of this URL is "false". For the full load servers, if one of the sessions is finished and destroyed, the response body turns to "true" for that query URL.

With this kind of backend server, does lua-nginx module supports this kind of load balance requirement: when the first request of a new connection comes to nginx, nginx can check the /Status/Action?getattibute=AcceptNewConnection of all the upstream servers. Only the servers whose response body is "true" are allowed for the new connection load balancing. The requests for the established sessions can still be forwarded to the servers even the server has full load because the the session is already there.

Thanks
Peng
Reply all
Reply to author
Forward
0 new messages