Thread: Zone Threads
View Single Post
  #5  
Old 11-30-2003, 05:38 PM
DeletedUser
Fire Beetle
 
Join Date: Sep 2002
Posts: 0
Default

Async TCP Thread
If i remember correctly, this is a breif thread to handel the connecting process of the TCP socket and ends once the connection is estabilished, i thought it was no longer used however.

Async DB Thread
Allowed database queries to be run without blocking the main thread.
Quote:
[list=1][*] Mainines a queue of commands to be processed.[*] Allows both a configurable wait period before executing the datbase call, and passes back a job id# that can be used to cancel the query.[*] After the query is complete, can either:
  1. Call a function in the DBThread execution timeslice.
  2. Pass back an event to the main thread (the pending event list is checked as part of main's loop).
  3. Do nothing.
[/list:o:982197c2ff]
While the network code is logically complex, i dont think it's very slow in it's execution. There's some performance counter code kicking around somewhere in the project that you can use as a high precision count of the processor time used by a chunk of code (search for "QueryPerformanceCounter", only works on windows). However on high use servers perhapse the OS level buffer is being overflowed on the UDP socket if we're not clearing it fast enough. That's the thing SO_RCVBUF is making larger than default already. Having another thread to clear this in the same way we're doing now wont help, because the minium sleep(1) time on windows machines is 10ms, which may be enough for the buffer to fill up. The fix for this on windows is to use completion ports (which is to use a blocking function on the socket that only returns when there's data, faster but requires it's own thread), someone help me if there's a linux equivilent.
Referance: http://msdn.microsoft.com/msdnmag/issues/1000/Winsock/
Reply With Quote