Java very large heap sizes [closed]

2019-01-09 23:07发布

Does anyone have experience with using very large heaps, 12 GB or higher in Java?

  • Does the GC make the program unusable?
  • What GC params do you use?
  • Which JVM, Sun or BEA would be better suited for this?
  • Which platform, Linux or Windows, performs better under such conditions?
  • In the case of Windows is there any performance difference to be had between 64 bit Vista and XP under such high memory loads?

14条回答
地球回转人心会变
2楼-- · 2019-01-09 23:37

The max memory that XP can address is 4 gig(here). So you may not want to use XP for that(use a 64 bit os).

查看更多
冷血范
3楼-- · 2019-01-09 23:38

A couple of years ago, I compared JRockit and the Sun JVM for a 12G heap. JRockit won, and Linux hugepages support made our test run 20% faster. YMMV as our test was very processor/memory intensive and was primarily single-threaded.

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-01-09 23:40

I recommend also considering taking a heap dump and see where memory usage can be improved in your app and analyzing the dump in something such as Eclipse's MAT . There are a few articles on the MAT page on getting started in looking for memory leaks. You can use jmap to obtain the dump with something such as ...

jmap -heap:format=b pid
查看更多
欢心
5楼-- · 2019-01-09 23:41

here's an article on gc FROM one of Java Champions -- http://kirk.blog-city.com/is_your_concurrent_collector_failing_you.htm

Kirk, the author writes "Send me your GC logs

I'm currently interested in studying Sun JVM produced GC logs. Since these logs contain no business relevent information it should be ease concerns about protecting proriatary information. All I ask that with the log you mention the OS, complete version information for the JRE, and any heap/gc related command line switches that you have set. I'd also like to know if you are running Grails/Groovey, JRuby, Scala or something other than or along side Java. The best setting is -Xloggc:. Please be aware that this log does not roll over when it reaches your OS size limit. If I find anything interesting I'll be happy to give you a very quick synopsis in return. "

查看更多
你好瞎i
6楼-- · 2019-01-09 23:43

12Gb should be no problem with a decent JVM implementation such as Sun's Hotspot. I would advice you to use the Concurrent Mark and Sweep colllector ( -XX:+UseConcMarkSweepGC) when using a SUN VM.Otherwies you may face long "stop the world" phases, were all threads are stopped during a GC.

The OS should not make a big difference for the GC performance.

You will need of course a 64 bit OS and a machine with enough physical RAM.

查看更多
干净又极端
7楼-- · 2019-01-09 23:44

We have an application that we allocate 12-16 Gb for but it really only reaches 8-10 during normal operation. We use the Sun JVM (tried IBMs and it was a bit of a disaster but that just might have been ignorance on our part...I have friends that swear by it--that work at IBM). As long as you give your app breathing room, the JVM can handle large heap sizes with not too much GC. Plenty of 'extra' memory is key.
Linux is almost always more stable than Windows and when it is not stable it is a hell of a lot easier to figure out why. Solaris is rock solid as well and you get DTrace too :) With these kind of loads, why on earth would you be using Vista or XP? You are just asking for trouble. We don't do anything fancy with the GC params. We do set the minimum allocation to be equal to the maximum so it is not constantly trying to resize but that is it.

查看更多
登录 后发表回答