Question

If you were an asynchronous javascript call in an Asp.Net MVC environment, and you had to work with a round-robin style of load balancer, would you be able to find your way home?

edit: adding clarification ..using in-memory session state.

Was it helpful?

Solution

I'd configure my load balancer with stickey sessions to avoid this problem.

With sticky sessions, you'll be directed to the same server over and over again during the session.

OTHER TIPS

If your application is stateless, it shouldn't matter. Whether a standard HTTP request or Ajax based request to your server, if your application does not rely on server side state (such as a session), then it shouldn't matter if you hit different servers on subsequent requests.

Edit - given the question update mentioning you use in memory session state, then your approach to solving the issue for standard page requests will implicitly solve for Ajax. You have essentially two ways to go - sticky sessions through the load balancer so the same user gets the same server, or sharing the session state between your servers through a caching/storage mechanism.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top