Skip to content

perf: cut the solver time limit to 10s - #116

Merged
andig merged 1 commit into
mainfrom
perf/lower-time-limit
Jul 25, 2026
Merged

perf: cut the solver time limit to 10s#116
andig merged 1 commit into
mainfrom
perf/lower-time-limit

Conversation

@andig

@andig andig commented Jul 25, 2026

Copy link
Copy Markdown
Member

Cuts the solver time limit from 20 s (Azure) / 25 s (image default) to 10 s.

Why

Requests that exhaust the limit are not requests that are closing a gap — they walk a cost
optimal plateau until the clock runs out. Every second past the last incumbent improvement is
tail latency and a held core on a CPU bound, one vCPU replica.

Measurement

20 requests sampled from the 729 slow requests collected in production (all of them had
exhausted the 20 s limit there), replayed with OPTIMIZER_NUM_THREADS=1 like production, one
solve at a time so no run steals CPU from another. The objective is maximized, so a negative
gap is a worse schedule.

limit vs 20 s same objective better worse worst case
10 s 17/20 2 1 −4.68 %

The two "better" cases are search path luck, not a systematic win: +0.24 % and +0.13 %.

A 60 s reference over the same sample puts 20 s within 0.37 % of it, so 20 s is not the optimum
either — both limits stop on the plateau, only at different points.

Sweeping the one regressing case plus the two noisy ones across more limits shows where the
cost sits:

limit 10 s 12 s 15 s 18 s 20 s
objective 4.3303 4.3303 4.5432 4.5432 4.5432

That case finds its better incumbent between 12 s and 15 s. 15 s would be the loss free
setting
on this sample; 10 s buys another 5 s of latency for a −4.7 % schedule on roughly one
in twenty slow requests. Slow requests are about 2 % of traffic, so that is on the order of
0.1 % of all requests. Flip the value if that trade is not worth it.

Also

The dump threshold is the time limit itself, so /tmp/slow-requests.jsonl now collects
everything above 10 s instead of above 20 s — more lines per replica, still ephemeral.

Reproduce with the collected log: sample requests from slow-requests.jsonl (see make slow),
POST each to /optimize/charge-schedule with OPTIMIZER_TIME_LIMIT set per run and compare
objective_value.

Requests that exhaust the limit walk a cost optimal plateau instead of closing
a gap. Replaying 20 of the slow requests collected in production, 17 end on the
same objective at 10s as at 20s, two end marginally better and one ends 4.7
percent worse. Halving the limit halves the latency and the core those requests
hold on a one vCPU replica.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@andig
andig merged commit d624b66 into main Jul 25, 2026
1 check passed
@andig
andig deleted the perf/lower-time-limit branch July 25, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant