Repository navigation
fix(server): admit queued sessions in arrival order - #150
Merged
Merged
Conversation
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.
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.
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_TIMEOUTwhile 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 onmain. 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.