Multi threaded for static viz #42496
Labels
.Backend
.Performance
Type:Tech Debt
or Refactoring
Visualization/Static
Subscriptions/pulse generated image
GraalVM can only be multithreaded if each thread creates its own context. Currently, we initialized context once and reuse it across threads(1), (2).
This is not thread-safe, and since we made pulses sent in parallel in #41772, this problem started to surface (thread).
To work around that, we put a lock to
context
whenever we execute a JS function(ref). This fixes the issue, but it creates a bottleneck when rendering static viz as everything become synchronized.Having a context for a thread does not work well because the
static-viz-context
eats 120MiB and takes 1.3 seconds to load. If we have multiple threads, each spawning a context, we'll start seeing a bunch of OOM.Ideally, we should have a resource pool for context, and it'd be even better if this resource pool will auto clean up after some time and only keep one context around.
The text was updated successfully, but these errors were encountered: