Skip to content

perf(http): CLOCK_MONOTONIC_COARSE for the classic header-read budget - #373

Closed
gg582 wants to merge 1 commit into
devfrom
perf/epoll-syscall-trim
Closed

gg582 wants to merge 1 commit into
devfrom
perf/epoll-syscall-trim

Conversation

@gg582

@gg582 gg582 commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

The classic pool's header-read loop calls clock_gettime every poll slice; CLOCK_MONOTONIC_COARSE (vDSO, ~4 ms granularity) removes that syscall against a 120 s budget.

Scope was reduced during rebase: dev's RX-epoll path (epoll_register with fd-state MOD-first hints) already trims the re-arm syscall, and no per-accept setsockopt duplication exists. Measured end-to-end delta is below noise; the win is one fewer syscall per idle poll slice.

RPS (avg of 3) p50 p99
before 314,166 0.335 ms 4.234 ms
after 313,433 0.336 ms 4.232 ms

Re-arm trimming and setsockopt dedup were dropped: dev's RX-epoll path
(epoll_register, epoll_fd_state) already issues EPOLL_CTL_MOD directly,
and each accept path sets TCP_NODELAY exactly once. The fcntl pair stays:
cwist_http_pool_submit_async is a public API that blocking fds reach.
@gg582
gg582 force-pushed the perf/epoll-syscall-trim branch from cffe976 to fe131b6 Compare October 13, 2026 13:27
@gg582 gg582 changed the title perf(epoll): trim per-request syscalls perf(http): CLOCK_MONOTONIC_COARSE for the classic header-read budget Oct 13, 2026
@gg582

gg582 commented Oct 13, 2026

Copy link
Copy Markdown
Member Author

Closing: CLOCK_MONOTONIC is already vDSO-served on Linux, so COARSE saves tens of nanoseconds per poll slice, and the classic blocking pool this touches is not exercised by the benchmark harness (default async/io_uring). No measurable effect; the re-arm optimization this PR originally proposed is already covered by dev's RX-epoll path (epoll_register, 0fd8c21).

@gg582 gg582 closed this Oct 13, 2026
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