Scale validation workers to the host, and let callers override it - #2
Open
dionmcm wants to merge 5 commits into
Open
Scale validation workers to the host, and let callers override it#2dionmcm wants to merge 5 commits into
dionmcm wants to merge 5 commits into
Conversation
Keep validation workers supplied with concepts instead of every 10
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.
Branch:
perf/scale-validation-workers· Module:snomed-drools-engineProblem
int threads = concepts.size() == 1 ? 1 : 10;- hardcoded.On a 32-core CI node that leaves 22 cores idle; on a 2-core container it over-subscribes. With the scheduling barrier removed (
perf/rule-executor-rolling-workers) rule execution is CPU bound and scales with cores, so the constant is the limit.Change
Runtime.getRuntime().availableProcessors().setValidationThreads(int)/getValidationThreads()for programmatic control.execute(..., int validationThreads)overload for per-call control; the existing signature delegates to the configured default, so no caller breaks.snomed.drools.validation.threadssystem property for operators.Measured on 8 cores
Halving workers costs 46% and the optimum sits at about the core count, so
availableProcessors()is a sound default. Findings were 10,949 at every setting.These figures were taken with
perf/rule-executor-rolling-workersalso applied. On unmodifiedmastertheworker count is also the size of the batch that
doValidateComponentsbarriers on, so raising it widens the barrier as well as the pool and the benefit is capped. This change stands on its own - a fixed 10 is wrong on any host that isnot a 10-core machine - but it pays fully only once the barrier is gone.
Notes for review
Memory scales with this value:
createKieSessionMapbuilds oneStatelessKieSessionper worker per rule set. On a many-core host running many rule sets, that is the thing to watch, which is why it is overridable downwards as well as upwards.About this series
One of five independent performance changes to the Drools validation path, measured against a real 722,404-concept AU edition Snapshot. Each is a single commit on
master, builds and passes the full suite alone, and leaves the findings byte-identical: 10,949 before and after, with matching report TSVs.Together they take a full-Snapshot validation from 636s to 118s.
This PR and
perf/rule-executor-rolling-workerstouch adjacent lines; whichever merges second needs a one-line rebase. There is no logical dependency and the order does not matter.