Skip to main content
Version: 3.14.x.x LTS

DB node affinity

This setup is recommended only for scenarios with less than 5000 concurrent sessions.

For some clients, reliable session stickiness is not possible. This means that the load-balancer will route each request of a client independently of the previous one. nevisProxy provides a built-in DB node affinity to support scenarios that do not facilitate session-sticky load-balancing. With this feature, one DB node manages the session IDs with an odd number, the other node manages the session IDs with an even number. The feature is enabled via the DB table "conf".

Have a look at the following sample configuration:

MariaDB> select * from conf;
+-------------------------------+------------------------------------------------+----------+
| CACHENAME | PARAMETER | VALUE |
+-------------------------------+------------------------------------------------+----------+
| nbnevissession_sticky_session | VERSION | 3.13.7.0 |
| nbnevissession_sticky_session | INACTIVE_TIMEOUT | 500 |
| nbnevissession_sticky_session | FINAL_TIMEOUT | 7200 |
| nbnevissession_sticky_session | STICKINESS | SESSION |
| nbnevissession_sticky_session | //nevisproxy-db5:3306/replicated_session_store | 1 |
| nbnevissession_sticky_session | //nevisproxy-db6:3306/replicated_session_store | 0 |
+-------------------------------+------------------------------------------------+----------+

MariaDB> select from conf

  • The parameter STICKINESS is set to "SESSION" to enable the session stickiness. If this line is not set, or is set to "NONE", the normal session replication is performed.
  • The fifth and sixth lines specify in which DB node the even- and odd-numbered sessions will be stored.

When session stickiness is enabled (see below), we recommend swapping the order of the DB nodes between the nevisProxy instances. See the sample below:

On the nevisProxy instance 1

<init-param>
<param-name>ConnectString</param-name>
<param-value>replication://nevisproxy-db5:3306,nevisproxy-db6:3306/replicated_session_store</param-value>
</init-param>

On the nevisProxy instance 2

<init-param>
<param-name>ConnectString</param-name>
<param-value>replication://nevisproxy-db6:3306,nevisproxy-db5:3306/replicated_session_store</param-value>
</init-param>