in reply to Re^6: Win32 - flock() not FIFO?
in thread Win32 - flock() not FIFO?
Implementing a concurrent webserver with threads took a lot of time - it took .09 sec to create a new thread, but only .04 sec to service the AJAX request. So I ended up re-writing (doing a lot of that lately) the concurrent server as an iterative server.
I assume you were starting a new thread for each client? Perl's threading implementation carries to much overhead with starting a new thread to make that a viable option. Actually, I'd say that even in C that starting a new (kernel) thread for every brief exchange is an extremely wasteful way of handling connectionless protocols.
Far better is to use a pool of threads. For an example of handling concurrent sockets see Re^7: multithreaded tcp listener with IO::Socket. It probably needs checking as it was written back in the 5.8.6 days and quite a lot has changed in the interim. If you are thinking of using it as the basis for anything, let me know and I'll give it the once over.
|
|---|