Network server design question
Marek Janukowicz
marek at janukowicz.net
Mon Aug 5 16:23:34 PDT 2013
Marek Janukowicz wrote:
> I'm writing a network server with some specific requirements:
> - 5-50 clients connected (almost) permanently (maybe a bit more, but
> definitely not hundreds of them)
> - possibly thousands of requests per seconds
> - responses need to be returned within 5 seconds or the client will
> disconnect and complain
>
> Currently I have a Master thread (which is basically the main thread)
> which is handling connections/disconnections, socket operations, sends
> parsed requests for processing to single Worker thread, sends responses to
> clients. Interaction with Worker is done via message passing.
I'd like to thank anyone for valuable input. For now I chose Dmitry's
suggestion (which was an extension of my idea to go with thread per client),
so I have multiple receivers, single worker and multiple senders. That works
quite well, although I didn't really test that with many clients. One nice
thing is that "interrupted system call" problem magically went away - it
looks like it occurred with Socket.select (which I don't use after
architectural changes anymore) only and socket.send/receive is apparently
not affected.
--
Marek Janukowicz
More information about the Digitalmars-d
mailing list