running a Java VM

If I where to buy a Plan and wanted to tun java , I would need at least 128MB of ram to keep from running out of memory right?

3 Replies

That would depend entirely on what you used as the argument to -Xmx, and what other options you used to pare back on memory use.

@Tarasso:

If I where to buy a Plan and wanted to tun java , I would need at least 128MB of ram to keep from running out of memory right?

Sort of,

We've been running Tomcat on a Linode for a while now, and even though we have a 128Mb linode system, and have restricted Tomcat to only use only 40Mb of memory with the following line in /etc/profile

export CATALINA_OPTS="-Xint -Xrs -Xmx40m -Xverify:none -XX:+UseParallelGC"

The Tomcat process grows to consume more than 100Mb of memory (see RSS in a snapshot of TOP below).

===============================================

04:31:31 up 119 days, 8:21, 1 user, load average: 0.55, 0.15, 0.04

86 processes: 83 sleeping, 3 running, 0 zombie, 0 stopped

CPU states: 62.3% user, 4.7% system, 0.0% nice, 33.0% idle

Mem: 123640K total, 121304K used, 2336K free, 2140K buffers

Swap: 263160K total, 12260K used, 250900K free, 53344K cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND

13440 root 9 0 103M 100M 54140 S 0.0 83.3 0:09 java

13442 root 9 0 103M 100M 54140 S 0.0 83.3 0:00 java

13443 root 9 0 103M 100M 54140 S 3.9 83.3 0:01 java

13444 root 9 0 103M 100M 54140 S 3.7 83.3 0:01 java

===============================================

Why is this so? It's due to the fact that -Xmx only restricts the "heap" size used by your java program, not the memory that the JVM will use as well (such as stack / hotspot compiling and anything else it needs).

If you are running short duration processes, that don't need a lot of memory, you should be fine. We run a webserver, 24/7, that is lightly loaded, and are running fine. But due to the problem above (the JVM using a large chunk of our available 128Mb of memory) we dangerously drift into using swap space. This is one of the main reasons we are looking to upgrade by another 64 / 128Mb this year - to help minimize swap space usage.

@amcghe:

Why is this so? It's due to the fact that -Xmx only restricts the "heap" size used by your java program, not the memory that the JVM will use as well (such as stack / hotspot compiling and anything else it needs).
I've found that the JVM "respects" the -Xmx switch much better when using the -client VM (instead of the -server VM). This is of course due to the fact that it doesn't store as much precompiled code in memory.

I'm also on 128MB and it works pretty well, except for some issues with the mod_jk2 connector or (what it seems like) Tomcat itself suddenly doubling or tripling the memory usage in very short time. Those are probably bugs, but I've yet failed to isolate them.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct