0
\$\begingroup\$

we are developing a mmorpg with a small team. There are 2 structures we can create on the server side for managing clients and processing packages. I wonder what structure is better. I would be very happy if there is a good structure that you can recommend.

First Structure

IdleSessionQueue and ActiveSessionMap

TaskQueue and SendQueue

In this structure, idle sessions (IdleSessionQueue) are initially created and there is a thread (NetworkListenerThread) that listens to the network and accepts users. This thread takes a session from idle sessions when a new user arrives and adds the session to the active sessions table (ActiveSessionMap) using the values ​​of SessionId and Session. then creates a thread (ClientListenerThread) to listen to the session added to the table. a ClientListenerThread occurs for each user. When the client has disconnect, it is added back to IdleSessions again.

When the client sends a request (Packet), that request is added to TaskQueue. A certain number of workersThreads are created in advance. As long as there is a package in TaskQueue, WorkerThreads receives the package and processes it and adds the new package to SendQueue. SenderThreads receives and sends each packet in SendQueue to client.

Second Structure

IdleSessionQueue and ActiveSessionMap

In this structure, idle sessions (IdleSessionQueue) are initially created and there is a thread (NetworkListenerThread) that listens to the network and accepts users. This thread takes a session from idle sessions when a new user arrives and adds this session to the active sessions table (ActiveSessionMap) using the values of SessionId and Session. then creates a thread (ClientListenerThread) to listen to the session added to the table. a ClientListenerThread occurs for each user. When the client has disconnect, it is added to IdleSessions again. When the client sends a request (Packet), that request is processed by ClientListenerThread and the result is sent to one or more clients.

Which one is better solution or what is the best solution for this problem?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ This question probably leads to opinion-based answers. Also have a look at the "it's not about" part (4. bullet point) in this link: gamedev.stackexchange.com/help/on-topic \$\endgroup\$
    – wychmaster
    Apr 23, 2020 at 11:48
  • \$\begingroup\$ I'm afraid you are going to need to consider the pros and cons further yourself, or ask this question in chat. But on the site itself, we accept questions only with verifiably right or wrong answers. We cannot gauge the future needs of your project, for you, as we'd be taking shots in the dark. \$\endgroup\$
    – Engineer
    Apr 24, 2020 at 20:01

0

You must log in to answer this question.

Browse other questions tagged .