romange / helio

A modern framework for backend development based on io_uring Linux interface
Apache License 2.0
447 stars 50 forks source link

chore: improve uring performance #197

Closed romange closed 11 months ago

romange commented 11 months ago
  1. Use io_uring_submit_and_get_events to both submit events and also fetch completions in single syscall.
  2. Make the critical section around blocking I/O command wait_for_cqe as small as possible to increase the chances that another thread will notify the proactor in time. That should decrease the amount of false positives where proactor blocks and then immediately wakes up do to notifications via kernel.
  3. Added an optimization flags for kernels >= 6.0.

Some naive tests showed 5-10% reduction in proactor polling counts.

I also compared this PR (with all the other changes in helio) vs dragonfly v1.13:

run: memtier_benchmark -s 172.31.36.182 --command=PING -t 32 -c 10 -n 300000 --hide-histogram --distinct-client-seed from a 32 cpu machine while running dragonfly on a 8-cpu server (kernel 6.5).

Dragonfly v1.13

==================================================================================================
Type         Ops/sec    Avg. Latency     p50 Latency     p99 Latency   p99.9 Latency       KB/sec
--------------------------------------------------------------------------------------------------
Pings      956341.35         0.33927         0.33500         0.47900         0.59900     19612.47

This PR

==================================================================================================
Type         Ops/sec    Avg. Latency     p50 Latency     p99 Latency   p99.9 Latency       KB/sec
--------------------------------------------------------------------------------------------------
Pings     1063800.96         0.30784         0.30300         0.43900         0.55100     21816.23
codecov-commenter commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (6b3c2c5) 79.29% compared to head (8df1d77) 79.27%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #197 +/- ## ========================================== - Coverage 79.29% 79.27% -0.03% ========================================== Files 100 100 Lines 7507 7511 +4 ========================================== + Hits 5953 5954 +1 - Misses 1554 1557 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.