Refinitiv / nginx-sticky-module-ng

Fork of https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng community
Other
82 stars 63 forks source link

Add support to balance mode #13

Closed SimonAbdullah closed 1 year ago

SimonAbdullah commented 1 year ago

Use Case

We have an environment (a JSF application) where the upstream servers count changes from time to time, based on different criteria, thus already existing sticky sessions won't be moved to new servers. This leaves the newly added server with no sessions (unless new browsers are used).

Available Solutions

The current implementation provides the following solutions to the previous issue.

1. Load balancer time-limited sessions

We can use the cookie expiry property to set an expiry date for sessions. Disadvantages: Once the cookie is expired, the session might be closed which will lead to some errors on the application level.

2. Application time-limited sticky sessions

The application can unset the cookie value whenever it's suitable so no errors occur on the application level. Disadvantages: Handling sessions should be on the application level, this is the load balancer's responsibility.

Proposed Solution

This PR adds the ability to detect the proper moment based on application behavior to create new sticky sessions with different upstream servers, using round-robin, and without causing the application to fail.