会话处理问题(需要专家的建议) [英] A session handling problem (need experts' advise)

查看:65
本文介绍了会话处理问题(需要专家的建议)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,在问真正的问题之前,我会做一个简短的概述.有一个站点正在单个Web服务器上运行.该站点正在使用进程内会话来跟踪一些重要信息(非常关键).

几年之后,该网站获得了大量流量(每天约数百万),而所有这些点击实际上都是在该站点上执行一些数据库操作.因此,为了保持性能,单个服务器被服务器场代替.现在,在负载均衡器后面有5台服务器.

现在的问题是:以前仅使用一台服务器时,所有会话处理都在进行中.现在在服务器场方案中,我们不能指望它能正常工作.我们将必须有SqlServer或stateSercer.这样做的问题是会话中有很多类,集合和泛型.如果要使用以上两种方法中的任何一种,我们都必须使放入会话的所有内容都可序列化(这意味着大量的返工,最重要的是,这需要时间).

现在我在想,直到这些会话对象被更改(可序列化)之前,我将在负载平衡器处执行一些操作,以将来自IP的请求始终重定向到同一服务器,以便进程内会话将继续为之工作.暂时.即负载均衡器将保留类似[requesting IP - web server]
的映射
这里的问题是,我朝着正确的方向前进还是存在一些我无法预见的问题?我还有其他方法可以使过程会话进行几个月的工作(在负载均衡器上已完成一些工作)

专家,请提出建议.我应该使用此IP-server映射还是还有其他方法可以更优雅地完成?

OK before asking the real question, I will give a brief overview. There was a site which was running on a single web server. This site was using in-proc session for keeping track of some important information(very crucial).

After a couple of years the website was getting a lot of traffic(around a couple of millions per day) and all these hits are actually doing some DB operations on the site. So to keep the performance the single server was replaced by a server farm. Now there are 5 servers sitting behind a load-balancer.

Now the problem: Earlier when only one server was being used all the session handing was in-proc. Now in the server farm scenario, we cant expect it to work properly. We will have to have SqlServer or stateSercer in place. The problem in doing this is that there are lots and lots of classes, collections and generics being pushed into the session. If we want to use any of the above two we will have to make everything put in session serialize-able(which would mean a lot of rework and most importantly it will take time).

Now I was thinking that till these session objects are getting changed(to become serializable), I will do something at the load-balancer to redirect requests coming from an IP to the same server always so that the in-proc session will keep working for the time being. i.e. load balancer will keep a map like [requesting IP - web server]

The question here is, Am i going in the right direction or there are some problems I could not foresee? Is there any other way I could have things working with in-proc session for a couple of months(having something done on load-balancer)

Experts, please suggest. Shall I go with this IP-server mapping or is there any other way this could be done more elegantly?

推荐答案

嗨 关于:"这里的问题是,我是朝正确的方向前进还是存在一些我无法预见的问题?"

您应该阅读服务器关联性和粘性会话
如果负载平衡器使用会话亲缘关系,它将把来自IP地址的所有请求关联到服务器场中的单个服务器,这将为您处理,即服务器为该会话提供所有请求.
Hi Regarding : "The question here is, Am i going in the right direction or there are some problems I could not foresee? "

You should read up on server affinity and sticky sessions
If the load balancer uses session affinity it will associate all requests from a IP address to a single server in the farm, this will take care of it for you i.e. the server serves all requests for that session.


这篇关于会话处理问题(需要专家的建议)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆