您的位置:首页 > 其它

Weblogic集群概念和配置(七)

2010-11-02 11:30 363 查看
测试代理应用是否成功
http://109.52.27.128:7000/placeholder.jsp?__WebLogicBridgeConfig
代理服务器的ip,代理服务器的端口
部署应用app
先拷贝该应用到C:/bea/user_projects/domains/myclusterdomain2008/applications目录下,系统自动发布到myserver管理服务器下,使用控制台将该应用发布到机器所有相关的被管理服务器下。





测试负载均衡
l 我们将通过Apache中所带的ab包来进行并发访问的模拟测试,使用如下的命令就可以完成压力测试。
l ab -n 100 -c 10 http://109.52.27.128:7000/defaultWebApp/index.jsp
l ab是测试程序的名称
l 参数n代表请求的总数量
l 参数c代表并发的请求数
l url为要测试压力的页面
l 注:使用这个命令时,一定要在系统路径中能够找到该程序,否则不能执行。

成功标志
Ab后台输出
l Percentage of the requests served within a certain time (ms)
l 50% 156
l 66% 187
l 75% 187
l 80% 203
l 90% 2609
l 95% 2937
l 98% 3000
l 99% 3031
l 100% 3031 (longest request)
Percentage of the requests served within a certain time (ms)是指相应时间内完成的请求的百分比,比如第一行指在12655ms的时间差内完成了50%的请求的响应。
在两台机器的ManagedServer的控制台都打出了index.jsp的执行语句结果:ok
附:index.jsp内容
l <%
l out.println("OK");
l System.out.println("OK");
l if(session.getAttribute("session name")==null){
l session.setAttribute("session name","session value");
l out.println("session value is null ,set it "+session.getAttribute("session name"));
l }else{
l out.println("session value is set :"+session.getAttribute("session name").toString());
l }
l %>
Session 复制
l 由于集群环境中,用户访问的请求在不同的被管理服务器之间不停的切换,而用户访问又需要保持状态(Session),这就要求Session可以穿梭于被管服务器之间,就是各个被管服务器上的Session是一致的,这样用户才感觉不到请求的切换。
l 集群环境Session的一致性使用了Session复制的技术。
l 要求一: Servlets must use either setAttribute() or removeAttribute() to change the session object. If you use other set methods to change objects within the session, WebLogic Server does not replicate those changes.
l 要求二: In order to support in-memory replication for HTTP session states, all servlet and JSP session data must be serializable. If the servlet or JSP uses a combination of serializable and non-serializable objects, WebLogic Server does not replicate the session state of the non-serializable objects.
l 要求三:不是硬性要求,而是考虑到性能的因素,最好不要在Session里放置大对象。
l 实现方法:
在应用webapp的weblogic.xml中添加
<session-descriptor>
<session-param>
<param-name>PersistentStoreType</param-name>
<param-value>replicated</param-value>
</session-param>
</session-descriptor>
注: 将持久性存储方法设置为以下某个选项:
memory - 禁用持久性会话存储。
replicated - 与 memory 相同,但会话数据将在群集服务器之间复制。
replicated_if_clustered – 如果 Web 应用程序部署于群集服务器上,则会复制生效的 persistent-store-type。否则,memory 为默认值。
sync-replication-across-cluster – 复制将在群集内同步发生。
async-replication-across-cluster – 复制将在群集内异步发生。
file - 使用基于文件的持久性(另请参阅 persistent-store-dir)。
jdbc - 使用数据库存储持久性会话。(另请参阅 persistent-store-pool。)
cookie – 所有会话数据都存储于用户浏览器的 cookie 中。
Session复制测试
先访问:
http://109.52.27.128:7003/defaultWebApp/index.jsp
OK session value is null ,set it session value
在访问:
http://109.52.27.128:7003/defaultWebApp/index.jsp
OK session value is set :session value
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: