Search code examples
javascriptmultithreadingbrowserweb-workeroverhead

Web Worker overhead metrics


I'm working on a project that may require multiple web workers and I need to know whether it's affordable to have multiple operating at the same time (as in more than 4 or 8 workers) and what the cost is in both cpu and ram to start them up and have them lingering.

I've been googling and searching but I haven't found any metrics on their cpu and memory overhead. I've found some benchmarks for performance, but that's not what I'm interested in.

Can anyone point me to either a spec or study that gives at least approximate values? I need to at least have some ballpark values to work with, rather than just assume whatever I see from Process Explorer is accurate or reliable.

edit - It seems people are getting the wrong impression. I'm not asking for advice on how to solve a problem but sources of technical information on web worker overhead, if they exist.


Solution

  • The Workers API spawns real OS threads, so a lot of that performance bottleneck might not even be at the browser level.

    Understandably, you still want metrics to see how much overhead a browser adds. You're either on your own if you want objective results.

    Some blog posts might give you a good starting point: https://hacks.mozilla.org/2015/07/how-fast-are-web-workers/

    (EDIT: actually keep reading the link, and you'll find he has open-sourced the metric tooling used for the blog post: https://github.com/gmarty/web-workers-benchmark)