Know Your Server Load Balancer Better

Posted by Pamela Sun on October 11th, 2017

When you put your web work behind a server load balancer or application delivery network, you immediately need to take some important elements into consideration.
Use of a server load balancer implies that you have more than one web server processing requests. In this situation, how you manage your static assets (JS, images, CSS files) becomes important.
Static assets don't change as they are the same across servers. We can likely get away with having them copied on each web server behind a load balancer. The main worry here is making sure that static assets are successfully imitated and are the same on each server.
We might also benefit from using a CDN, which can serve and cache our static assets, reducing the load on our server and loading them faster for visitors geographically far away from our web servers. Something like MaxCDN, Cloudflare or Cloudfront might be appropriate.
If we accept user uploads (such as with a CMS), the uploaded file can't simply live on the web server it was uploaded to. When an uploaded png file only lives on one web server, a request for that image will result in a 404 response when the server load balancer attempts to find it on web server which does not have the image.
Now in this situation if the web servers need to have a central file store they can all access.
One way this is perform is via a shared network drive. This, however, gets slow when high levels of traffic or there are many files. Furthermore, if our architecture is distributed across several data centers then a shared network drive can become too slow. Our web servers would be too far away from them and the network latency too high.
Now how We handle sessions becomes an important consideration. Session information is usually saved on a temporary location within a web server.
A visitor may log in, creating a session on one web server. On a subsequent request, however, the server load balancer may bounce that visitor to another web server which doesn't have that session information! To the visitor, it appears that they are no longer logged in.
There are two common fixes for this.
Cookie based Sessions
In this case, cookies are used to store the session information. The session data, such as the user ID, will not saved to the server or any other storage, but will instead within the browser's cookie.
Sticky SessionsAnother way is use "sticky sessions", also known as "session affinity". In sticky sessions you track which server a client was routed to and always route their request to the same web server on subsequent requests.
This let's the web server keep its default behavior of saving the session locally only leaving it up to the server load balancer to get a client back to that server.
Today AVANU’s WebMux has been use in many projects all across world, because of its sophisticated load balancing capabilities and by utilizing the intuitive application setup wizards.
So wait no more for your server load balancer and application delivery network solutions. Contact us know.

To know more visit us:
network traffic manager

Like it? Share it!

Pamela Sun

About the Author

Pamela Sun
Joined: July 19th, 2017
Articles Posted: 14

More by this author