devxlogo

Sessions Do Not Work on Web Server Farms

Sessions Do Not Work on Web Server Farms

Question:

How do sessions work with clustered NT servers? How do you make use of clustering technology if an NT machine goes down along with its sessions? Is NT smart enough to know to replicate these sessions in other servers and route all requests to these other servers?

Answer:

Sessions are specific to a Web server and are not supported across machines. When you use clustered NT servers (I assume you mean a Web server farm, where a number of servers having identical Web content serve the same domain name URL), you cannot use session variables. In a Web farm scenario, a load-balancing device?either a hardware or software component?intercepts the request for a Web page and passes it on to one of the available Web servers based on which server has the least load. This way, even if a Web server goes down, the other servers will absorb the load.

If you want to use Web farms efficiently, you will need to create stateless applications with no session variables. If you do wish to use session variables then you will need to make sure that the load-balancing device that you have (hardware or software) always routes the browser request to the same machine so that the session can be maintained. But that defeats the whole purpose of creating a server farm. If that particular machine goes down, for that user, your Web site has gone down. Bottom line: start thinking, designing, and developing stateless applications.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist