The load-balancing method
We had been using a load-balancing vServer now, but have no idea about load-balancing methods.
Unfortunately, there is no way to do labs about load-balancing methods in a test-environment like that. I would suggest taking a look at methods.
Click, again on the far right side, on Methods. Have a look at the methods listed. All hash-based ones are intended to be used for outbound connections (load-balancing firewalls, proxies, routers, …). Number of packets and bandwidth are usually used for streaming services. In most cases, the default, least connections, is best.
Under certain instances, you don’t like load-balancing doing a random job. You want users to stay with the server they used for their first request. A good example is Citrix StoreFront server. You have to log on to the StoreFront-sever you are connecting too. A user seems to be not logged on if the next request hits one of the other servers.
Another example would be an e-shop storing a user’s shoping cart on the server instead of storing it into the database or database servers storing temporary results into temporary tables kept in RAM.
Again, on the far right side, click Persistence. There are the two most popular methods for HTTP: Source IP and CookieInsert.
Give source IP a try. You will see how it works. Check Traffic Management and then, in the left column of the right page, Virtual Server persistence sessions. You should see your session. You may clear the persistence table. Next refresh will create a new entry (and probably give you a new colour).
Press F12 on your browser (see Tips and tricks around your Browser). See what your requests look like, watch out for cookies.
your headers will probably look a little bit different, but there should not be a cookie in it.
Now, let’s turn on cookie-based persistence.
Response headers changed:
You can now see a cookie being sent to the user. This cookie will appear in the next request to the ADC / NetScaler and overwrite load-balancing decisions. You will stay persistent with the colour you got for your first request.
Bonus-question: How comes, you can just see sessions for source IP, but not for cookieinsert? (because Citrix ADC / NetScaler does not store persistence information, instead it is stored on client-side)
You should change cookie-tyle from 0 to 1. Click on System → Settings. Open Change HTTP Parameters in the right column of the right page. There is a radio-button for cookie version. Version 0 will send an expiry time (i.e.: 2020-06-18, 18:21:52). This might fail if the system clock on the client device is wrong. Type 0 will reply with a TTL (i.e. 2 minutes). User’s device will calculate the actual expiry time and it will always be 2 minutes away, no matter, how wrong it’s clock is.