-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve CPU utilization (~74% -> ~51%) when writing to socket is faster
This improves CPU profile by skipping `read()` calls in Responder when there is no new data in buffer. Was tested with stdin `head -c 1G </dev/urandom | pv -q -L 10000000` which reads 1G file with 10M/s rate limit (1 connection), then exits Before: ``` 141366.582835 task-clock (msec) # 1.318 CPUs utilized 2,830,199 context-switches # 0.020 M/sec 50,323 cpu-migrations # 0.356 K/sec 5,363 page-faults # 0.038 K/sec 476,500,948,484 cycles # 3.371 GHz 340,863,872,685 instructions # 0.72 insn per cycle 72,803,147,450 branches # 514.995 M/sec 2,394,570,464 branch-misses # 3.29% of all branches 107.284806111 seconds time elapsed ``` After: ``` 83205.359732 task-clock (msec) # 0.776 CPUs utilized 279,904 context-switches # 0.003 M/sec 15,297 cpu-migrations # 0.184 K/sec 5,318 page-faults # 0.064 K/sec 79,455,374,201 cycles # 0.955 GHz 44,104,516,695 instructions # 0.56 insn per cycle 9,306,984,820 branches # 111.856 M/sec 452,310,830 branch-misses # 4.86% of all branches 107.261390647 seconds time elapsed ``` Co-authored-by: Aaron Piotrowski <aaron@trowski.com>
- Loading branch information
1 parent
481fc8c
commit 9984b39
Showing
4 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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