Prethreading
If you are working with a threading version of Perl, you can design your server to use a prethreading architecture. Prethreading is similar to preforking, except that instead of launching multiple processes to call accept(), the prethreading server creates multiple threads to deal with incoming connections. As it is for the preforking server, the rationale is to avoid the overhead of creating a new thread for every incoming connection.
In this section we develop a prethreading Web server that implements the same adaptive features as the preforking server from the previous sections.
A Threaded Web Server
Before we jump into the prethreaded Web server, we'll review a plain threaded version (Figure 15.8). The idea is that the main ...
Get Network Programming with Perl now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.