Search code examples
node.jsgarbage-collectionv8

Garbage Collector and concurrent marking in V8


I'm reading about V8 GC here. As this new GC uses workers threads to perform concurrent marking I wonder if the overall performance is better when there is > 1 cpus. Will GC run faster ? Has anyone compared both scenarios ?

My app is not clustered.


Solution

  • Yes, you will only get a speed benefit from concurrent operations (in V8 or elsewhere) if you have more than one CPU core.

    The actual performance impact depends on the specifics of your app, so you'll have to measure it yourself if you want results that actually apply to your case. As a rough guess, I would expect "a couple percent" of overall throughput difference: most of JavaScript is single-threaded, and in most apps garbage collection accounts for about 2-10% of CPU load.