Linux configurations that would affect Java memory usage?
- by wmacura
Hi,
Background:
I have a set of java background workers I start as part of my webapp. I develop locally on Ubuntu 10.10 and deploy to an Ubuntu 10.04LTS server (a media temple (ve) instance).
They're both running the same JVM: Sun JVM 1.6.0_22-b04. As part of the initialization script each worker is started with explicit Xmx, Xms, and XX:MaxPermGen settings.
Yet somehow locally all 10 workers use 250MB, while on the server they use more than 2.7GB.
I don't know how to begin to track this down. I thought the Ubuntu (and thus, kernel) version might make a difference, but I tried an old 10.04 VM and it behaves as expected.
I've noticed that the machine does not seem to ever use memory for buffer or cache (according to htop), which seems a bit strange, but perhaps normal for a server?
(edited)
Some info:
(server)
root@devel:/app/axir/target# uname -a
Linux devel 2.6.18-028stab069.5 #1 SMP Tue May 18 17:26:16 MSD 2010 x86_64 GNU/Linux
(local)
wiktor@beastie:~$ uname -a
Linux beastie 2.6.35-25-generic #44-Ubuntu SMP Fri Jan 21 17:40:44 UTC 2011 x86_64 GNU/Linux
(edited)
Comparing PS output: (ps -eo "ppid,pid,cmd,rss,sz,vsz")
PPID PID CMD RSS SZ VSZ
(local)
1588 1615 java -cp axir-distribution. 25484 234382 937528
1615 1631 java -cp /home/wiktor/Code/ 83472 163059 652236
1615 1657 java -cp /home/wiktor/Code/ 70624 89135 356540
1615 1658 java -cp /home/wiktor/Code/ 37652 77625 310500
1615 1669 java -cp /home/wiktor/Code/ 38096 77733 310932
1615 1675 java -cp /home/wiktor/Code/ 37420 61395 245580
1615 1684 java -cp /home/wiktor/Code/ 38000 77736 310944
1615 1703 java -cp /home/wiktor/Code/ 39180 78060 312240
1615 1712 java -cp /home/wiktor/Code/ 38488 93882 375528
1615 1719 java -cp /home/wiktor/Code/ 38312 77874 311496
1615 1726 java -cp /home/wiktor/Code/ 38656 77958 311832
1615 1727 java -cp /home/wiktor/Code/ 78016 89429 357716
(server)
22522 23560 java -cp axir-distribution. 24860 285196 1140784
23560 23585 java -cp /app/axir/target/a 100764 161629 646516
23560 23667 java -cp /app/axir/target/a 72408 92682 370728
23560 23670 java -cp /app/axir/target/a 39948 97671 390684
23560 23674 java -cp /app/axir/target/a 40140 81586 326344
23560 23739 java -cp /app/axir/target/a 39688 81542 326168
They look very similar. In fact, the question now is why, if I add up the virtual memory usage on the server (3.2GB) does it more closely reflect 2.4GB of memory used (according to free), yet locally the virtual memory used adds up to a much more substantial 4.7GB but only actually uses ~250MB. It seems that perhaps memory isn't being shared as aggressively. (if that's even possible)
Thank you for your help,
Wiktor