ram
ram

Reputation: 1169

Spring app consumes all CPU and then crashes

I have a Spring application that has been recently moved from test to production environment. CPU usage is %2-3 most of the time. But sometimes (1 or 2 times per day) it suddenly peaks up to %400 (there are 4 cpus) and then my app crashes. I could not observe any kind of anomalies (e.g. extra traffic) when the problem occurred.

Some information about my app is,

I could not find the reason of the problem. Are there any suggestions? Any kind of help is appreciated.

Upvotes: 3

Views: 2522

Answers (1)

ram
ram

Reputation: 1169

As the invaluable comments indicate, this problem does not originate from garbage collection. The reason is something totally different. It took about a week to figure it out, so I am writing it to here in case some other people face with the same problem.

First of all, I did not include in the question (since I did not consider it as important) that I used JHipster, which recently switched to Undertow as the application server.

After digging into the details, I observed that the threads that consume the CPU are XNIO threads. I have seen on a few sites that some people using application servers powered by XNIO also suffer from the same problem. Since Undertow uses XNIO, I changed from Undertow to Tomcat, and the problem is resolved.

Upvotes: 4

Related Questions