Repository navigation
perf: one compile for identical jobs, output modes, configurable pools and latency alerts - #135
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 35 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Base automatically changed from
perf/stage-metrics-and-latency
to
development
November 2, 2026 13:04
…figurable pools and latency alerts
Shreesh-Sree
force-pushed
the
perf/singleflight-output-and-writes
branch
from
November 2, 2026 13:04
bea2c9e to
d764a2a
Compare
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.
Stacked on #134 (this branch contains its commits; review only the last commit).
One compile for the same source
The compile cache was a plain map with no request coalescing, so jobs with the same source that arrived together each started their own compile and the cache only helped the ones that came after. The Platform's judge sends one job per test, so N tests of one submission meant N simultaneous compiles of the same file.
Now the first job compiles and the others wait for it (a waiter gives up if its own context ends):
outputmodePOST /api/v1/executeacceptsoutput:full(default, unchanged),preview(256-byte previews only) ornone. Full stdout and stderr, up to 8 MB per test, otherwise go through Redis, the event log, every SSE client and the webhook. Stored with the job; absent on older jobs, which meanfull.Pools and alerts
AC_DB_MAX_CONNS,AC_REDIS_POOL_SIZE,AC_REDIS_MIN_IDLE_CONNS(defaults 128, 256, 32, as before), validated. Ingest can use 512 database connections at once, so the README says to raise the pool first under heavy submission traffic.Considered and dropped
Overlapping the status write with its event publish (COMPILING, RUNNING). It saves a sub-millisecond Redis round trip and could publish an event for a job whose verdict another worker has just written; not worth it.
Testing
go vetclean;go test -race ./...passes exceptinternal/db(needs Docker; fails the same way ondevelopment). New tests: shared compile across 20 concurrent callers, shared compile failure, transient-error retry, a waiter's context, TTL 0, output modes, queue round trip, gateway rejection of a bad mode, pool-size validation. The alert expressions were not run against Prometheus (promtoolis not installed here).Summary by cubic
Shares one compile across jobs with the same source, language, files, and flags that arrive together, so the Platform's judge (one job per test of the same submission) no longer starts N simultaneous compiles of the same file. Also adds an
outputmode toPOST /api/v1/executeso callers that only need verdicts can keep bulk stdout and stderr out of Redis, the event log, SSE, and webhooks, makes database and Redis pool sizes configurable, and adds Prometheus latency alerts.outputacceptsfull(default),preview(256-byte previews only), ornone; jobs enqueued before this change lack the field and behave asfull.AC_DB_MAX_CONNS(default 128),AC_REDIS_POOL_SIZE(256), andAC_REDIS_MIN_IDLE_CONNS(32) are validated; the database connect path also rejects a pool size outside 4–2000, so a bad value fails at startup. The README advises raising the DB pool first because ingest can use 512 connections at once.Written for commit d764a2a. Summary will update on new commits.