AntiTopQuark commented on code in PR #2498:
URL: https://github.com/apache/kvrocks/pull/2498#discussion_r1730750660
##########
src/server/server.cc:
##########
@@ -2115,3 +2122,40 @@ AuthResult Server::AuthenticateUser(const std::string
&user_password, std::strin
*ns = kDefaultNamespace;
return AuthResult::IS_ADMIN;
}
+
+void Server::evictionClients() {
+ size_t mem = 0;
+ for (const auto &t : worker_threads_) {
+ mem += t->GetWorker()->GetConnectionsMemoryUsed();
+ }
+ if (mem < config_->max_memory_clients) {
+ return;
+ }
+
+ std::vector<redis::Connection *> conns;
+ for (const auto &t : worker_threads_) {
+ auto worker_conns = t->GetWorker()->GetConnections();
+ for (const auto &iter : worker_conns) {
+ conns.push_back(iter.second);
Review Comment:
I referred to the implementation of the KickoutIdleClients() function. In
FreeConnectionByID(), if the connection (conn) has already been released, no
further action will be taken.
Additionally, may I ask if I can assume that, in most cases, the memory
usage across different workers in the system is almost uniform, and that there
is rarely a situation where memory usage is uneven?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]