Repository navigation
perf: one workspace thread by default - #188
Merged
Merged
Conversation
`Workspace` now runs requests on one thread unless given `workers`, and `local()` and `open_folder()` take `workers` and pass it on. A LoKI reduction is already parallel inside (dask, TBB), so more workspace threads slow it down and multiply its peak memory. Four I(Q) reductions take 14.8 s at 8 GB on 1 thread and 20.1 s at 27 GB on 4 threads; through one stage, 7.9 s at 4.7 GB on 1 thread against 7.3 s at 15 GB on 4. The best number depends on the instrument (file sizes, file counts, processing patterns), so an application sets it. Two persistence tests need a second request to run while the first waits, and now ask for two threads. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
5 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Workspaceruns requests on one thread by default (was 4), andlocal()andopen_folder()takeworkersand pass it on.Why. Step 2 of #184 measured real LoKI reductions. The workflow is already parallel inside (dask, TBB), so more workspace threads slow it down and multiply its peak memory:
The best number depends on the instrument (file sizes, file counts, processing patterns), so an application sets it:
What it costs. Requests, the steps of accumulators, and store writes share the threads. On one thread a long reduction holds up a short request, such as masks, until it finishes. Through one stage, eight rows took 12.7–13.2 s on one thread against 11.4–12.0 s on four.
The batch page stays responsive on one thread.
/api/statewhile 8 reductions run in the server's process:Tests. Two persistence tests need a second request to run while the first waits, and now ask for two threads. One of them had passed on one thread only because the blocked request timed out after 5 s. A new test checks that a workspace runs as many requests at once as it has workers.
Not done. The command
essapps-batchhas no option for the number of threads. The demos of the Panel view and the web page use the default, so their fake reductions now run one after another.🤖 Generated with Claude Code