MySQL and Perl for the Web: Chapter 3 Section 1 (1/3) | WebReference

MySQL and Perl for the Web: Chapter 3 Section 1 (1/3)

current pagecurrent pageTo page 3
[next]

Improving Performance with mod_perl

What mod_perl Is and How It Works

When Apache receives a request for a static HTML file, it can serve the request directly by opening the file and writing it out over the network to the client. This is not true for programs, such as the Perl cgi-bin scripts we wrote in Chapter 2. Those scripts aren't processed by Apache itself. Instead, Apache starts up Perl as an external process and returns its output to the requesting client. This works well for extending Apache's capabilities, but invoking an external program taxes the Web server host and also introduces some delay into serving the request. This overhead is incurred repeatedly as script requests arrive because Apache starts up a new Perl process to handle each one.

An alternative to running scripts using external processes is to make the script handler part of Apache itself. In the case of Perl scripts, we can use the mod_perl module to embed the Perl interpreter into Apache. The result is that Apache gains the capability to execute Perl scripts directly. This approach has several advantages:

current pagecurrent pageTo page 3
[next]


Created: June 26, 2001
Revised: June 26, 2001

URL: https://webreference.com/programming/perl/mysqlperl/chap3/1/