Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding memory usage for Jetty

Tags:

java

memory

jetty

I have a Jetty server that I use for websocket connections for an app I am working on. The only issue is that Jetty is consuming way too much virtual memory (!2.5GB of virtual memory) and around 650RES.

My issue is that as mentioned above, most of the memory (around 12gb) is not the heap size so analyzing it and understanding what is happening is harder.

Do you have any tips on how to understand where the 12gb consumption is coming from and how to figure out memory leaks or any other issues with the server?

I wanted to clerify what I mean by virtual memory (because my understanding could be wrong). Virtual memory is "VIRT" when I run top. Here is what I get:

PID USER PR  NI  VIRT  RES  SHR S   %CPU %MEM  TIME+  COMMAND                                        
-------------------------------------------------------------                                        
9442 root 20 0   12.6g 603m  10m S   0    1.3   1:50.06 java

Thanks!

like image 691
user220755 Avatar asked Jan 23 '13 21:01

user220755


1 Answers

Please paste the JVM Options you use on startup. You can adjust the maximum memory used by the JVM with the -Xmx option as already mentioned.

Your application has been using only 603MB reserved memory. So doesn't look like it should concern you. You can get some detailed information about memory usage by either using "jmap", enable jmx and connect via jconsole or use a profiler. If you want to stay in *nix land you can also try "free" if your OS supports it.

In your case Jetty is NOT occupying 12,5 gig of memory. It's occupying 603MB. Google for "virtual memory linux" for example and you should get plenty of information about the difference between virtual and reserved memory.

like image 109
Thomas Becker Avatar answered Oct 27 '22 21:10

Thomas Becker