Repository navigation
morca ui: serve on several workers, and log requests (#539) - #540
Merged
Merged
Conversation
MORCA_UI_WORKERS threads (default the cores up to 4) share one listening socket, so a new connection goes to a free thread instead of queueing behind a slow page. Each request but /healthz and the stylesheet is logged as one line: method, URL, status, ms, client, CF-Connecting-IP, User-Agent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6
A drain on several workers keeps the listening socket until the loop stops, so a UI restarted at once on the same port couldn't bind it (ui_login.sh). Each stack container has its own address, so its UI can run 4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6
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.
Closes #539.
MORCA_UI_WORKERSsets how many threads answer requests (default 1). The Hetzner stack's UI runs 4:morca-stacksets it, and the deploy tools go to 0.35.0. With several workers, the threads share one listening socket (flare'sFLARE_REUSEPORT_WORKERS=0, unless that's set), so a new connection goes to a free thread instead of waiting behind a slow page. On prod, the UI's single thread queued requests for up to 66 s while Postgres stayed under 10 ms./healthzand the stylesheet is logged as one line: method, URL, status, ms, client,CF-Connecting-IP, User-Agent.docs/ui.md.tests/ui_drain.shadds a case on 2 workers: a request is answered while another waits on a lock, SIGTERM still lets the slow request finish, and the request is logged.Tested locally (ouromo):
test-ui-drain,test-ui-login,test-ui,tests/hetzner-version.shok.🤖 Generated with Claude Code
https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6