sockets - Performance considerations of a large number of connection on the same port -
what performance considerations 1 should take account when designing server application listens on 1 port? know possible many thousands of clients connect server on single port, performance negatively affected having server application accept incoming requests on single port?
is understanding correct model (server listening on 1 port handles incoming connections, , responds on outbound connection created when client connection established) way databases/webservers etc work?
regards, brian
it not matter if server listens on 1 port or multiple ports. server still has establish full socket connection each client accepts. os still has route inbound packets correct socket endpoints, , sockets uniquely identified combination of ip/port pairs of both endpoints, there no performance issues if server endpoints use different ports.
any performance issues going in way server's code handles socket connections. if listens on 1 port, , accepts clients on port using simple accept() loop in single thread, rate can accept clients limited loop. typically, servers spawn worker threads each accepted client, in has performance overhead of own if thread pooling not used. if server needs handle lot of clients simultaneously, should use overlapped i/o or i/o completion ports handle connections more efficiently.
Comments
Post a Comment