<b>Weblogic session persistence的性能的问题</b>[Java编程]
本文“<b>Weblogic session persistence的性能的问题</b>[Java编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
在weblogic中,sesion persitence有以下几种方法:
memory—Disables persistent session storage.
file—Uses file-based persistence (See also PersistentStoreDir, above).
jdbc—Uses a database to store persistent sessions. (see also PersistentStorePool, above).
replicated—Same as memory, but session data is replicated across the clustered servers.
cookie—All session data is stored in a cookie in the user's browser.
replicated_if_clustered—If the Web application is deployed on a clustered server, the in-effect PersistentStoreType will be replicated. Otherwise, memory is the default.
本文谈论的重点是长期化招致的性能问题,故只谈论JDBC和File两种方法,别的的不做谈论,Session相关的Params,请参考以下链接,
http://e-docs.bea.com/wls/docs81/webapp/weblogic_xml.html#1038173
首先说一下File persistence, 要使http session被写入到指定f目录下的file中,需求在/WEB-INF/weblogic.xml做以下配置:
weblogic.xml <session-param>
<param-name>PersistentStoreType</param-name>
<param-value>file</param-value>
</session-param>
<session-param>
<param-name>PersistentStoreDir</param-name>
<param-value>d:\session_test</param-value>
</session-param>
<session-param>
<param-name>CacheSize</param-name>
<param-value>10</param-value>
</session-param>
</session-descriptor>
测试我们利用weblogic自带的mainWebApp, 该web app位于近似以下的位置
D:\beasys\wls816\weblogic81\samples\server\examples\build
测试前,按上面的写法改正weblogic.xml, 然后改正index.jsp, 去掉头部的以下内容:
<%@ page session="false" %>
并改正其内容以下:
1 <%@ page import="java.util.ArrayList" %>
2 3 <%
4 String url = "http://" + request.getServerName() + ":" + request.getServerPort();
5 session.setAttribute("key", "value");
6 ArrayList list = new ArrayList();
7 for(int loop = 0; loop < 100000; loop++)
8 {
9 list.add("test" + loop);
10 }
11 session.setAttribute("list", list);
12 %>
以上是“<b>Weblogic session persistence的性能的问题</b>[Java编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |