I'm trying to track down the LD issues encountered when a server is load stressed. It could be any number of things, so might as well start at the bottom.
Here's a breakdown of the threads in EQEMu's zone servers. If you see something that should be shifted or potential improvements to logic, please comment.
Main Thread
Function: main()
Quote:
Handles main() and all core program logic.[list=1][*] Parses command line[*] Loads various cache stores[*] Creates TCP connection to world server[*] Starts infinite processing loop- Process world server socket data received
NOTE: Only processes data already received on the TCP thread
- Process whatever logic is necessary for each entity in zone (i.e., AI, client HandlePacket(), etc)
NOTE: Sending/Receiving of client data not handled on this thread. This thread only processes the data.
- Refresh world server ping, db variables, /who all
[/list:o:a531084bc2]
|
TCP Thread
Function: TCPConnectionLoop()
Quote:
Handles receiving and sending of data between zone and world servers, using TCP. Not much goes on here.
|
UDP Thread
Function: EQNetworkServerLoop()
Quote:
Handles receiving and sending of data between zone and all clients. This is the thread that must be highly optimized to work with client/zone UDP traffic.[list=1][*] Socket is opened up in SOCK_DGRAM mode (UDP, connectionless)[*] SO_RCVBUF is set to 64kb[*] SO_SNDBUF is set to 64kb[*] Socket is set to bind on INADDR_ANY (all IP addresses)[*] Socket is set to nonblocking mode[*] Enters infinite processing loop:- recvfrom() is called on server socket with buffer size of 1,518 bytes. Not sure why this number was chosen.
- A virtual connection is established for each packet of data received. A virtual connection is treated as a 'Client' class.
- Verifies checksum on packet received, if any
- Iterates through all client connections, looking for match on who the packet belongs to
- If match found, the entire packet is decrypted. If the packet is a fragment of a packet, all fragmented packet processing is done as well.
NOTE: This is a part I believe we can optimize
- All (virtual) connections are checked for validity. Connections deemed no longer valid are removed.
[/list:o:a531084bc2]
|
Async TCP Thread
Quote:
I didn't review this thread
|
Async DB Thread
Quote:
I didn't review this thread
|