Have you at any point experienced situation where your applications CPU maximizes and never goes down regardless of the possibility that movement volume goes down? Did you needed to reuse to JVM to remediate the issue? Regardless of the possibility that you reuse the JVM, does your CPU begin to shoot up after some time?
This kind of issue surfaces as a result of one of the accompanying reasons:
Rehashed Full GC
Non-ending Loops
non-synchronized access to java.util.HashMap
How about we perceive how to analyze these situations and address them.
Situation 1: Repeated Full GC
Full GC is an essential period of Garbage Collection handle. Amid this stage, whole JVM is solidified, each and every question in the memory is assessed for rubbish gathering, normally, it ends up being a CPU serious operation. On the off chance that application happens to have memory release, then "Full GC" will begin to run over and again without recovering any memory. At the point when 'Full GC' runs over and over, CPU will begin to shoot up and never descend.
Strategic Solution: To determine the issue totally, memory spill in the application must be settled. Settling memory holes may take some time. (Obviously it's a given, you can connect with specialists like me.to settle it rapidly). Until then underneath said strategic arrangement can be executed to keep the application working underway. You have to instrument a script which would screen rubbish gathering log document of the application for like clockwork. On the off chance that the script sees more than 3 'Full GC' keeps running in a 10-minute window, then that specific JVM ought to be decommissioned from taking creation activity. JVM ought to be reused subsequent to catching string dump and stack dump. Subsequent to reusing JVM ought to be put back to take dynamic activity.
Key Solution: Using the Heap Dump/Thread Dump main driver of the issue ought to be recognized and settled.
Situation 2: non-ending circles
Once in a while because of bug in your code or in the outsider library that you utilize - circle builds (while, for, do.while) may run for eternity. Consider the situation beneath:
Because of specific information condition or bug in the code, "myCondition" may never get fulfilled. In such situation, string would turn vastly in the while circle. This would bring about the CPU to shoot up. Unless JVM is restarted, CPU maximizing wouldn't stop by any stretch of the imagination.
Arrangement: When you watch CPU maximizing and usage not coming go down, you ought to take 2 string dumps in a hole of 10 seconds between each string dump - right when issue is occurring. Each string in "runnable" state in the primary taken string dump ought to be noted down. Same strings state in the second string dump ought to be looked at. In the event that in the second string dump additionally those strings remain the runnable state inside a similar technique, then it would show in which some portion of the code thread(s) are circling unendingly. When you know which some portion of the code is circling boundlessly then it ought to be insignificant to address the issue.
Situation 3: non-synchronized access of java.util.HashMap
At the point when numerous strings tries to get to HashMap's get() and put() APIs simultaneously it would bring about strings go into unending circling. This issue doesn't occur dependably, yet once in a while it does happens.
Arrangement: When you watch CPU maximizing and usage not coming go down, you ought to take a string dump - right when issue is going on. You have to see which are strings that are in "runnable" state. In the event that that string happens to chip away at HashMap's get() or put() API, then it's demonstrative that HashMap is bringing about CPU spike. Presently you can supplant that HashMap with ConcurrentHashMap.
0 comments:
Post a Comment