apple / apple/foundationdb

Expose API for application to observe network thread hotness

Open
#4,050 1 comment 2 reactions 1 assignee Claimed by @sfc-gh-mpilman View on GitHub
Dominant language
C++
Stars
16.7k
Forks
1.6k
Avg merge
1d 20h
Merged PRs (30d)
126

Description

Especially multi-threaded applications can quite easily use up too much CPU and as a result starve the network thread. An application might be able to do something about this, but currently it is non-trivial to figure out whether the network thread is starving (and it required a lot of knowledge about ryw-transactions).

We would like to have an easy for the client to get a signal. I imagine some API call that would read a global atomic (as we don't want to go through the network thread to do this). I have some ideas how we can define a level of hotness:

1. Sample the time it takes from a task getting queued until it reaches the CPU.
2. Queue lengths are often a good indicator.
3. Whether the main thread ever sleeps - and if it sleeps how long the sleep actually lasts (if you sleep for 0.1 seconds but wake up after 1 second, there's probably a starvation issue...).

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.