[jboss-cvs] JBoss Messaging SVN: r7759 - in trunk: src/main/org/jboss/messaging/core/server/impl and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 17 12:23:06 EDT 2009
Author: jmesnil
Date: 2009-08-17 12:23:05 -0400 (Mon, 17 Aug 2009)
New Revision: 7759
Modified:
trunk/examples/soak/reconnect/README
trunk/src/main/org/jboss/messaging/core/server/impl/ServerInfo.java
Log:
JBMESSAGING-1711: Add periodic dump of server info for debugging
* used Runtime's memeory info to compute the % of available memory
* updated soak reconnect's README
Modified: trunk/examples/soak/reconnect/README
===================================================================
--- trunk/examples/soak/reconnect/README 2009-08-17 16:09:50 UTC (rev 7758)
+++ trunk/examples/soak/reconnect/README 2009-08-17 16:23:05 UTC (rev 7759)
@@ -22,27 +22,23 @@
Configure Server Dump
=====================
-A POJO is created by JBoss Microcontainer to "dump" server info at regular interval:
+The server can "dump" info at regular interval. In jbm-configuration.xml, set
+ <server-dump-interval>10000</server-dump-interval>
+
+to have infos every 10s:
+
**** Server Dump ****
-date: Wed Aug 12 10:22:08 EDT 2009
-heap memory: used=1.44 GB, max=1.99 GB
-non-heap memory: used=1.44 GB, max=1.99 GB
-# of thread: 33
-# of conns: 28
-JMS queues:
- soakQueue: delivering 13 msgs to 7 consumers (13 msgs in memory, 22849506 added)
+date: Mon Aug 17 18:19:07 CEST 2009
+free memory: 500,79 MiB
+max memory: 1,95 GiB
+total memory: 507,13 MiB
+available memory: 99,68%
+total paging memory: 0,00 B
+# of thread: 19
+# of conns: 0
********************
-The POJO is configured in the server dir's jbm-jboss-beans.xml:
-
-<bean name="Dump" class="org.jboss.jms.soak.example.reconnect.ServerDump">
- <constructor>
- <!-- dump interval in minutes -->
- <parameter>1</parameter>
- </constructor>
-</bean>
-
Run The Client
==============
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/ServerInfo.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ServerInfo.java 2009-08-17 16:09:50 UTC (rev 7758)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ServerInfo.java 2009-08-17 16:23:05 UTC (rev 7759)
@@ -23,8 +23,6 @@
package org.jboss.messaging.core.server.impl;
import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryMXBean;
-import java.lang.management.MemoryUsage;
import java.lang.management.ThreadMXBean;
import java.util.Date;
@@ -65,18 +63,19 @@
public String dump()
{
- MemoryMXBean memory = ManagementFactory.getMemoryMXBean();
- MemoryUsage heapMemory = memory.getHeapMemoryUsage();
- MemoryUsage nonHeapMemory = memory.getHeapMemoryUsage();
+ long maxMemory = Runtime.getRuntime().maxMemory();
+ long totalMemory = Runtime.getRuntime().totalMemory();
+ long freeMemory = Runtime.getRuntime().freeMemory();
+ long availableMemory = freeMemory + (maxMemory - totalMemory);
+ double availableMemoryPercent = 100.0 * (double)availableMemory / maxMemory;
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
+
String info = "\n**** Server Dump ****\n";
info += String.format("date: %s\n", new Date());
- info += String.format("heap memory: used=%s, max=%s\n",
- SizeFormatterUtil.sizeof(heapMemory.getUsed()),
- SizeFormatterUtil.sizeof(heapMemory.getMax()));
- info += String.format("non-heap memory: used=%s, max=%s\n",
- SizeFormatterUtil.sizeof(nonHeapMemory.getUsed()),
- SizeFormatterUtil.sizeof(nonHeapMemory.getMax()));
+ info += String.format("free memory: %s\n", SizeFormatterUtil.sizeof(freeMemory));
+ info += String.format("max memory: %s\n", SizeFormatterUtil.sizeof(maxMemory));
+ info += String.format("total memory: %s\n", SizeFormatterUtil.sizeof(totalMemory));
+ info += String.format("available memory: %.2f%%\n", availableMemoryPercent);
info += appendPagingInfos();
info += String.format("# of thread: %d\n", threadMXBean.getThreadCount());
info += String.format("# of conns: %d\n", server.getConnectionCount());
More information about the jboss-cvs-commits
mailing list