High CPU Utilization in java application - why?

前端 未结 6 717
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-29 22:44

I have a Java Application (web-based) that at times shows very high CPU Utilization (almost 90%) for several hours. Linux TOP command shows this. On application res

6条回答
  •  孤街浪徒
    2021-01-29 23:14

    You may be victim of a garbage collection problem.

    When your application requires memory and it's getting low on what it's configured to use the garbage collector will run often which consume a lot of CPU cycles. If it can't collect anything your memory will stay low so it will be run again and again. When you redeploy your application the memory is cleared and the garbage collection won't happen more than required so the CPU utilization stays low until it's full again.

    You should check that there is no possible memory leak in your application and that it's well configured for memory (check the -Xmx parameter, see What does Java option -Xmx stand for?)

    Also, what are you using as web framework? JSF relies a lot on sessions and consumes a lot of memory, consider being stateless at most!

提交回复
热议问题