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

Improve visualization performance through multi-threading #2604

Open
EwoutH opened this issue Jan 9, 2025 · 0 comments
Open

Improve visualization performance through multi-threading #2604

EwoutH opened this issue Jan 9, 2025 · 0 comments

Comments

@EwoutH
Copy link
Member

EwoutH commented Jan 9, 2025

Mesa currently runs model execution and visualization rendering on the same thread, creating performance bottlenecks when running computationally intensive models with multiple visualizations. This impacts responsiveness, especially in Jupyter notebooks. The UI can lag or freeze during model execution since visualization updates block the main thread.

We could improve performance by leveraging Solara's use_thread() functionality to run visualizations on separate threads from model execution. This would allow the model to continue executing while visualizations update asynchronously.

There could be (at least) three threads:

  1. Main thread for model execution
  2. Separate thread for Solara UI/event handling
  3. Worker thread pool for rendering visualizations (plots, space drawings, etc.)

Some key questions to resolve:

  • How to handle thread synchronization between model and vis? (and how much is need? One direction or bi?)
  • Should threading be configurable or always enabled?
  • Thread per component vs shared thread pool?

Next steps would be to prototype basic thread separation, benchmark improvements, and document the threading behavior.

See also:

CC @quaquel @Corvince

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant