On 10/25/06, Toby Douglass <[EMAIL PROTECTED]> wrote:
This equates to about 65 threads of 61 sockets.
A question is whether it's better to fire up all these threads at init,
and forget about load balancing. Bear in mind the fact that
WaitForMultipleObjects() reads it handle list in-order.
Doug, if you're looking for blistering socket performance you need to
drop all this and learn about I/O Completion Ports. I have clients
and servers which can drive more than 10k sockets with NO MORE threads
than you have CPUs as reported by GetSystemInfo.
A simple test server which serves up the same test data for any HTTP
request, can completely saturate 100base-t at reasonable CPU
utilization. Is isn't the same socket handling more than one request.
This is more than 6k connections per second handling one request
each. Once the test client receives the response it resets the
connection and reconnects for the next request. Much higher levels of
performance can be achieved if more than one request is done per
connection, and I've seen more than 10k current connections on my
server side.
I'm not in a position to open source the code I've written yet, but
there is lots of decent code floating around already that will blow
away any implementation that is using pools of threads and
WaitForMultipleObjects.
Len Holgate wrote a few pretty good articles;
http://www.jetbyte.com/portfolio-showarticle.asp?articleId=37&catId=1&subcatId=2
There's a few others at;
http://www.codeproject.com/internet/
And of course;
http://msdn.microsoft.com/msdnmag/issues/1000/Winsock/
There exists some investigation which indicates that there is a limit of
about 4k sockets for Windows, due to the necessity of allocating a certain
amount of non-paged pool per socket combined with a hard limit on the
amount of non-paged pool.
It's not so much a non-paged pool problem (unless you really don't
have much physical RAM in the machine). I've seen the 4k limit on the
client side, look for the MaxUserPort setting. I never was able to
get this to do much though;
http://www.microsoft.com/technet/itsolutions/network/deploy/depovg/tcpip2k.mspx
I'll give you a hint, make sure all your reads/writes are with buffers
that are page aligned. A small 8 byte read or write that just happens
to span a page bounder, will lock both pages (4k each on x86).
Kevin
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users