是否可以通过 JMX 使 JBoss 中的单个会话失效?
我们正在追踪应用程序中的一些内存问题,并且我们可以了解问题所在的会话的大小。 它只会影响某些会话,它们似乎会失去控制,我们希望能够或多或少地“手动”使这些会话无效,以回收该内存。 有没有办法通过 JMX 来做到这一点? 我们使用的是 JBoss 4.5.2 。
提前致谢。
We are tracking down some memory issues in our application and we have visibility into the size of our sessions where the problem seems to be. It is only affecting certain sessions where they seem to balloon out of control and we'd like to have the ability to invalidate those sessions more-or-less 'by hand' to reclaim that memory . Is there a way to do this through JMX? We are using JBoss 4.5.2 .
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
答案是肯定的,可以。
--这会获取 JBoss 中加载的 Web 模块 MBean--
/opt/lib/jboss-4.2.3.GA/bin/twiddle.sh -s <--ServerIP-->:1099 query 'jboss .web:*' | grep "type=Manager"
-- 一旦您拥有了该文件,您就可以从该 MBean 获取活动会话
--
/opt/lib/jboss-4.2.3.GA/bin/twiddle.sh -s 172.16.0.216:1099 调用“<--MBean-->” listSessionIds
--最后,一旦有了该列表,您就可以挑选出感兴趣的会话并使其过期 --
/opt/lib/jboss-4.2.3.GA/bin/twiddle.sh -s <--ServerIP-->:1099 调用“<--MBean-->” expireSession <--SessionID-->
您将替换 <--ServerIP--> 使用服务器绑定的IP...它不需要是本地的。 只要您有权访问端口 1099,就可以远程运行它。
<--MBean--> 将被替换为第一个查询的结果之一。
<--会话ID--> 将替换为第二个命令中的会话 ID 之一。
此外,您还可以将 /opt/lib/jboss-4.2.3.GA/bin/twiddle.sh 替换为计算机上 twiddle 的位置。 它包含在 JBoss 中。
The answer is yes, you can.
--this gets the web module MBeans loaded in JBoss--
/opt/lib/jboss-4.2.3.GA/bin/twiddle.sh -s <--ServerIP-->:1099 query 'jboss.web:*' | grep "type=Manager"
--Once you have that you can get the active sessions from that MBean--
/opt/lib/jboss-4.2.3.GA/bin/twiddle.sh -s 172.16.0.216:1099 invoke "<--MBean-->" listSessionIds
--And finally, once you have that list, you can pick out the session of interest and expire it--
/opt/lib/jboss-4.2.3.GA/bin/twiddle.sh -s <--ServerIP-->:1099 invoke "<--MBean-->" expireSession <--SessionID-->
You would replace <--ServerIP--> with the ip the server is bound on...it need not be local. This can be run remotely as long as you have access to port 1099.
<--MBean--> would be replaced with one of the results of the first query.
<--SessionID--> would be replaced with one of the session ids from the second command.
Also you would replace /opt/lib/jboss-4.2.3.GA/bin/twiddle.sh with the location of twiddle on your machine. It is included in JBoss.
谢谢伊科鲁斯。 您的解决方案至少帮助我通过某种方式在任何给定时间查看服务器上的所有活动会话。
顺便说一句...在运行 twiddle.sh 之前需要执行以下几件事
确保在环境中设置 JAVA_HOME 和 JBOSS_HOME
并确保 JBOSS_CLASSPATH 未设置或具有 twiddle.sh.ie {JBOSS_HOME}\client\jbossall-client.jar;{JBOSS_HOME}\client\getopt.jar;{JBOSS_HOME}\client\log4j 中给出的所有库。罐; {JBOSS_HOME}\lib\jboss-jmx.jar
否则你会遇到 ClassNotFound 异常
Sudheer
Thanks Ichorus. Your solution helped me with at least some way to see all the active sessions on the server at any given time.
Btw...Here are couple of things needed before running twiddle.sh
Make sure JAVA_HOME and JBOSS_HOME are set in the environment
And Make Sure JBOSS_CLASSPATH is either not set or has all the libs given in twiddle.sh.i.e {JBOSS_HOME}\client\jbossall-client.jar;{JBOSS_HOME}\client\getopt.jar;{JBOSS_HOME}\client\log4j.jar; {JBOSS_HOME}\lib\jboss-jmx.jar
Other wise you would run into ClassNotFound exceptions
Sudheer