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"> &nbsp; </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>&nbsp;&nbsp;&nbsp;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


In reply to Poor Performance by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.