H
howa
I am refering to the tutorial (http://modperlbook.org/html/4-2-3-
PerlModule-and-PerlRequire.html),
about setting up Perl module memory sharing across http childs:
==================================
1. in httpd.conf
Added PerlRequire /home/www/cgi-bin/startup.pl
the its contents is:
use strict;
use lib "/home/www/cgi-bin/";
use TestPM ();
1;
==================================
2. The TestPM's content
use strict;
package TestPM;
my $data;
sub new {
my ($class) = @_;
my $self = {};
bless $self, $class;
return $self;
}
sub init {
$data = "1234567890" x 1000000; # 10M of data
}
==================================
3. test.cgi
#!/usr/bin/perl
print "Content-type:text/html\n\n";
use strict;
use TestPM;
TestPM::init();
==================================
By stress testing the test.cgi, I found memory is not shared at all,
using the top command, e.g.
11290 web 25 0 100m 23m 1620 R 47 0.3 0:00.29 /usr/
local/apache_1.3.41/bin/httpd
11247 web 20 0 101m 23m 1628 R 41 0.3 0:05.15 /usr/
local/apache_1.3.41/bin/httpd
As you can see, each httpd is using 23m, and 1620bytes shared, which I
belive the much data is shared....
Any idea?
Thanks.
PerlModule-and-PerlRequire.html),
about setting up Perl module memory sharing across http childs:
==================================
1. in httpd.conf
Added PerlRequire /home/www/cgi-bin/startup.pl
the its contents is:
use strict;
use lib "/home/www/cgi-bin/";
use TestPM ();
1;
==================================
2. The TestPM's content
use strict;
package TestPM;
my $data;
sub new {
my ($class) = @_;
my $self = {};
bless $self, $class;
return $self;
}
sub init {
$data = "1234567890" x 1000000; # 10M of data
}
==================================
3. test.cgi
#!/usr/bin/perl
print "Content-type:text/html\n\n";
use strict;
use TestPM;
TestPM::init();
==================================
By stress testing the test.cgi, I found memory is not shared at all,
using the top command, e.g.
11290 web 25 0 100m 23m 1620 R 47 0.3 0:00.29 /usr/
local/apache_1.3.41/bin/httpd
11247 web 20 0 101m 23m 1628 R 41 0.3 0:05.15 /usr/
local/apache_1.3.41/bin/httpd
As you can see, each httpd is using 23m, and 1620bytes shared, which I
belive the much data is shared....
Any idea?
Thanks.