RE: Response time of a perl script!!!
In this situation, I think the bottle neck is establishing connection with the database. Apache::DBI helps to maintain persistent database connection. That's why the latter test is 20 times faster. Jason Hi folks, I ran a same perl script twice. First time only under mod_perl, and after under mod_perl and Apache::DBI. The response time of both experiments was very different. The last was fastest than the first approximately 20 times. Is it correctly? If the response time of a perl script with mod_perl is bad, I think that it without mod_perl will be much worse. I also would like to know if when the apache (with mod_perl) starts each child process already has one embedded interpreter or they will have only when the first request arrives. Please, if soneone help me will be very appreciated. Thanks... Edmar, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with Apache::DBI under mod_perl!!
I had some similar problem before. It was caused by the "PerlFreshRestart on". Comment this line out and see what happens. Jason -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Edmar Edilton da Silva Sent: Thursday, November 23, 2000 5:40 AM To: [EMAIL PROTECTED] Subject: Problem with Apache::DBI under mod_perl!! Hi all, I have installed on the my machine the following modules: apache 1.3.12-2 perl-5.00503-10 mod_perl 1.21-10 DBI 1.14 Apache::DBI 0.87 For enable the mod_perl module, I added the below code in the configuration file of apache ("httpd.conf"): # If the perl module is installed, this will be enabled. IfModule mod_perl.c PerlFreshRestart On Alias /perl-bin/ /home/httpd/perl-bin/ Location /perl-bin SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader On Options +ExecCGI /Location /IfModule For load the Apache::DBI module, I also added this line in the "httpd.conf" file: PerlRequire /etc/httpd/conf/startup.pl Inside of "startup.pl" file, I added the following code: #!/usr/bin/perl use strict; # Extend @INC if needed use lib qw(/dir/foo /dir/bar); # Make sure we are in a sane environment. $ENV{MOD_PERL} or die "not running under mod_perl!"; # For things in the "/perl-bin" URL use Apache::Registry; # Load Perl modules of your choice here # This code is interpreted *once* when the server starts use Apache::DBI (); $Apache::DBI::DEBUG = 2; $Apache::AuthDBI::DEBUG = 2; use DBI (); # Tell me more about warnings use Carp (); $SIG{__WARN__} = \Carp::cluck; # Load CGI.pm and call its compile() method to precompile # (but not to import) its autoloaded methods. use CGI (); CGI-compile(':all'); #Initialize the database connections for each child Apache::DBI-connect_on_init ("dbi:Oracle:ora8", "travel", "travel", { PrintError = 1, # Warn() on errors RaiseError = 0, # Don't die on error AutoCommit = 1, # Commit executes immediately } ); But, when I try loading a HTML page of WWW server, the server refuse my request. I think that the problem is in the WWW server that don't load their child process because to the Apache::DBI to be with some problem. During the installation of all the modules didn't have any problem. The apache start correctly, but when I try stoping them, I get a error message that the process failed. Locking the configuration files, can anyone tell me what is happening? Any help will very appreciated. Edmar Edilton da Silva Bacharel em Ciência da Computacão - UFV Mestrando em Ciência da Computacão - UNICAMP - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: dynamic vs. mostly static data
Is a package global var, such as %CACHE in the code below, persistent during the life of a child process? Does each child get a copy of %CACHE after the parent forks? Thanks, Jason i often do something like this where i allow each individual child process to cache it's data. i do something like this: package Apache::Foo; use strict; use Apache::Constants; use POSIX 'strftime'; use constant CACHE_EXPIRES = 3600; # one hour use vars qw[ %CACHE ]; %CACHE = (); sub handler { my $r = shift; eval { my $expires = $CACHE{'expires'} || 0; if ($expires time) { my @data = some routine ; my $t = HTML::Template-new(filename = 'foo.tmpl', die_on_bad_params = 0, cache = 1); $t-param('data', \@data); $CACHE{'data'}= $t-output; $CACHE{'expires'} = time + CACHE_EXPIRES; } $r-print($CACHE{'data'}); }; return print_err($r, $@) if $@; return OK; } 1; btw, i'd really recommend you look into using Template Toolkit. it's a much more powerful and flexible templating system than HTML::Template, but i digress (and might start a flame war against myself by saying this). hth, ky
RE: database access
Is Apache::DBI absolutely necessary if you want to establish persistent database connection per child? Thanks, Jason -Original Message- From: David Hodgkinson [mailto:[EMAIL PROTECTED]] Sent: Monday, November 06, 2000 5:10 AM To: Jason Liu Cc: [EMAIL PROTECTED] Subject: Re: database access "Jason Liu" [EMAIL PROTECTED] writes: In general, how should database connections be handled between parent and child processes? Can you establish database connections from within a handler? Absolutely. And using Abache::DBI caches the connection handle. -- Dave Hodgkinson, http://www.hodgkinson.org Editor-in-chief, The Highway Star http://www.deep-purple.com Apache, mod_perl, MySQL, Sybase hired gun for, well, hire -
RE: database access
Thank you for the help everyone. Jason
database access
Hi, I can access oracle database from the main Apache process, but not from any child processes. I am fairly new to this subject, can someone give me some advice? Thanks in advance, Jason
RE: database access
Thanks for reply. I need some information in the Oracle database for access control. We have some methods in our proprietary library for Oracle access. I have a file called GateKeeper.pm that contains the access handler, sub handler{ ... }. I placed the same code inside and outside of the handler subroutine in GateKeeper.pm. When the Apache starts up, those code outside of the handler subroutine got executed. It queries the Oracle and writes the result in a file. This part works fine. However, when I requests a file and the access handler is triggered, I got an error message says "Undefined subroutine dbChannel::command called at /usr/up/papi/lib/PAPIDatabase.pm", which is a library file that works. In general, how should database connections be handled between parent and child processes? Can you establish database connections from within a handler? Jason "Jason Liu" [EMAIL PROTECTED] writes: Hi, I can access oracle database from the main Apache process, but not from any child processes. I am fairly new to this subject, can someone give me some advice? What error are you getting? You looked in the error logs? What do you mean by "main" apache process? -- Dave Hodgkinson, http://www.hodgkinson.org Editor-in-chief, The Highway Star http://www.deep-purple.com Apache, mod_perl, MySQL, Sybase hired gun for, well, hire -
How to use gcc to build mod_perl
Hi, I was trying to build mod_perl 1.24_01 and apache 1.3.14. I used the following command: perl Makefile.PL make test make install The Makefile wants to use the "cc" compiler. Can I use "gcc" instead? Thanks, Jason