Skip to content

Commit

Permalink
folly: io_uring: add USDTs to IoUringBackend for request batching obs…
Browse files Browse the repository at this point in the history
…ervability

Summary: Need to add some observability to `IoUringBackend` in order to tune the parameters `batchSize` and `timeout`. Opted for USDTs as opposed to other telemetry since this is service agnostic. My objective is to use managed `bpftrace` to hook into these.

Reviewed By: yfeldblum

Differential Revision: D60093255

fbshipit-source-id: c313891f9b17325e4b493efc4dddf8ce18339259
  • Loading branch information
spikeh authored and facebook-github-bot committed Jul 23, 2024
1 parent c137ce3 commit 6116f52
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions folly/io/async/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@ cpp_library(
"//folly/portability:sys_mman",
"//folly/portability:sys_syscall",
"//folly/synchronization:call_once",
"//folly/tracing:static_tracepoint",
],
exported_deps = [
"//folly:c_portability",
Expand Down
16 changes: 16 additions & 0 deletions folly/io/async/IoUringBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <folly/portability/SysMman.h>
#include <folly/portability/SysSyscall.h>
#include <folly/synchronization/CallOnce.h>
#include <folly/tracing/StaticTracepoint.h>

#if __has_include(<sys/timerfd.h>)
#include <sys/timerfd.h>
Expand Down Expand Up @@ -1583,6 +1584,14 @@ unsigned int IoUringBackend::internalProcessCqe(
} while (true);
numInsertedEvents_ -= (count - count_more);
numSendEvents_ -= count_send;
FOLLY_SDT(
folly,
folly_io_uring_backend_post_process_all_cqes,
count,
count_more,
count_send,
numInsertedEvents_,
numSendEvents_);
return count;
}

Expand Down Expand Up @@ -1623,6 +1632,13 @@ int IoUringBackend::submitBusyCheck(
options_.batchSize + numSendEvents_,
&timeout,
nullptr);
FOLLY_SDT(
folly,
folly_io_uring_backend_pre_submit_and_wait_timeout,
options_.timeout,
options_.batchSize,
numSendEvents_,
res);
} else {
res = ::io_uring_submit_and_wait(&ioRing_, 1);
}
Expand Down

0 comments on commit 6116f52

Please sign in to comment.