http://www.perlmonks.org?node_id=783240


in reply to best way to balance load to a Perl script

You will get a fair bit of mileage by converting download.pl to a mod_perl handler. In that case you will at least lose the startup time of the perl interpreter. Copying/renaming the script is very unlikely to do anything. As far as your server is concerned calling multiple processes called "/usr/bin/perl /path/to/download.pl" is no more expensive than "/usr/bin/perl /path/to/download2.pl"

What is perl actually doing in this case? Is it actually serving the audio? Or is it just drawing a page that has links to the audio files? In the former case, it may be that perl is not the best tool for the job.

Using multiple load balanced servers will definitely improve performance, but it's critical to identify where the bottleneck is first. Running the script from the command line with the core module Devel::DProf or the CPAN module Devel::NYTProf will help in identifying what's slow.

  • Comment on Re: best way to balance load to a Perl script