You can configure the token method of load balancing for DataStream to base the selection of database servers on the value of the token extracted from the client (application or web server) requests. These tokens are defined by using SQL expressions. For subsequent requests with the same token, the NetScaler appliance sends the requests to the same database server that handled the initial request. Requests with the same token are sent to the same database server until the maximum connection limit is reached or the session entry has aged out.
You can use the following sample SQL expressions to define tokens:
| MySQL |
MS SQL |
| MYSQL.REQ.QUERY.TEXT |
MSSQL.REQ.QUERY.TEXT |
| MYSQL.REQ.QUERY.TEXT(n) |
MSSQL. REQ.QUERY.TEXT(n) |
| MYSQL.REQ.QUERY.COMMAND |
MSSQL.REQ.QUERY.COMMAND |
| MYSQL.CLIENT.USER |
MSSQL.CLIENT.USER |
| MYSQL.CLIENT.DATABASE |
MSSQL.CLIENT.DATABASE |
| MYSQL.CLIENT.CAPABILITIES |
|
The following example shows how the NetScaler DataStream feature works when you configure the token method of load balancing.
Figure 1. DataStream and the Token Method of Load Balancing
In this example, the token is the name of the database. A request with token books is sent to Database Server1 and a request with token music is sent to Database Server2. All subsequent requests with token books are sent to Database Server1 and requests with token music are sent to Database Server2. This configuration provides pseudo persistence with the database servers.