Skip to content

fix(server): admit queued sessions in arrival order - #150

Merged
mbroton merged 2 commits into
mainfrom
fix/fifo-admission-queue
Nov 12, 2026
Merged

mbroton merged 2 commits into
mainfrom
fix/fifo-admission-queue

Conversation

@mbroton

@mbroton mbroton commented Nov 12, 2026

Copy link
Copy Markdown
Owner

When all slots were busy, queued sessions did not get slots in arrival order. A new request could take a free slot before the requests that already waited, and each free slot woke all waiters, which then raced for it. Under overload, most sessions got a slot fast, but some lost the race many times. Some reached QUEUE_WAIT_TIMEOUT while later requests succeeded.

Now each server replica keeps one first-in-first-out line for each browser and Playwright version. A new request waits behind earlier requests, and a free slot goes to the first waiter in the line. Requests for other browsers or versions do not block each other. There is no change to the configuration or the API. The docs now describe the order.

Verification: go test ./..., with new order tests that fail on main. In a closed-loop load test (32 clients, 6 slots), p99 session time went from 26.7 s to 6.4 s, with the same throughput and no queue timeouts.

Queued requests for the same browser and Playwright version now get slots in arrival order on each server replica. A new request waits behind earlier requests, and a capacity change wakes only the first waiter in each line.
@mbroton
mbroton merged commit fd11992 into main Nov 12, 2026
8 checks passed
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