开发者

Java heap space Xmx Xms on a vServer with burstable RAM

We run a Minecraft server that relies on Java on a vServer that has 1GB guaranteed RAM and 4GB burstable RAM.

We run Debian 6.0 (Squeeze) Minimal (64Bit) with a lighttpd webserver with php/mySQL alongside the actual Minecraft server. We currently have everything set up to stay within our 1GB guaranteed RAM, but it seems as if we are not taking advantage of the burstable RAM this way, nor do we know how (and if?) we should do so.

We currently have our server loading with the following string:

 /opt/java/jre/bin/java -X开发者_运维问答mx880M -Xms880M
                        -XX:+UseConcMarkSweepGC
                        -XX:+CMSIncrementalPacing
                        -XX:ParallelGCThreads=2
                        -XX:+AggressiveOpts
                        -jar craftbukkit.jar nogui

We allocate 880M for minecraft (we think?), the rest is reserved for the system, webserver etc. How could we optimize this setup? Does it make sense to allocate this inital startup over the 1GB and well into our burstable RAM? Is there a way for Java or the system to handle this themselves, as in allocating more than 880M when it's needed at peak times, with a max of 4GB? Since the burstable RAM isn't guaranteed, what will happen if it's not available when it would need it? Thanks!


How could we optimize this setup?

It depends. You should first profile the memory usage of this process. Add

-verbose:gc:file=gc_results.out

to your command line. You can open the resulting gc datafile with a tool like HPjmeter. You should tune the heap based on average/peak memory usage. There is no one size fits all policy thats 'optimal'. As a start, inspect how much time you're spending in garbage collection on average. A good rule of thumb is < 7%. How often are you triggering a Full GC? Is your heap full of long living objects, or is it being bombarded with lots of short lived objects? These questions should drive your decision making.


A server will spend most of its time taking the maximum RAM allotted. My understanding of "burstable" RAM is--don't count on it, but if you briefly require it it might not crash. In this case, you don't want your JVM hanging on to burstable RAM. The configuration you've specified seems about right.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜