|
|
|
Back to newsletter 136 contents
A long time ago, the first recommendation for initial heap size setting was that ms (starting/initial heap size) should be small, e.g. 4MB, and the mx (maximum heap size) should be big enough to avoid an out-of-memory error. This was intended to allow the heap to naturally grow to whatever it needed, then stabilize at some optimal value. Then after observing typical heap activities people started saying there was no point in having an ms different from mx, you should work out what you need and just set both to be the same, that way your application avoided any overhead in growing the heap to what it would need eventually anyway.
Then came more sophisticated GC algorithms and a new suggestion, that ms should be just above the steady-state working memory requirement of the heap, while mx should be (as always) big enough to avoid the out-of-memory error that may otherwise be caused from memory requirements occasionally spiking (a rule of thumb mentioned was to start with ms at half mx, then see where your steady-state was). Some people clung to the "ms should be the same as mx" point of view regardless, saying the heap would stabilize within that anyway. Then we got ergonomic garbage collection algorithms which could vary the maximum heap size dynamically according to it's internal heuristics, and we were told that we shouldn't set ms to mx because this defeated the ergonomics.
The situation right now is that we have a proliferation of different garbage collectors and it's not at all clear whether there is any general recommendation for initial heap size compared to maximum heap size. I'm not certain myself any more. So I thought the best thing I could do is ask you - seeing as you include a majority of the very top Java performance people in the world. So, if you have any idea whether there is a current good recommendation for initial heap size, I'd love to hear it and why. Of course I'll report back next month as to whether there is any kind of consensus or interesting comments.
Now on to all our usual links to Java performance tools, news, articles, and the extracted tips from all of this month's referenced articles.
Java performance tuning related news.
Java performance tuning related tools.
Back to newsletter 136 contents