Application Servers Maximum Memory Limit

2019-04-07 21:29发布

问题:

How much memory can a server (Jboss, Tomcat etc...) use? For example if the server has 128gb memory, can it use at least 100gb of it? I'm using these parameters for my local:

-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512

Can these parameters configured for usage of 100gb?

回答1:

We use this to run a 24GB 64-bit JVM with sub-second GC pauses while serving 100+ page requests per second:

-Xms24g -Xmx24g -XX:MaxPermSize=256m -XX:NewRatio=4 -XX:SurvivorRatio=8    
-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+DisableExplicitGC  
-XX:+UseCMSInitiatingOccupancyOnly -XX:+CMSClassUnloadingEnabled  
-XX:+CMSScavengeBeforeRemark -XX:CMSInitiatingOccupancyFraction=68

There shouldn't be any reason you can't specify 100GB if you server has the memory. Since we're using under 32GB we also use -XX:+UseCompressedOops to reduce the overhead of 64-bit addressing. Additionally we use -XX:+UseLargePages for better performance, however you have to enable large page support for your OS first.



回答2:

As Mat said, those huge heaps could get problematic with Garbage Collection, but then with a large heap, you probably are using a multi-core machine, where you can use a collector that basically runs on a core of its own.

Otherwise -Xm accepts a unit of 'g' so you can write -Xmx100g

Manpage for java (on OS X ) says:

On Mac OS X platforms, the upper limit for this value when running in 32-bit mode (-d32) is approximately 2100m minus overhead amounts, and approximately 127t minus overhead amounts when running in 64-bit mode (-d64). On Solaris 7 and Solaris 8 SPARC platforms, the upper limit for this value is approximately 4000m minus overhead amounts. On Solaris 2.6 and x86 platforms, the upper limit is approximately 2000m minus overhead amounts. On Linux platforms, the upper limit is approximately 2000m minus overhead amounts.



回答3:

You'll run into (probably) dramatic GC pauses for that kind of heap size. (Aside from that, I don't know of hard limitations as long as you're running a 64bit VM of course)

Not directly related to your question, but I found this Google TechTalks video on Ehcache interesting - Greg Luck talks about heap size issues in there.