From 485ba07697ce114f6b35fd12a1e3938b5c5a1267 Mon Sep 17 00:00:00 2001 From: David Wei Date: Thu, 9 Nov 2023 00:13:27 -0800 Subject: [PATCH] Add CLI arguments for io_uring request batch size and timeout Summary: This diff adds two new io_uring flags for Memcache: * `io_uring_timeout` * `io_uring_batch_size` These will be used later on in this stack for configuring the changes to the Thrift IoUringBackend. Reviewed By: udippant Differential Revision: D50900747 fbshipit-source-id: b192bb233e1292c0c90584251ba398f188bc50eb --- folly/experimental/io/IoUringBackend.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/folly/experimental/io/IoUringBackend.h b/folly/experimental/io/IoUringBackend.h index e629651355e..dd9d7d0659f 100644 --- a/folly/experimental/io/IoUringBackend.h +++ b/folly/experimental/io/IoUringBackend.h @@ -175,6 +175,18 @@ class IoUringBackend : public EventBaseBackendBase { return *this; } + Options& setTimeout(int v) { + timeout = v; + + return *this; + } + + Options& setBatchSize(int v) { + batchSize = v; + + return *this; + } + size_t capacity{256}; size_t minCapacity{0}; size_t maxSubmit{128}; @@ -185,6 +197,13 @@ class IoUringBackend : public EventBaseBackendBase { uint32_t flags{0}; bool taskRunCoop{false}; bool deferTaskRun{false}; + // Maximum amount of time to wait (in microseconds) per io_uring_enter + // Both timeout _and_ batchSize must be set for io_uring_enter wait_nr to be + // set! + int timeout{0}; + // Minimum number of requests (defined as sockets with data to read) to wait + // for per io_uring_enter + int batchSize{0}; std::chrono::milliseconds sqIdle{0}; std::chrono::milliseconds cqIdle{0};