Suggestions for reducing unnecessary Scavenge Garbage Collector calls, since GC is blocking code quite many times. #5032
|
Hi there, Looks like Scavenge GC calls are pretty fast and occurs more often than mark sweep, however, more number of GC calls made by Scavenge is blocking the code. After some research, I could understand that scavenge GC is called when max semi space allocated exceeds. I believe lesser memory allocations would less often call GC. Regarding Application: Would like to know any suggestions, like How to reduce unnecessary memory allocations, optimising loops where objects created in loop might be responsible for high memory raise, etc etc.. On Side Note,
Is it a known fact that under excessive loadtesting of server, memory does increase and very often GC calls happen? |
Replies: 0 comments 9 replies
|
You don't know at this point how much CPU time is spent inside the garbage collector so my suggestion is to profile your application first. |
|
Hi @bnoordhuis after cpu profiling (from browser dev tools and running node with Looks like GC took around 1 second cpu time. I wonder if these results are per requests or cumulative time for all 5k requests during the course of run. Can I say that GC is not effecting the application performance badly and is negligible.? |
|
@bnoordhuis please refer to below images, looks like gc is using high cpu % (around 65%+ too recorded), and high gc is recorded when server has no load, is it because server has no load, max time appears to be spend on gc than processing requests and hence higher cpu %? Is it because of mark sweep run ? The results captured are after load testing and i could observe mark sweep was run (using gc-stats npm module). Just what to confirm ok, since it would be just a spike during profiling was done? |
|
@mai1x9 You marked one of your questions as the answer but, for the benefit of people coming here from search engines, you probably want to pick one of my replies. |




You don't know at this point how much CPU time is spent inside the garbage collector so my suggestion is to profile your application first.