Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Running slower under mod_perl

Quote Reply
Running slower under mod_perl
Quote:
1245 apache 0.1 % /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY -DHAVE_AUTH_ANON ...
1270 apache 0.1 % /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY -DHAVE_AUTH_ANON ...
1247 apache 0.1 % /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY -DHAVE_AUTH_ANON ...
1276 apache 0.1 % /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY -DHAVE_AUTH_ANON ...
1281 apache 0.1 % /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY -DHAVE_AUTH_ANON ...
1291 apache 0.1 % /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY -DHAVE_AUTH_ANON ...
1293 apache 0.1 % /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY -DHAVE_AUTH_ANON ...
1294 apache 0.1 % /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY -DHAVE_AUTH_ANON ...
3911 apache 0.1 % /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY -DHAVE_AUTH_ANON ...
3912 apache 0.1 % /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY -DHAVE_AUTH_ANON ...
4074 apache 0.1 % /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY -DHAVE_AUTH_ANON ...
4207 apache 0.1 % /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY -DHAVE_AUTH_ANON ...
1585 mysql 0.0 % /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/u ...
1587 mysql 0.0 % /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/u ...
1778 mysql 0.0 % /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/u ...
1789 mysql 0.0 % /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/u ...
1793 mysql 0.0 % /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/u ...
1796 mysql 0.0 % /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/u ...

Ever since we put GForum on mod_perl it's been going slower than without, and Running Processes under Apache show dozens of the above processes. Most aren't using up any cpu time, but are hanging around.

Any idea why GForum might be running slower?

I can't think what else might be causing the lag. It only seems to have happened following the mod_perl switch.

Jason
Quote Reply
Re: [wickedmoon] Running slower under mod_perl In reply to
It is definitely running under mod_perl?.....do you see mod_perl(1)?

Seeing quite a few httpd processes is normal. The only time I experienced a build up of httpd processes was when mod_perl was compiled incorrectly and they built up until apache eventually barfed.

Are you using Plesk?

Last edited by:

Paul: Nov 8, 2002, 4:32 AM
Quote Reply
Re: [wickedmoon] Running slower under mod_perl In reply to
Hi,

As Paul mentioned, double check that you are really under mod_perl - double check by going to the admin area, clicking on fileman, and clicking on preferences -> environment -- We really need to put that environment link in the main setup.

If you are on mod_perl, I seem to remember you saying you only had 128 megs of memory. This is not enough to have mod_perl running as part of your main webserver, it needs more memory then that. It may be slower because your system is swapping heavily due to insufficent memory.

If you have limited amount of memory, you really need to install mod_perl on a second apache server, and then use mod_proxy to forward only forum requests to the mod_perl server, and not requests for html, images, etc. Using this setup, it means you only need to keep around a small number of mod_perl apache processes, greatly reducing the amount of memory required.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Running slower under mod_perl In reply to
I have 256mb ram at the moment. Is this enough? What would be your recommendation?

Jason
Quote Reply
Re: [wickedmoon] Running slower under mod_perl In reply to
Can you show me the output of the following commands: `uptime`, `vmstat`, `free` and `ps auxw | grep httpd`. That will give me an idea of how your system is currently handling the load, and if indeed it is a memory issue. Did you double check that it is running under mod_perl (it needs to say mod_perl(1), if it doesn't even though you have mod_perl in apache, Gossamer Forum isn't using it).

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Running slower under mod_perl In reply to
Hi Alex,
I thought I had mod_perl running but I have looked as you said in the preferences of Fileman and it says :
Persistant Env: mod_perl () SpeedyCGI (0)
but below that I have :
SERVER_SOFTWARE => Apache/1.3.27 OpenSSL/0.9.6g (Unix) mod_perl/1.26
Does this mean that it isn't running mode_perl even though I get the modules loaded messages from the server ?

Thanks, John
Significant Media
Quote Reply
Re: [Jag] Running slower under mod_perl In reply to
Hi John,

The "mod_perl" section of SERVER_SOFTWARE just means that mod_perl has been loaded into Apache - for example, for the apache on my machine, accessing a test CGI script shows me:

$ENV{SERVER_SOFTWARE} => `Apache/1.3.27 (Unix) (Gentoo/Linux) mod_perl/1.27'

Keep in mind, that is under CGI, not mod_perl.

The difference between mod_perl and CGI shows up here:

$ENV{GATEWAY_INTERFACE} => `CGI-Perl/1.1'

$ENV{GATEWAY_INTERFACE} => `CGI/1.1'

The top one is mod_perl, the bottom one is CGI.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jag] Running slower under mod_perl In reply to
If you're getting the modules loaded, it means you're getting the worst of both worlds - all the modules are being loaded in the process, but you are still getting all of the CGI disadvantages. It's probably a matter of missing lines lines in the config file that look something like this:

<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
</Location>

But you had better check that before using it - mod_perl on my system isn't working quite right...

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Running slower under mod_perl In reply to
Hi Jason,
Thanks for your response(s). I had a quick look and I have :
<Location /cgi-bin/gforum_folder>
SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader On
Options +ExecCGI
</Location>
in my httpd.conf file
and when I run perl-status?inc via the web I get a list of all (well a lot) of GT modules that are loaded.

At the beginning of my http.conf file I have this :
PerlRequire startup.pl

I have this as a startup.pl file :
#!/usr/local/bin/perl

$ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl/ or die "GATEWAY_INTERFACE not Perl!";

use lib '/usr/local/etc/httpd/path_to/cgi-bin/admin';
require GForum::mod_perl;
1; # return true

I don't quite see what I'm doing wrong...

John
Significant Media
Quote Reply
Re: [Jag] Running slower under mod_perl In reply to
Hi John,

The config options look good - but perhaps there is a problem with having it in /cgi-bin, since /cgi-bin also (usually) gets its own <Location ...> section in the config file? Does it work if you move it to /perl/gforum?

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Running slower under mod_perl In reply to
Jason,
I'm not experienced enough with mod_perl to know exactly how it works. When you talk about a potential problem being the location, do you mean that I should move the whole cgi-bin contents to a different location (for example /perl/gforum) ?

I am working under a virtual server system for the forum. Mod_perl is running on the virtual server from root and loading modules and from what I have understood the startup.pl file affects all virtual hosts.

Also in a previous message (concerning another GT product) I had used a different startup.pl file with :

#!/usr/bin/perl5

$ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl/ or die "GATEWAY_INTERFACE not Perl!";

use strict;
use lib qw(/usr/local/bin/perl5.00503);
use lib qw(/local_path/gtm/admin);
use CGI ();
CGI->compile (':all');
use DBI ();
use DBD::mysql ();
use GMail::mod_perl ();
1; # return true

(link to other message : http://www.gossamer-threads.com/...i?post=169462#169462)

Why doesn't your example in the install files not include the :
use strict;
use CGI ();
CGI->compile (':all');

and what does this help :
use lib qw(/usr/local/bin/perl5.00503);

Thanks, John
Significant Media
Quote Reply
Re: [Jag] Running slower under mod_perl In reply to
Hi John,

Basically what I was trying to say is that if it isn't running under CGI, my best guess is that the apache configuration for the cgi-bin is catching it and handling it instead of the mod_perl part of the configuration, so your script is actually running under CGI.

Perhaps, to test, try installing a new test GForum at /perl/gforum instead of /cgi-bin/gforum, and then changing the <Location> section to read: /perl/gforum instead of /cgi-bin/gforum.

'use strict;' is a programming option - it doesn't actually affect the running code. Virtually all of our code runs under 'use strict' as it is specified in each module. In the few lines of code shown there, there is nothing that 'use strict' would catch, so it was simply omitted. Since 'use strict' does not follow into libraries, it has no effect outside the startup.pl file.

The startup code shown in the README.mod_perl file is intended to only give you enough to get Gossamer Forum set up and working; however, other scripts that you have under mod_perl may need or benefit from other lines in the config file.

As for the other lines, none of our current products use CGI - we have our own module (for speed and compatibility reasons) called GT::CGI that provides what we need of CGI.pm's functionality. It (GT::CGI) is loaded when you "use GForum::mod_perl", "use GMail::mod_perl", "use Links::mod_perl", etc. Gossamer products certainly don't need, use, or benefit from 'use CGI' or 'CGI->compile(":all")' - but possibly something else running under your mod_perl installation does.

'use lib qw(/usr/local/bin/perl5.00503);' - I'm not sure why this is there. Depending on how Perl was installed, , that path should already be in the library search path - but possibly it isn't, and certain perl modules (DBI.pm, or DBD::mysql, perhaps?) are installed there. It doesn't hurt anything to have it there - and if it works with it there, I'd be tempted to leave.

All Gossamer Forum needs in the startup.pl file is:

use lib '/path/to/your/admin';
require GForum::mod_perl;

And, of course, the obligatory "1;" at the end of the file. ("require" can be harmlessly changed to "use" - it makes no difference here).

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Running slower under mod_perl In reply to
OK Jason, thanks for your answers, I'll try what you suggested out...

John
Significant Media