From 9f599ea87820644581f5ac184e9092c46d6cf344 Mon Sep 17 00:00:00 2001 From: godotg Date: Thu, 19 Oct 2023 17:04:47 +0800 Subject: [PATCH] perf[net]: increase the number of concurrent server sessions --- .../main/java/com/zfoo/net/session/SessionManager.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/src/main/java/com/zfoo/net/session/SessionManager.java b/net/src/main/java/com/zfoo/net/session/SessionManager.java index d8c0199fc..22d501bb4 100644 --- a/net/src/main/java/com/zfoo/net/session/SessionManager.java +++ b/net/src/main/java/com/zfoo/net/session/SessionManager.java @@ -30,15 +30,18 @@ public class SessionManager implements ISessionManager { private static final AtomicInteger CLIENT_ATOMIC = new AtomicInteger(0); /** - * 作为服务器,被别的客户端连接的Session + * EN: As a server, the Session is connected by other clients + * CN: 作为服务器,被别的客户端连接的Session + *

* 如:自己作为网关,那肯定有一大堆客户端连接,他们连接上来后,就会保存下来这些信息。 * 因此:要全局消息广播,其实要用这个Map */ - private final ConcurrentHashMapLongObject serverSessionMap = new ConcurrentHashMapLongObject<>(64); + private final ConcurrentHashMapLongObject serverSessionMap = new ConcurrentHashMapLongObject<>(128); /** - * 作为客户端,连接别的服务器上后,保存下来的Session + * EN: As a client, connect to another server and save Sessions + * CN: 作为客户端,连接别的服务器上后,保存下来的Session * 如:自己配置了Consumer,说明自己作为消费者将要消费远程接口,就会创建一个TcpClient去连接Provider,那么连接上后,就会保存下来到这个Map中 */ private final ConcurrentHashMapLongObject clientSessionMap = new ConcurrentHashMapLongObject<>(8);