Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/common/net/ServiceGroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ void ServiceGroup::stopAndJoin() {
CoTask<void> ServiceGroup::checkConnectionsRegularly() {
while (true) {
XLOGF(DBG9, "server@{} check connections", fmt::ptr(this));
// Check both RDMA and TCP connections for expiration
ioWorker().checkConnections(Address{0, 0, Address::RDMA}, config_.connection_expiration_time());
ioWorker().checkConnections(Address{0, 0, Address::TCP}, config_.connection_expiration_time());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当集群规模较大,或者连接数较大时,这两个checkConnections是会block 协程调度的,感觉可以定期yield一下,让出cpu。

co_await folly::coro::sleep(config_.check_connections_interval().asMs());
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/common/net/TransportPool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ std::pair<TransportPtr, bool> TransportPool::get(Address addr, IOWorker &io_work
// 3. create a new transport. still protected by mutex.
transport = Transport::create(addr, io_worker);
set.add(transport, idx);
acceptedCountRecorder.set(++acceptedCount);
// Increment connectedCount for outgoing connections (addr.ip != 0)
// to match the decrement in remove() for symmetry
connectedCountRecorder.set(++connectedCount);
cached = transport;
return std::make_pair(std::move(transport), true);
},
Expand Down