Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have lots of text and CSV files that I need to make accessible via the web. I'm currently using the perl script below to post these files. However, the performance is terrible. I'm using a SUN v240 with Solaris 8, Apache 1.3.34 configured with SSL and MOD_PERL. However, a 300 to 500 line text file takes anywhere from 8 to 15 seconds to load (full duplex, 100 Mbps connectivity to server).
I tried the system tuning suggestions from http://everythingsolaris.org.
Any help or suggestions are appreciated.
Darrin
Example:
#!/usr/bin/perl -w # rsdnl.pl use strict; use warnings; ######################################### ###### PROGRAM DESCRIPTION ###### # This script pulls information from text # files and posts it on the web. ######################################### ## Declare Variables ## my $Source_File; my $Source_Title; my @Contents; my $content; ## Read Post Input and Set Source ## $Source_File = $ENV { 'QUERY_STRING' }; $Source_File = "Not Defined" unless $Source_File; $Source_Title = $Source_File; $Source_Title =~ s/^.*\///; ## Display Web Page ## print "Content-type: text/html\n\n"; print <<"EOF"; <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>SOCOM Networks</title> <link rel="stylesheet" href="./index/Global.css" /> <link rel="stylesheet" href="./index/Socom.css" /> <link rel="stylesheet" href="./index/Pierce.css" /> </head> <body topmargin="0" leftmargin="0" bgcolor="white"> EOF ## Include Banner my $header_file = './index/_header01.txt'; open ( HEADER, $header_file ) || die "Cannot open $header_file: $!\n"; while ( <HEADER> ) { print; } close (HEADER); print <<"EOF"; <div align="center"> <br/><br/> <table border="0" cellspacing="0" cellpadding="0" width="800px"> <tr> <td class="DashPartFrame"> <table width="100%" border="0" cellpadding="0px" cellspacing="0px"> +<tr valign="top"> <!-- BEGIN COLUMN ONE --> <td style="width:100%" class="DashZoneLeft"> <!-- BEGIN TABLE: DISPLAY FILE --> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td class="DashPartFrame"> <table cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td class="DashPartTitle"> <nobr><span>$Source_Title</span></nobr> </td> <td nowrap="" class="DashPartCommandsArea"> </td> </tr> </table> <div class="DashPartBody" style="width:100%;"> <!-- BEGIN INSERT PAGE --> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td style="padding:5px" class="text3"> EOF if ( -e $Source_File ) { open ( SOURCE, "$Source_File" ) || die "Cannot open $Source_File: $! +\n";; @Contents = <SOURCE>; close ( SOURCE ); print "<pre>\n"; foreach $content ( @Contents ) { print "$content<br/>"; } #foreach $content ( @Contents ) print "</pre>\n"; } else { print "<br/><h2> The file specified does not exist! +</h2><br>\n"; } #if ( -e $Source_File ) print <<"EOF"; </td> </tr> </table> <!-- END INSERT PAGE --> </div> </td> </tr> </table> <!-- END TABLE: DISPLAY FILE --> <table><tr><td style="height:1px"></td></tr></table> </td> <!-- END COLUMN ONE --> </tr> </table> <div> </body> </html> EOF exit 0;
Edited by planetscape - added readmore tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Poor Performance
by reasonablekeith (Deacon) on Mar 22, 2006 at 11:42 UTC | |
by cbrandtbuffalo (Deacon) on Mar 22, 2006 at 14:56 UTC | |
|
Re: Poor Performance
by zer (Deacon) on Mar 22, 2006 at 06:34 UTC | |
| |
|
Re: Poor Performance
by xdg (Monsignor) on Mar 22, 2006 at 06:38 UTC | |
by zer (Deacon) on Mar 22, 2006 at 06:45 UTC |