Repository navigation
Add a thread-pool engine for compute behind a flag - #88
Merged
Merged
Conversation
The plain compute path can now run without Onyx. clojask.engine/run reads batches on its own thread, works them on a fixed pool of num-work threads and hands the results to the caller thread in input order, with at most 2 * num-work + 2 batches in flight. The input is closed through the read function's :close, also when the job fails. Workers realize their batch, so the work stays on the pool threads. The system property clojask.engine, else CLOJASK_ENGINE, selects "onyx" (the default) or "local". Aggregate, group-by and joins still run on Onyx. shutdown-test pins itself to Onyx, since it tests the Onyx environment.
This was referenced Oct 20, 2026
Merged
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.
First stage of replacing Onyx: the plain
computepath (no group-by, aggregate or join) can run on a small in-process engine. Onyx stays the default.What changes
clojask.engine:run: a reader thread splits the input into batches, a fixed pool ofnum-workdaemon threads works them, and the calling thread writes the results in input order.2 * num-work + 2batches are in flight.:close, also when the job fails.start-compute: the compute driver, producing the same rows asworker-func-gen-format.DataFrame.computepicks the engine from the system propertyclojask.engine, else the env varCLOJASK_ENGINE:onyx(default) orlocal. An unknown value throws.shutdown-testpins itself to Onyx with a fixture, since it tests the Onyx environment.Behaviour on
local:orderhas no effect.ExecutionException, now[run stage (compute)] (original error: ...). The cause is the real exception instead of Onyx'sExceptionInfo, and the message no longer points to.clojask/clojask.log.Benchmark
Run on a synthetic 1.8M-row, 160 MB Compustat-like CSV, using the cases from
benchmark/clojure-benchmark.clj(JDK 25, 8 cores). Times are the fastest run, in seconds:localoutput is byte-identical to the input order on the full case.-Xmx96m,localcomputed the whole file correctly in 9.8 s. Onyx hitOutOfMemoryErrorin the embedded ZooKeeper and stalled.Testing
lein test: 52 tests, 198 assertions, 0 failures, on both the default engine andCLOJASK_ENGINE=local.:select, filter + operate, in-memory, melt, a worker exception with:exception true) gave identical results apart from the error message text above.CLOJASK_ENGINE=localleg to the workflow is left for a follow-up.