Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi threaded for static viz #42496

Open
qnkhuat opened this issue May 10, 2024 · 0 comments
Open

Multi threaded for static viz #42496

qnkhuat opened this issue May 10, 2024 · 0 comments
Labels
.Backend .Performance Type:Tech Debt or Refactoring Visualization/Static Subscriptions/pulse generated image

Comments

@qnkhuat
Copy link
Contributor

qnkhuat commented May 10, 2024

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 tocontext 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.

@qnkhuat qnkhuat added Type:Tech Debt or Refactoring .Performance .Backend Visualization/Static Subscriptions/pulse generated image labels May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.Backend .Performance Type:Tech Debt or Refactoring Visualization/Static Subscriptions/pulse generated image
Projects
None yet
Development

No branches or pull requests

1 participant