diff --git a/src/Coordination/KeeperDispatcher.cpp b/src/Coordination/KeeperDispatcher.cpp index c9eba87590e..94ce159f055 100644 --- a/src/Coordination/KeeperDispatcher.cpp +++ b/src/Coordination/KeeperDispatcher.cpp @@ -448,11 +448,19 @@ void KeeperDispatcher::initialize(const Poco::Util::AbstractConfiguration & conf if (auto request_queue_it = xid_to_request_queue.find(request_for_session.request->xid); request_queue_it != xid_to_request_queue.end()) { + Stopwatch watch; if (server->isLeaderAlive()) server->putLocalReadRequest(request_queue_it->second); else addErrorResponses(request_queue_it->second, Coordination::Error::ZCONNECTIONLOSS); + if (request_queue_it->second.size() > 500) + LOG_INFO( + getLogger("Speed"), + "It took {}ms for {} requests", + watch.elapsedMilliseconds(), + request_queue_it->second.size()); + xid_to_request_queue.erase(request_queue_it); } } diff --git a/src/Coordination/KeeperStateMachine.cpp b/src/Coordination/KeeperStateMachine.cpp index 8a94ef7347e..67ff316a6f3 100644 --- a/src/Coordination/KeeperStateMachine.cpp +++ b/src/Coordination/KeeperStateMachine.cpp @@ -768,14 +768,15 @@ void KeeperStateMachine::processReadRequest(const KeeperStorage::RequestsForSess /// Pure local request, just process it with storage std::lock_guard lock(process_and_responses_lock); std::vector all_responses; - if (request_for_session.size() > 50) + if (request_for_session.size() > 100) { all_responses.resize(request_for_session.size()); //LOG_INFO(getLogger("Keeper"), "Has read requests {}", request_queue_it->second.size()); for (size_t i = 0; i < request_for_session.size(); ++i) { - read_pool.scheduleOrThrowOnError([&, i, read_request = request_for_session[i]] + read_pool.scheduleOrThrowOnError([&, i] { + const auto & read_request = request_for_session[i]; all_responses[i] = storage->processRequest( read_request.request, read_request.session_id, std::nullopt, true /*check_acl*/, true /*is_local*/); });