weblogic weblogic.servlet.internal.session.MemorySessionData对象过多导致内存溢出

  用MAT分析DUMP文件,可以发现weblogic.servlet.internal.session.MemorySessionData过多,

 SELECT * FROM weblogic.servlet.internal.session.MemorySessionData 对象有120万之多,占用900M的内存。

 当一个用户登陆之后,在会在weblogic里面生成一个MemorySessionData对象,这个对象生命周期是weblogic控制,通过web.xml中的一个配置项。

<session-config>

     <session-timeout>300000</session-timeout> 
</session-config>

这里的单位是分钟

To look for session objects collected in the heap, you first need to know the session persistence method used by the customer's application. The same can be found out from the application's weblogic.xml file. In the example, the following entries are made in the weblogic.xml:

<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90">
  <session-descriptor>
    <persistent-store-type>replicated</persistent-store-type>
  </session-descriptor>
</weblogic-web-app>

The tag "persistent-store-type" governs which class WLS would internally use to store the session objects; this is important to the debugging aspect while reviewing the heap dump. Valid values for the "persistent-store-type" and the corresponding classes used are listed below.

Persistent Store Type WLS Implementation Class
memory weblogic.servlet.internal.session.MemorySessionData
replicated weblogic.servlet.internal.session.ReplicatedSessionData
async-replicated weblogic.servlet.internal.session.AsyncReplicatedSessionData
file weblogic.servlet.internal.session.FileSessionData
async-jdbc weblogic.servlet.internal.session.AsyncJDBCSessionData
jdbc weblogic.servlet.internal.session.JDBCSessionData
cookie weblogic.servlet.internal.session.CookieSessionData

APPLIES TO:

Oracle WebLogic Server - Version 10.3.5 and later
Information in this document applies to any platform.

SYMPTOMS

There is huge consumption of memory in the production environment. A memory dump shows two WebLogic classes as leak suspects:

  • weblogic.servlet.internal.session.MemorySessionContext (66.05%)
  • weblogic.servlet.internal.session.MemorySessionData (21.52%)

CAUSE

The "session-timeout" value in in web.xml is set to 1 hour (3600 seconds) by default. If the session is not invalidated or timed out in application code, each session will live for that full hour, causing objects to accumulate until the container times the session out. Combine this with heavy traffic (so lots of sessions opened), and this causes huge memory consumption.

To find if there are any invalid sessions lingering in the heap after a particular time, it is recommended that the application explicitly call session.invalidate() to invalidate a session after the user logs out. However WLS also provides a mechanism to expire sessions after a specific interval that is referred to as the "session-timeout" parameter in the web.xml. The value set in this element overrides the value set in the TimeoutSecs attribute of the element in the WebLogic-specific deployment descriptor weblogic.xml. If nothing is specified the default value of 3600 seconds is used. See Session Timeout for more information.

SOLUTION

To reduce the memory consumption from HTTP session objects, please follow these steps:

  1. Ensure that the application code explicitly calls session.invalidate() when a user logs out of their session.
  2. Lower the "session-timeout" value set in in web.xml to (for example) 15 minutes.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值