subroutine redefined

2003-06-14 Thread Batara Kesuma
Hi,

I tried using ModPerl::Registry with this piece of CGI code:

#!/usr/bin/perl -w

use CGI;
use strict;
my $cgi = CGI::-new;
print $cgi-header;
our $count = 0;
for (1 .. 5) {
increase_count();
}
sub increase_count {
our $count;
$count++;
print $count . br\n;
}

It gave me this error:
Subroutine increase_count redefined at /var/www/perl/test.pl line 12.

What is the problem?



Re: subroutine redefined

2003-06-14 Thread Batara Kesuma
On Sat, 14 Jun 2003 16:40:15 +0900
Batara Kesuma [EMAIL PROTECTED] wrote:

 What is the problem?

Ok, I just figured out that the error went away if I restarted the httpd
server.



Re: Perl Run and Load Average

2003-06-10 Thread Batara Kesuma
Hi all,

Thank you for all your suggestions. Now the load average on my server is
back to normal again :) It is around 0.2 - 0.5 now with the same
pageviews. Ok not just normal, actually the load average is even lower
than when I was using CGI (which was around 0.6 - 1.2). 

The changes I made: reduced MaxClients value from 300 to 150 in
httpd.conf, preloaded CGI module by putting it inside startup.pl, unloaded
some DSO modules that I didn't use. 

This article really helps me a lot:
http://perl.apache.org/docs/1.0/guide/performance.html

--bk


Site running mod_perl

2003-06-10 Thread Batara Kesuma
Hi,

Find Job! http://www.find-job.net is the biggest computer and internet
related employment site in Japan. And I just want to let you know that our
site now is running on mod_perl completely. We have around 75000
registered users and 1 registered companies. Our pageview is around 4
million per month. Our whole system was running under plain CGI written in
Perl, until recently we changed it to mod_perl with HTML::Template
templating system. The speed improvement is significant, and the CPUs load
average are lower than when we were running plain CGI.

--Batara Kesuma



Site running mod_perl

2003-06-10 Thread Batara Kesuma
Hi,

Find Job! http://www.find-job.net is the biggest computer and internet
related employment site in Japan. And I just want to let you know that our
site now is running on mod_perl completely. We have around 75000
registered users and 1 registered companies. Our pageview is around 4
million per month. Our whole system was running under plain CGI written in
Perl, until recently we changed it to mod_perl with HTML::Template
templating system. The speed improvement is significant, and the CPUs load
average are lower than when we were running plain CGI.

--Batara Kesuma



Re: Perl Run and Load Average

2003-06-06 Thread Batara Kesuma
Hi Dale,

 Assuming your CGI scripts aren't doing strange things, liking hanging
 around after the session has closed and doing clean-up work, you might
 check your httpd.conf settings on the number of threads and requests per
 threads.  Its possible that your httpd threads are short-lived and
 restarting more often which now requires a lot more work to start since
 Perl is being loaded each time - just an idea.
 
 MaxRequestsPerChild 1000# if this were too low, say 10 or 50,
 you would probably create more load
 
 # If these were out of wack somehow, it could possibly create some
 # unusual
 load conditions
 MaxSpareServers 20
 MinSpareServers 5

I have this setting on my httpd.conf:
IfModule prefork.c
StartServers   8 
MinSpareServers5
MaxSpareServers   20
ServerLimit  300 
MaxClients   300
MaxRequestsPerChild  1000
/IfModule

Any idea on how can I tweak this setting? 


 I would also run top -d 1 while your webserver is running without
 mod_perl to see what scripts are causing the load.  Do you have a
 database running on the same system?  Do you know if it might be doing
 more work?

The database server is on another machine, but I think I should try to
preload DBI module, and see the result.

I just noticed that the load was going down after I restarted httpd. Is
this because of my scripts have bugs? I think I have some DBI connect
without disconnect in my scripts. I will try to fix this and see how is
the result.






Re: Perl Run and Load Average

2003-06-05 Thread Batara Kesuma
Hi Stas,

 Based on your previous questions, my guess is that you are using
 mod_perl 1.99_09. Please be more verbose about your setup when asking
 questions.

Sorry, here is my setup.
mod_perl-1.99_09
httpd-2.0.40

 Do you preload the modules that you use at the server startup? Your
 PerlRun scripts should be the only ones that get recompiled. Try moving
 all the standard modules to startup.pl and see if it gets any better.

My startup.pl looks like:
#!/usr/bin/perl
use Apache2;
use Apache::compat ();
1;

I will try to move all standard modules to startup.pl. Do I need to delete
the standard modules from the scripts after I moved them to startup.pl? I
mean, after I moved:
use MyModule;

to startup.pl, do I need to delete it from the scripts? Or Perl Run will
automatically figure out that it has already been loaded and simply ignore
the one in the scripts? 


 Any reason why you don't use ModPerl::Registry?

Yes, since the scripts were running under plain CGI, they produce too many
errors if run under ModPerl::Registry. I am working on them, and use
PerlRun for the moment.

PS. Congratulations on the publication of your new book :)




Re: PerlRun error - Not a CODE reference

2003-05-28 Thread Batara Kesuma
Hi Stas,

 First upgrade to 1.99_09. Then run its test suite.
 
 After, I think Dale, has reported a similar problem, I have written a 
 dedicated test for this report. You can verify whether it works for you
 
 cd ModPerl-Registry/
 t/TEST -v t/perlrun_require.t
 
 If it doesn't, please report here. If it does, please check what's
 different in your code from this test. Notice that this test ensures
 that it hits the same interpreter, which you can reproduce with your
 code using 'httpd -DONE_PROCESS'

I have upgraded to 1.99_09, and it works now :) You are my savior, thank
you very much :)



Re: PerlRun error - Not a CODE reference

2003-05-28 Thread Batara Kesuma
Hi Dale,

 I tried to run the same configuration a while back using the stock
 release of RedHat 8.0 and received the same problem.  Stas gave me a few
 ideas to try but nothing worked, so I gave up using Apache 2.0 with
 PerlRun mode and had to drop back to Apache 1.3 with mod_perl 1.27.  I
 think you might be at the same dead end that I hit and I spend dozens of
 hours trying to get it to work to no avail.
 
 If you do find the magic bullet, please make sure to post the fix to the
 list so I can benefit from your experience.

I upgraded to 1.99_09 and it works perfectly now. Just go and get it here:
http://perl.apache.org/dist/mod_perl-2.0-current.tar.gz

And you also need to upgrade your CGI.pm to 2.93 to pass the test.

I also have built RPM for my system (RedHat 8.0), you can ask for it if
you want.