weblogic集群session保持的问题

这次考试院weblogic集群一直被session保持的问题所困扰,节点控制台的error信息如下:

Error  Cluster All session objects should be serializable to replicate. Check the objects in your session. Failed to replicate non-serializable object.

在我们本地环境测试的时候,weblogic集群的session同步的配置应该没有问题,但是在客户环境下总是存在问题,困扰了几天,仔细的思考了一下,感觉应该和前端的负载分发中的session保持有关。

在本地环境中,前端使用的是radware的WSD来做应用分发,但是在客户环境中使用的是HAproxy来做代理分发,在haproxy的配置中一直使用的默认配置cookie  SERVERID,今天啃了一下帮助文档,其中有针对应用session的定义部分:

2.11) Application Cookies
————————-
Since 1.2.4 it is possible to catch the cookie that comes from an
application server in order to apply “application session stickyness”.
The server's response is searched for 'appsession' cookie, the first
'len' bytes are used for matching and it is stored for a period of
'timeout'.
The syntax is:

   appsession len timeout

is the cookie, the server uses for it's session-handling
how many bytes/characters should be used for matching equal
               sessions
after this inactivaty time, in ms, the cookie will be deleted
            from the sessionstore

The appsession is only per 'listen' section possible.

Example :
———
   listen http_lb1 192.168.3.4:80
      mode    http
      capture request  header Cookie len 200
      # Havind a ServerID cookie on the client allows him to reach
      # the right server even after expiration of the appsession.
      cookie ServerID insert nocache indirect
      # Will memorize 52 bytes of the cookie 'JSESSIONID' and keep them
      # for 3 hours. It will match it in the cookie and the URL field.
      appsession JSESSIONID len 52 timeout 10800000
      server first1 10.3.9.2:10805 check inter 3000 cookie first
      server secon1 10.3.9.3:10805 check inter 3000 cookie secon
      server first1 10.3.9.4:10805 check inter 3000 cookie first
      server secon2 10.3.9.5:10805 check inter 3000 cookie secon
      option httpchk GET /test.jsp

按照文档中的做了相应修改:appsession JSESSIONID len 52 timeout 10800000

看来针对应用session需要通过appseesion来明确定义其session的句柄标识,现在测试基本正常。

发表评论