Repository navigation
feat(server): phase timings and connection levels (feature op-timing) - #16
Merged
Merged
Conversation
With the op-timing feature the server records, in op_duration_seconds
{component="may_minihttp.server", op, outcome} (microscaler-timing):
- accept_to_first_byte: connection accepted to its first request byte
- read_parse: a request's first byte to the request fully parsed
- service: the service call (err when it fails)
- response_write: the service returned to the response fully written
- request_total: first byte to response fully written
and in op_gauge: open_connections, and on Linux accept_backlog and
accept_backlog_limit, read from TCP_INFO on the listening socket at scrape
time. Together they show whether time a client sees before the
application's own timers is accept queueing, a slow request read, or the
response write. Off by default; without the feature every hook is an
empty inline function.
…argets The connection loop that calls ConnTiming is unix-only, so Windows clippy (-D warnings) saw an unused struct and import.
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.
Adds an optional
op-timingfeature. With it on, the server records its phases inop_duration_seconds{component="may_minihttp.server", op, outcome}(microscaler-timing). A host that renders that family shows them with no wiring.accept_to_first_byteread_parseserviceerron failure)response_writerequest_totalGauges, in
op_gauge:open_connections, plusaccept_backlogandaccept_backlog_limiton Linux. The last two are read at scrape time fromTCP_INFOon the listening socket; for a listener,tcpi_unackedandtcpi_sackedare the accept queue's length and limit.Together these show where time goes that a client sees before the application's own timers start: accept queueing, a slow request read, or the response write.
The feature is off by default, and without it every hook is an empty inline function. With it, each request costs a few
Instant::now()calls and atomic adds, and each connection allocates one smallVec.Test:
tests/server_timing.rs(--features op-timing) covers every op, a failed service call, the gauges, andopen_connectionsreturning to 0 after close. The default-feature server tests and the client lib tests also pass.