Reception and Event Callback from Server

Game server utilizes the entire CPU and Thread pooling to handle reception of other clients when accessing the database. ProudNet also works in thread pooling method which has following features.

  • Creates a separate Thread pool at startup of server. Please refer to Proud.CNetServer.Start() to set how many threads need to be created.
  • Game client takes care of piled messages only when a function is called to handle those messages at a certain time. But server doesn't require such a call.
  • When an event or a RMI reception occurs at server, they get callback from a thread pool included in Proud.CNetServer.
  • An event or a RMI reception of the same client can't callback from more than 2 threads since they can't guarantee the order of operation unlike ProudNet does that always operates callback in order of RMI reception arrival. Of course, an event or a RMI calls coming for different clients can be called back simultaneously.
  • When any event or RMI must be occurred while all threads are operating callback routines, callback waits until any thread becomes available.
  • Even if the operation time of user-definedd call back routine is long, it doesn't affect the performance of network communication. Thus server developer doesn't have to create a separated thread pool besides what ProudNet offers.

The below picture shows a case where client A,B, and C are included in server, and how they are queued for each RMIs or events that just occurred inside of Proud.CNetServer. A1, A2, and A3 are events or RMIs for client A. In the same manner, B1, B2, and B3 are for client B. There are 2 threads in pool. In the case like this, the operation runs as followed.

  • A1, A2, and A3 can't be executed all together at the same time. This is same for all events in B and C.
  • But one each event of As, Bs, and Cs can be executed simultaneously.
  • Since there are only 2 threads in pool, 2 events from A, B, and C will be chosen to perform callback but in prior to that, the thread with completion of callback routine will operate callback of unselected RMI or event.
thread_pool.jpg
Thread Pool Operation