java - JVM Garbage Collector suddenly consumes 100% CPU after running for several hours -


i've got strange problem in clojure app.

i'm using http-kit write websocket based chat application.

client's rendered using react single page app, first thing when navigate home page (after signing in) create websocket receive things real-time updates , chat messages. can see site here: www.csgoteamfinder.com

the problem have after indeterminate amount of time, might 30 minutes after restart or 48 hours, jvm running chat server starts consuming cpu. when inspect nr (new relic) can see time being used garbage collector -- @ stage have no idea it's doing.

i've take number of screenshots can see effect.

new relic showing memory usage on 7 day period

more new relic statistics

you can see number of spikes, spikes correspond large increases in cpu usage because of garbage collector. free cpu have restart jvm, have been relying on receiving cpu alert nr in slack account make sure jump on these quickly....but need root of problem.

my initial thought was possibly holding onto socket reference when client closed @ end, not case. i've been looking @ socket count periodically , stable.

any ideas of start?

kind regards, jason.

it's hard imagine have caused such issue. @ first taking heap dump @ time of crash. can enabled -xx:+heapdumponoutofmemoryerror -xx:heapdumppath=<path_to_your_heap_dump> jvm args. as general practice don't increase heap size more size of physical memory available on server machine. in rare cases jvm unable dump heap space because process doomed; in such cases can use gcore(if you're on linux, not sure windows).

once grab heap dump, analyse mat, have debugged such applications , worked pin down memory related issues. mat allows dissect heap dump in depth you're sure find cause of memory issue if not case have allocated small heap space.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -