Learning Python Network Programming

(Sean Pound) #1

Client and Server Applications


On modern hardware it's actually possible to handle ten-thousand
concurrent connections using a multithreading approach as well, see this
Stack Overflow question for some numbers https://stackoverflow.
com/questions/17593699/tcp-ip-solving-the-c10k-with-
the-thread-per-client-approach.
The modern challenge is the "c10m problem", that is, ten million
concurrent connections. Solving this involves some drastic software and
even operating system architecture changes. Although this is unlikely
to be manageable with Python any time soon, an interesting (though
unfortunately incomplete) general introduction to the topic can be found
at http://c10m.robertgraham.com/p/blog-page.html.

The following diagram shows the relationship of processes and threads in an
event-driven server:


Although the GIL and the OS thread scheduler are shown here for completeness,
in the case of an event-driven server, they have no impact on performance because
the server only uses a single thread. The scheduling of I/O handling is done by
the application.

Free download pdf