aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/http/server/http.cpp
diff options
context:
space:
mode:
authorkulikov <kulikov@yandex-team.com>2023-08-22 22:35:57 +0300
committerkulikov <kulikov@yandex-team.com>2023-08-22 22:51:44 +0300
commitd6e7da05041ff86e301b9546870b41211945aec2 (patch)
tree4bbe1aafd7e1938ed0a57d2e642c66608ff6760b /library/cpp/http/server/http.cpp
parent7c7ade4dcfda98626af0dd7eb774a855ba1111f5 (diff)
downloadydb-d6e7da05041ff86e301b9546870b41211945aec2.tar.gz
one shot poller
With WaitReadOneShot: - there is no need to do Unwait on connection activation, one less syscall per request; - this allows to make several listener threads over one epoll poller. Turn option on for search daemons (check it turned on by default here https://a.yandex-team.ru/review/4372795/details).
Diffstat (limited to 'library/cpp/http/server/http.cpp')
-rw-r--r--library/cpp/http/server/http.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp
index 2dd407dcef..19a16bdcb5 100644
--- a/library/cpp/http/server/http.cpp
+++ b/library/cpp/http/server/http.cpp
@@ -83,12 +83,17 @@ public:
TGuard<TMutex> g(Mutex_);
Conns_.PushBack(c);
- Poller_->WaitRead(c->Socket_, (void*)static_cast<const IPollAble*>(c));
+ if (Options.OneShotPoll) {
+ Poller_->WaitReadOneShot(c->Socket_, (void*)static_cast<const IPollAble*>(c));
+ } else {
+ Poller_->WaitRead(c->Socket_, (void*)static_cast<const IPollAble*>(c));
+ }
}
+
inline void Erase(TClientConnection* c, TInstant now) noexcept {
TGuard<TMutex> g(Mutex_);
- EraseUnsafe(c);
+ EraseUnsafe(c, /*removeFromPoller*/!Options.OneShotPoll);
if (Options.ExpirationTimeout > TDuration::Zero()) {
TryRemovingUnsafe(now - Options.ExpirationTimeout);
}
@@ -118,8 +123,10 @@ public:
return true;
}
- void EraseUnsafe(TClientConnection* c) noexcept {
- Poller_->Unwait(c->Socket_);
+ void EraseUnsafe(TClientConnection* c, bool removeFromPoller = true) noexcept {
+ if (removeFromPoller) {
+ Poller_->Unwait(c->Socket_);
+ }
c->Unlink();
}