私はJava Webアプリケーションを持っています。JVMがFGCを作成すると、メモリが残っていないため、スワップが使用され、負荷が急速に増加しています。そして、私はその理由を理解できません、誰かが私を助けることができますか?
3 に答える
Either your Java heap size is too low for the working set of data you are processing, or you have a memory leak which is consuming the memory that could otherwise be used for useful processing.
Your first point of attack could be to use a profiler to understand exactly what is consuming memory. JVisualVm is a somewhat bare-bones but competent profiler. From there, you can make decisions about whether you need to allocate more memory (via -Xmx
VM arguments), fix memory leaks, or make algorithmic improvements.
フル GC ロギングを有効にして、ヒープで何が起こっているかを確認できるようにします。
- ライブ データ セット、割り当て率、およびプロモーション率を計算します。これにより、より大きなヒープが必要かどうか、またはたとえば. ヤングゲンが小さすぎる場合、またはサバイバーのスペースがあふれている場合など。
- 合計 GC 時間を計算します。合計実行時間の 5% 未満である必要があります。
使用する-XX:+PrintTenuringDistribution -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=jvm.log -XX:+HeapDumpOnOutOfMemoryError -Xloggc:gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -showversion