diff options
author | kulikov <kulikov@yandex-team.com> | 2023-07-21 13:59:33 +0300 |
---|---|---|
committer | kulikov <kulikov@yandex-team.com> | 2023-07-21 13:59:33 +0300 |
commit | 5706cb392271ea40eab053314e7c0f4d9d4547ba (patch) | |
tree | 72bce210dc3747df1d9319fc9f56b848852d2aab /library/cpp/http/server/options.h | |
parent | 122a6055cef2bc785407c69b33b858a07b319e66 (diff) | |
download | ydb-5706cb392271ea40eab053314e7c0f4d9d4547ba.tar.gz |
try to get rid of locks and allocations for elastic queue thread pool
In case of heavy load and high rps current thread pool implementation seems to have problems at least with contention on lock inside condvar (long futex wait calls from http server listener thread), so try to implement something more efficient:
- replace condvar with TEventCounter implementation without internal lock (pthread condvar maintains waiters wakeup order, thread pool doesn't need it);
- introduce well-known bounded mpmc queue over ring buffer;
- get rid of TDecrementingWrapper;
- add options to turn on new pool in library/cpp/http/server and search/daemons (will remove after adoption);
- make elastic queue ut check both versions;
- workaround problems with android/arm build targets.
Diffstat (limited to 'library/cpp/http/server/options.h')
-rw-r--r-- | library/cpp/http/server/options.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/library/cpp/http/server/options.h b/library/cpp/http/server/options.h index 5976d58f32..4656dd7082 100644 --- a/library/cpp/http/server/options.h +++ b/library/cpp/http/server/options.h @@ -131,6 +131,11 @@ public: return *this; } + inline THttpServerOptions& EnableFastElasticQueues(bool enable) noexcept { + UseFastElasticQueues = enable; + + return *this; + } inline THttpServerOptions& SetThreadsName(const TString& listenThreadName, const TString& requestsThreadName, const TString& failRequestsThreadName) noexcept { ListenThreadName = listenThreadName; RequestsThreadName = requestsThreadName; @@ -167,6 +172,7 @@ public: ui64 MaxInputContentLength = sizeof(size_t) <= 4 ? 2_GB : 64_GB; size_t MaxRequestsPerConnection = 0; // If keep-alive is enabled, request limit before connection is closed bool UseElasticQueues = false; + bool UseFastElasticQueues = false; TDuration PollTimeout; // timeout of TSocketPoller::WaitT call TDuration ExpirationTimeout; // drop inactive connections after ExpirationTimeout (should be > 0) |