增强WebLogic session的粘度

以前遇到的一个问题,解决过程如下:
 
集群系统,有2个节点,前端通过apache代理,后台总是报下面的告警,好像是session持久性的问题,
表现在应用上是这样的:当我执行一个查询生成一个临时文件,然后我再去下载这个临时文件时,会话转向另外一个server去查找文件,由于静态的文件不能被failover,所以会发生找不到文件的情况。
<Jan 14, 2007 5:11:33 PM CST> <Warning> <HTTP Session> <BEA-100074> <Primary session was removed during our attempt to retrieve secondary information from the session in the local server for the session: roid: -3937880596723352109 , rsid: [ID: 9LQnFpbPxTjJ1DVGF19hBT947L1vHvBQ2ZrztvQtfPykGRDTht0R Primary: -90604744:192.168.80.10:8004:-1 Secondary: 1696053682:192.168.80.11:8002:-1] , primaryURL: t3://192.168.80.10:8004.> 

java.io.FileNotFoundException: /data/cncbss/cncBssCluster/mserver2/applications/DefaultWebApp/DefaultWebApp/account/temp/yMcgF0NBy1zh8hbqCTw41GGWZGYnVYjhJjd2bWvzc2b3stZK3n0j!-90604744!1696053682!1169460641300.dat (No such file or directory)
由于文件是不能被WebLogic集群的,同时也没有采用共享目录的方式使两个节点都访问同一个文件系统,我的想法是让同一个会话的所有请求都发送到同一个节点上,而不要发送到另外一个节点上,这样,上述问题就迎刃而解(不过会带来其他问题,如,负载不是很均衡)。
 
上网求助,某版主要我设置WebLogic cluster的算法是affinity的,我选择了round-robin affinity.
设置后,会话请求按照我的想法发送了,但是又出现了另一个问题,页面打开相当缓慢,开始以为是算法的问题。
后来发现apache的日志里出现很多[error] CONNECTION_REFUSED [os error=0, line 1730 of ../nsapi/URL.cpp]: Error connecting to host错误,于是又上网找资料,没找到什么有用的,又去查看bea的文档,改了 KeepAlive On、增大了WebLogic的Accept BackLog大小,又改了系统TCP的参数,好像也没什么用处。最后在文档中看到下面一段话:

The Dynamic Server List

When you use the WebLogicCluster parameter in your httpd.conf orweblogic.conf file to specify a list of WebLogic Servers, the plug-in uses that list as a starting point for load balancing among the members of the cluster. After the first request is routed to one of these servers, a dynamic server list is returned containing an updated list of servers in the cluster. The updated list adds any new servers in the cluster and deletes any that are no longer part of the cluster or that have failed to respond to requests. This list is updated automatically with the HTTP response when a change in the cluster occurs.

试着关闭了DynamicServerList,重启apache,系统页面响应飞快。

我是这样认为的,WebLogic使用了round-robin affinity算法,同时关闭了DynamicServerList就意味着apache不再将请求路由到别的server上。

虚拟主机的配置如下:

<VirtualHost 192.168.0.8:9999>
    ServerName 192.168.0.8:9999
    DocumentRoot /CNC/
    CustomLog "|/usr/local/sbin/cronolog /CNC/ApacheLog/bssCluster/%w/access_9999_log" combined
    <IfModule mod_weblogic.c>
        WebLogicCluster 192.168.0.17:8002,192.168.0.18:8004                                     
        MatchExpression *.jsp
        MatchExpression *.htm
        MatchExpression *.html
        Idempotent ON
        KeepAliveEnabled ON
        DynamicServerList OFF 
    </IfModule>
</VirtualHost>

猜你喜欢

转载自langzhiwang888.iteye.com/blog/1704475
今日推荐