envoyproxy / envoyproxy/nighthawk

idea: memorizing details for top x latency measurements

Open
#347 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
414
Forks
95
Avg merge
2d 9h
Merged PRs (30d)
11

Description

As an opt-in feature, we could add a ringbuffer per worker for holding more information regarding the requests that saw the top x highest latency replies. This information should be useful for correlating high latency in time, across connections, and pools(workers).

It seems that a way to do this might be fairly simple:

- We take a `std::queue` which will serve as the backing store.
- When a latency measurement is sampled; push it into the queue iff its value is equal
to or higher then the head of the queue
- trim the back of the queue to our desired maximum queue length

Each entry in the ringbuffer stores these fields:

- request time
- reply time
- connection # (if we can easily can get to this with the current state)
- worker nr
- maybe allow storing (a selection of) request/reply information. E.g. it might be useful to
allow storing the value of a selected response field

As it will be known what needs to be stored up front, pre-allocation of memory could be used to avoid allocations in the hot path. Inserts/removals should be fast operations as all operations only involve the front and back of the queue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.