gestioip-docker-compose icon indicating copy to clipboard operation
gestioip-docker-compose copied to clipboard

The app runs quite slow. Missing perl/apache optimizations.

Open vkhatuwala opened this issue 3 years ago • 1 comments

Hello,

I find that the app runs quite slow and I think its because the related perl optimizations like mod_perl are not setup correctly. Im not great at perl but, I've tried to install mod_perl and tried to enable in apache but failed with internal server errors.

Installed: apt-get install -y libapache2-mod-perl2

Added/replaced in /etc/apache2/sites-enabled/gestioip.conf :

<Directory "/var/www/html/gestioip">
....
    AddHandler perl-script .cgi
    PerlResponseHandler ModPerl::Registry
    PerlSendHeader On
....
</Directory>

Error log output:

[Wed Nov 16 04:50:24.927073 2022] [:warn] [pid 234:tid 140140882159360] -T switch is ignored, enable with 'PerlSwitches -T' in httpd.conf\n
[Wed Nov 16 04:50:24.928303 2022] [:error] [pid 234:tid 140140882159360] Can't locate GestioIP.pm in @INC (you may need to install the GestioIP module) (@INC contains: ./modules /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /etc/apache2) at /var/www/html/gestioip/index.cgi line 23.\nBEGIN failed--compilation aborted at /var/www/html/gestioip/index.cgi line 23.\n

Please help to fix this performance issue.

Thanks.

vkhatuwala avatar Nov 16 '22 05:11 vkhatuwala

You'll need to ensure you're using mpm_prefork, and instead of

PerlResponseHandler ModPerl::Registry

you need to use:

PerlResponseHandler ModPerl::RegistryPrefork

As the code contains relative paths.

https://perl.apache.org/docs/2.0/api/ModPerl/Registry.html#Description

META: document that for now we don't chdir() into the script's dir, because it affects the whole process under threads. ModPerl::RegistryPrefork should be used by those who run only under prefork MPM.

NHellFire avatar Dec 09 '22 03:12 NHellFire