haproxy/include/common
Willy Tarreau ed72d82827 MEDIUM: time: measure the time stolen by other threads
The purpose is to detect if threads or processes are competing for the
same CPU. This can happen when threads are incorrectly bound, or after a
reload if the previous process still has an important activity. With
threads this situation is problematic because a preempted thread holding
a lock will block other ones waiting for this lock to be released.

A first attempt consisted in measuring the cumulated lost time more
precisely but the system's scheduler is smart enough to try to limit the
thread preemption rate by mostly context switching during poll()'s blank
periods, so most of the time lost is not seen. In essence this is good
because it means a thread is not preempted with a lock held, and even
regarding the rendez-vous point it cannot prevent the other ones from
making progress. But still it happens tens to hundreds of times per
second that a thread might be preempted, so it's still possible to detect
that the situation is happening, thus it's interesting to measure and
report its frequency.

Each time we enter the poller, we check the CPU time spent working and
see if we've lost time doing something else. To limit false positives,
we're only interested in losses of 500 microseconds or more (i.e. half
a clock tick on a 1 kHz system). If so, it indicates that some time was
stolen by another thread or process. Note that we purposely store some
sub-millisecond counters so that under heavy traffic with a 1 kHz clock,
it's still possible to measure something without being subject to the
risk of rounding errors (i.e. if exactly 1 ms is stolen it's possible
that the time difference could often be slightly lower).

This counter of lost CPU time slots time is reported in "show activity"
in numbers of milliseconds of CPU lost per second, per 15s, and total
over the process' life. By definition, the per-second counter cannot
report values larger than 1000 per thread per second and the 15s one
will be limited to 15000/s in the worst case, but it's possible that
peak values exceed such thresholds after long pauses.
2018-10-19 08:51:59 +02:00
..
accept4.h
base64.h
buf.h BUG/MEDIUM: buffers: Make sure we don't wrap in ci_insert_line2/b_rep_blk. 2018-10-08 16:11:54 +02:00
buffer.h MEDIUM: pools: implement a thread-local cache for pool entries 2018-10-16 13:46:08 +02:00
cfgparse.h MINOR: Some spelling cleanup in the comments. 2018-06-21 20:43:52 +02:00
chunk.h MINOR: chunk: add chunk_cpy() and chunk_cat() 2018-10-12 16:58:01 +02:00
compat.h BUILD: tcp: define SOL_TCP when only IPPROTO_TCP exists 2016-08-10 21:11:38 +02:00
compiler.h BUILD: compiler: add a new statement "__unreachable()" 2018-10-15 13:24:43 +02:00
config.h MINOR: fd: centralize poll timeout computation in compute_poll_timeout() 2018-10-17 19:59:43 +02:00
debug.h
defaults.h MEDIUM: ssl: add support for ciphersuites option for TLSv1.3 2018-10-08 19:20:13 +02:00
epoll.h
errors.h
h2.h MINOR: h2: detect presence of CONNECT and/or content-length 2018-04-26 10:15:14 +02:00
hash.h MINOR: hash: add new function hash_crc32c 2018-03-21 05:04:01 +01:00
hathreads.h BUG/MINOR: threads: move declaration of capabilities to config.h 2018-10-10 18:29:23 +02:00
hpack-dec.h MAJOR: chunks: replace struct chunk with struct buffer 2018-07-19 16:23:43 +02:00
hpack-enc.h MAJOR: chunks: replace struct chunk with struct buffer 2018-07-19 16:23:43 +02:00
hpack-huff.h MINOR: hpack: implement the HPACK Huffman table decoder 2017-10-31 18:03:24 +01:00
hpack-tbl.h BUG/CRITICAL: hpack: fix improper sign check on the header index value 2018-09-20 11:45:56 +02:00
http-hdr.h MINOR: http: add http_hdr_del() to remove a header from a list 2018-09-14 17:40:35 +02:00
http.h MINOR: http: Move comment about some HTTP macros in the right header file 2018-10-12 16:00:24 +02:00
ist.h MINOR: ist: Add the function isteqi 2018-07-20 13:39:30 +02:00
istbuf.h MINOR: buffer: rename the data length member to '->data' 2018-07-19 16:23:43 +02:00
memory.h BUILD: memory: fix pointer declaration for atomic CAS 2018-10-18 16:12:28 +02:00
mini-clist.h MEDIUM: lists: list_for_each_entry{_safe}_from functions 2017-10-31 03:44:11 +01:00
namespace.h
net_helper.h MINOR: net_helper: add 64-bit read/write functions 2017-09-21 06:27:08 +02:00
regex.h MINOR: threads/regex: Change Regex trash buffer into a thread local variable 2017-10-31 13:58:31 +01:00
splice.h
standard.h MINOR: tools: add a new function atleast2() to test masks for more than 1 bit 2018-10-15 13:25:06 +02:00
syscall.h
template.h
ticks.h
time.h MEDIUM: time: measure the time stolen by other threads 2018-10-19 08:51:59 +02:00
tools.h
uri_auth.h
version.h [RELEASE] Released version 1.9-dev0 2017-11-26 19:50:17 +01:00
xref.h MEDIUM: threads/xref: Convert xref function to a thread safe model 2017-10-31 13:58:32 +01:00