Skip to content

Commit

Permalink
perf[net]: increase the number of concurrent server sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysunxiao committed Oct 19, 2023
1 parent 4508937 commit 9f599ea
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions net/src/main/java/com/zfoo/net/session/SessionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <p>
* 如:自己作为网关,那肯定有一大堆客户端连接,他们连接上来后,就会保存下来这些信息。
* 因此:要全局消息广播,其实要用这个Map
*/
private final ConcurrentHashMapLongObject<Session> serverSessionMap = new ConcurrentHashMapLongObject<>(64);
private final ConcurrentHashMapLongObject<Session> 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<Session> clientSessionMap = new ConcurrentHashMapLongObject<>(8);
Expand Down

0 comments on commit 9f599ea

Please sign in to comment.