Load Balancing, AJAX, and You

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 14:57:30

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/370109/load-balancing-ajax-and-you

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!