首页 > Linux操作系统 > Linux操作系统 > Some basic heap sizing problems of ibm jvm

Some basic heap sizing problems of ibm jvm

原创 Linux操作系统 作者:anlinew 时间:2009-03-31 20:40:10 0 删除 编辑


For the majority of applications, the default settings work well. The heap expands until it reaches a steady state, then remains in that state, which should give a heap occupancy (the amount of live data on the heap at any given time) of 70%. At this level, the frequency and pause time of garbage collection should be acceptable.

For some applications, the default settings might not give the best results. Listed here, are some problems that might occur, and some suggested actions that you can take. Use verbosegc to help you monitor the heap.

The frequency of garbage collections is too high until the heap reaches a steady state. Use verbosegc to determine the size of the heap at a steady state and set -Xms to this value. The heap is fully expanded and the occupancy level is greater than 70%. Increase the -Xmx value so that the heap is not more than 70% occupied, but for best performance try to ensure that the heap never pages. The maximum heap size should, if possible, be able to be contained in physical memory. At 70% occupancy the frequency of garbage collections is too great. Change the setting of -Xminf. The default is 0.3, which tries to maintain 30% free space by expanding the heap. A setting of 0.4, for example, increases this free space target to 40%, and reduces the frequency of garbage collections. Pause times are too long. Try using -Xgcpolicy:optavgpause. This reduces the pause times and makes them more consistent when the heap occupancy rises. It does, however, reduce throughput by approximately 5%, although this value varies with different applications.

Here are some useful tips:

  • Ensure that the heap never pages; that is, the maximum heap size must be able to be contained in physical memory.
  • Avoid finalizers. You cannot guarantee when a finalizer will run, and often they cause problems. If you do use finalizers, try to avoid allocating objects in the finalizer method. A verbosegc trace shows whether finalizers are being called.
  • Avoid compaction. A verbosegc trace shows whether compaction is occurring. Compaction is usually caused by requests for large memory allocations. Analyze requests for large memory allocations and avoid them if possible. If they are large arrays, for example, try to split them into smaller arrays.

来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。



  • 博文量
  • 访问量