ultranerds has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm trying to speed up my site a bit - and as such, I'm trying to move some of my AJAX scripts into SSI requests (and embed them in the page);
var booking_json = <!--#include virtual="/cgi-bin/links/booking_load.c +gi?linkid=<%ID%>"-->;
This works fine... but the problem I'm having, is that the page is actually SLOWER now :(

HTML page before: 213ms
HTML page after: 618ms

As such, that slows the rest of the requests down as well (as its got to wait for the HTML to render)

So my question.... should/is mod_perl being used for the SSI requests? Or so I need to do anything specific to invoke it?

EDIT: I found this post: http://docstore.mik.ua/orelly/perl/perlnut/ch11_05.htm ....however, when I try:

<!--#perl sub="Apache::Include" arg="/cgi-bin/links/spots_load_new.cgi?catid=0&linkid=45&t=espanol"-->

I get an an error occurred while processing this directive error... and then this in the error log: [Wed Dec 02 08:26:33 2015] [error] [client 81.174.134.33] unknown directive "perl" in parsed doc /home/public_html/espanol/Detailed/45-test2.html

Thanks!

Andy

Replies are listed 'Best First'.
Re: Using mod_perl, with SSI?
by Anonymous Monk on Dec 02, 2015 at 07:33 UTC
      Thanks for the reply. Ok, so the times in ms, are how long it takes the initial page to be returned. So in this case, its 213ms (and then the rest of the content is loaded once thats happened). After SSI, it takes 618ms (so its holding back the page load by another 200+ ms)

      My config for mod_perl is:

      PerlRequire /home/user/startup.pl PerlModule Apache2::Reload PerlInitHandler Apache2::Reload PerlModule Apache2::RequestRec ScriptAlias /cgi-bin/ /home/user/public_html/cgi-bin/ <Directory /home/user/public_html/cgi-bin> SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders PerlOptions +SetupEnv Options +ExecCGI </Directory>
      From what I've been reading, it looks like this error:

      unknown directive "perl" in parsed doc

      ...means that the "perl" option isn't enabled at compilation. I've submitted a ticket with our host, to see if they can shed some light on what may need to be tweaked.

      Cheers

      Andy