Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Want to confirm heap size that tomcat is using

Tags:

java

tomcat

jmap

I'm on ubuntu, and I need to confirm the heap size setting is being used by tomcat.

How can I do that?

I tried jmap but that doesn't seem to be on the server, can I download it individually somehow?

like image 612
codecompleting Avatar asked Dec 21 '11 20:12

codecompleting


People also ask

How do I check my server heap space?

jstat -gccapacity [insert-pid-here] will present information about memory pool generation and space capabilities. jstat -gcutil [insert-pid-here] will present the utilization of each generation as a percentage of its capacity. Useful to get an at a glance view of usage.

What is heap size in Tomcat?

The Tomcat server is run within a Java Virtual Machine (JVM). This JVM that controls the amount of memory available to LabKey Server. LabKey recommends that the Tomcat web application be configured to have a maximum Java Heap size of at least 2GB for a test server, and at least 4GB for a production server.

How do I check my heap usage?

Checking Heap Usage:Sign on to the Weblogic Administration Console by entering the following URL in a browser: http://funoracle.lab:7001/console. Expand your WebLogic domain then expand Servers. Click the server you intend to monitor. Select the Monitoring tab, and the Performance sub-tab.

How do I monitor my heap size?

The easy way to monitor Heap usage is by using a commercial APM (Application Performance management tool) such as CA Wily APM, AppDynamics, New Relic, Riverbed, etc. APM tools not only monitor the heap usage, but you can also configure the tool to Alert you when Heap usage is not normal.


1 Answers

You can do this with jmap, pretty easily.

$ jmap -heap [PID]

For example, first find the PID:

$ ps aux | grep tomcat
user123  61906 ... etc

Then attach to the process with jmap using the -heap option:

$ jmap -heap 61906

This prints the following, quite verbose output in which you should be able to spot whether your settings are being used:

Attaching to process ID 61907, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.80-b11

using parallel threads in the new generation.
using thread-local object allocation.
Concurrent Mark-Sweep GC
Heap Configuration:
   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 25769803776 (24576.0MB)
   NewSize          = 6442450944 (6144.0MB)
   MaxNewSize       = 6442450944 (6144.0MB)
   OldSize          = 12884901888 (12288.0MB)
   NewRatio         = 2
   SurvivorRatio    = 4
   PermSize         = 21757952 (20.75MB)
   MaxPermSize      = 1073741824 (1024.0MB)
   G1HeapRegionSize = 0 (0.0MB)

Heap Usage:
New Generation (Eden + 1 Survivor Space):
   capacity = 5368709120 (5120.0MB)
   used     = 2529188080 (2412.021713256836MB)
   free     = 2839521040 (2707.978286743164MB)
   47.10979908704758% used
Eden Space:
   capacity = 4294967296 (4096.0MB)
   used     = 2525489264 (2408.4942474365234MB)
   free     = 1769478032 (1687.5057525634766MB)
   58.80112908780575% used
From Space:
   capacity = 1073741824 (1024.0MB)
   used     = 3698816 (3.5274658203125MB)
   free     = 1070043008 (1020.4725341796875MB)
   0.3444790840148926% used
To Space:
   capacity = 1073741824 (1024.0MB)
   used     = 0 (0.0MB)
   free     = 1073741824 (1024.0MB)
   0.0% used
concurrent mark-sweep generation:
   capacity = 19327352832 (18432.0MB)
   used     = 10172808584 (9701.546272277832MB)
   free     = 9154544248 (8730.453727722168MB)
   52.63425711956289% used
Perm Generation:
   capacity = 195915776 (186.83984375MB)
   used     = 107975920 (102.97386169433594MB)
   free     = 87939856 (83.86598205566406MB)
   55.11343813374172% used
like image 170
WattsInABox Avatar answered Oct 03 '22 22:10

WattsInABox