title: How to profile swap space with JConsole
body: <p>I've got a Java web app (WAR) deployed to Tomcat on a remote Solaris machine that is throwing IOExceptions claiming "Not enough space". After spending several days painfully researching the issue, I see that I have some process forking going on in my code that requires Solaris to place both parent/child processes in the system swap space, and every now and again there is not enough swap space to contain both processes. <a href="http://wiki.hudson-ci.org/display/HUDSON/IOException+Not+enough+space" rel="nofollow">Here</a> is an article that explains what is happening more eloquently/intelligently than I can. But its definitely the culprit.</p>
  
  <p>So I need to put in a ticket with our systems admin to increase swap space, but I'm stuck trying to figure out how much space I need. I can use JConsole to profile memory usage on the server, but on the <code>VM Summary</code> tab the swap space used/available info seems to only get read when JConsole starts up and does not refresh. This prevents me from using JConsole to see real-time swap usage while I reproduce this forking/memory issue.</p>
  
  <p>The only server monitor I have access to is something called <code>prstat</code> (I'm used to <code>top</code> and <code>nmon</code>).</p>
  
  <p>I need to give systems a specific number (ie. <em>Please increase myserver.net's swap space by 250M</em>, etc.). <strong>How can I obtain this number?</strong> The server is running on Java 1.6u25 so maybe there are some Java tools I'm not aware of, or perhaps some Solaris profilers/monitors I might be able to use.</p>