I am seeking perl wisdom. I am running a mod_perl2/Apache2.0 environment. I have written a Netflow collector which stuffs items into MS SQL Server ( no rants on Microsoft please, I am not responsible for our purchasing decisions.) This part works well and the web interface works reasonably well, except... Some the rows returned from the Netflow database run into the thousands and take a lonng time to load in the browser. Smaller amounts of data load quickly. The tables are indexed and the templates load through my startup.pl. I ran this as a straight script and not through Apache and the Perl dbi returns large result sets quickly. Is there something I am missing to speed things up or is HTML::Template too slow to handle large amounts of data returned and should I look at TT. Here is my startup.pl
#!/usr/bin/perl use HTML::Template; use File::Find; use ModPerl::Util; use ModPerl::Registry (); use Apache::DBI; use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::Filter (); use Apache2::RequestUtil (); use Apache2::ServerRec (); use Apache2::ServerUtil (); use Apache2::Connection (); use Apache2::Log (); use APR::Pool (); use APR::Table (); use Apache2::Const -compile => ':common'; use APR::Const -compile => ':common'; use Socket qw(:DEFAULT :crlf); use Net::Ping; use Net::NBName; use POSIX qw(strftime); use Date::Calc qw( Today Add_Delta_Days ); use DBI; use DBD::ODBC; Apache::DBI->connect_on_init( 'dbi:ODBC:MRIServer2k', 'mriinventory', +'Wysiwyg@3044', { PrintError => 1, RaiseError => 0, AutoC +ommit => 1 } ); print STDERR "Pre-loading HTML Template...\n"; find ( sub { return unless /\.tmpl$/; HTML::Template->new( filename => "$File::Find:: +dir/$_", cache => 1, ); }, '/var/www/yanma/templates', );
Here is my "default" apache2 file:
NameVirtualHost * <VirtualHost *> ServerAdmin webmaster@localhost DocumentRoot /var/www/yanma ServerName yanma.usmc-mccs.org <Directory /var/www/yanma> DirectoryIndex index.html AllowOverride None Order allow,deny allow from all # Uncomment this directive is you want to see apache2's # default start page (in /apache2-default) when you go to / #RedirectMatch ^/$ /apache2-default/ </Directory> <Directory /var/www/yanma/administration> AuthName "Kerberos Login" AuthType Kerberos Krb5Keytab /etc/auth_kerb.keytab KrbAuthRealm WINDOWS.USMC-MCCS.ORG KrbMethodNegotiate off KrbSaveCredentials off KrbSaveCredentials off KrbVerifyKDC off </Directory> PerlModule Handlers::ChooseBase PerlModule Handlers::Devices PerlModule Handlers::PortMapper PerlModule Handlers::ChooseModel PerlModule Handlers::ActiveModels <Location /choosebase> SetHandler perl-script PerlResponseHandler Handlers::ChooseBase PerlOptions +ParseHeaders +GlobalRequest Order allow,deny Allow from all </Location> <Location /devices> SetHandler perl-script PerlResponseHandler Handlers::Devices PerlOptions +ParseHeaders +GlobalRequest Order allow,deny Allow from all </Location> <Location /portmapper> SetHandler perl-script PerlResponseHandler Handlers::PortMapper PerlOptions +ParseHeaders +GlobalRequest Order allow,deny Allow from all </Location> <Location /choosemodel> SetHandler perl-script PerlResponseHandler Handlers::ChooseModel PerlOptions +ParseHeaders +GlobalRequest Order allow,deny Allow from all </Location> <Location /activemodels> SetHandler perl-script PerlResponseHandler Handlers::ActiveModels PerlOptions +ParseHeaders +GlobalRequest Order allow,deny Allow from all </Location> <Location /chooserouter> SetHandler perl-script PerlResponseHandler Handlers::ChooseRouter PerlOptions +ParseHeaders +GlobalRequest Order allow,deny Allow from all </Location> <Location /flows> SetHandler perl-script PerlResponseHandler Handlers::Flows PerlOptions +ParseHeaders +GlobalRequest Order allow,deny Allow from all </Location> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel debug CustomLog /var/log/apache2/access.log combined ServerSignature On <Directory /var/www/yanma/templates> Options Indexes FollowSymLinks Multiviews AllowOverride None Order allow,deny allow from all # Uncomment this directive is you want to see apache2's # default start page (in /apache2-default) when you go to / #RedirectMatch ^/$ /apache2-default/ </Directory> Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost>
Thanks in advance for the Perls of Wisdom.

In reply to slow mod_perl2 or slow html::template by mraful

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.