What really makes mod_perl better than Java?
This is a common thread, which you should look up in the archives. It's
best to avoid starting up a discussion with this vague a question, since it
will lead to a flood of advocacy e-mails.
Didn't the eToys guys do some benchmarking? (Perrin?)
We
i am not sure what they are using mod_perl for.
Ticketmaster.com also owns CitySearch.com. They run CitySearch.com on
mod_perl. You may want to check back on Ticketmaster.com in a few months.
- Perrin
Actually, yes, I had. PerlVINC is not really what I needed, the goal was
not to reload %INC per VirtualHost, the need was to have a single
PerlRequire set up @INC properly per VirtualHost (so Apache::StatINC
would work). Ordinary this would have been done with something like 'use
lib
I understood the limitation of the single interpreter, the problem again
was to append to @INC per VirtualHost.
It's confusing when you say that, since there's only one @INC for
everything. I'm interpreting this as meaning that you have a bunch of
applications with different install
I'm sharing memory between httpd processes using IPC::Shareable. It is
working
but seems to behave inconsistently (memory is often not being freed
etc..). I'm
using it for creating common cached areas for file and database contents
shared
between httpd children. Is there a better way to do
After checking Apache code for mod_proxy looks like it is normal
behaviour.
File modules/proxy/proxy_util.c function ap_proxy_send_fb. This function
reads from originating server into buffer and then writes to the customer
from
this buffer. BUT the socket is closed AFTER all the data is sent
I'd like to have a controller module, where any url
that has a .phtml page will call the handler in the
controller module. Within the controller module I use
logic to determine which module (if any) should
process the request using push_handlers.
The issue is that I'm using virtual urls,
Your script uses an END block to disconnect. If you use
Apache::Registry, that will not be run until the server is shut down.
With Apache::DBI, you should get one connection per Apache process, and
they'll stay open. If you are changing the login parameters (i.e.
different user each
Your script uses an END block to disconnect. If you use
Apache::Registry, that will not be run until the server is shut down.
With Apache::DBI, you should get one connection per Apache process, and
they'll stay open. If you are changing the login parameters (i.e.
different user each
We have also heard something about OpenInteract, which is based on
Template Toolkit - may be it would be simplier to use it?
It does sound like a possible good choice for your purposes, since it
combines a basic application structure with Template Toolkit integration and
an object/relational
We have also heard something about OpenInteract, which is based on
Template Toolkit - may be it would be simplier to use it?
It does sound like a possible good choice for your purposes, since it
combines a basic application structure with Template Toolkit integration and
an object/relational
Before running my perl script (f1.pl) i see five httpd@hostname sessions
in
Oracle V$session but at the moment in which i run f1.pl there appear a
seventh session alone such f1.pl@hostname.
The mechanism of persistent connections seems to be not workinkg properly.
What is it that makes you
DJ (David J Radunz) wrote:
I am having a problem with a module im writing connecting to the
database everytime its run, and not cleaning up the database
connection when its finished.
Your script uses an END block to disconnect. If you use
Apache::Registry, that will not be run until the
I am getting a segmentation fault on configtest when using Apache::DBI
(using the startup.pl example in Apache::DBI Distribution). When trying
to start the server I get no error messages but the server isn't
running afterwards
Do you know that your DBI works without Apache::DBI? It would be
i've seen discussion at perl.apache.org/guide about having a
hefty mod_perl server with a lightweight server proxying
the heavy-lifting requests to the mod_perl server (same machine,
different machine).
can this be done with mod_ssl and mod_perl?
Yes, lots of people do that. You need the
Tatsuhiko Miyagawa wrote:
Announcing the Adapter module which provides a way to use
Cache::Cache subclasses as Apache::Session storage implementation.
Hmmm...
Don't take this the wrong way, but what's the purpose of this?
Apache::Session does very little beyond what Cache::Cache does. In
princepawn wrote:
Above and beyond the efficiency issues you discuss above, could you
comment on what Apache::Session would need to be useful in a serious
project?
I was commenting specifically on the ID generation. The algorithm
supplied does not guarantee unique IDs, especially when you
Tatsuhiko Miyagawa wrote:
Cache::Cache is a cache interface for any key-value pairs with
optioinal automatic expire purge.
Apache::Session is a framework for persisntent hash data with
unique identifier and automatic serialiization/deserialization for
hash.
To me, they both look like
ok, i'll look into that. I've been using RLimitMEM and RLimitCPU
One thing to be aware of is that using rlimit will kill your process harshly
when it goes over the limit. It's better to use Apache::SizeLimit for basic
size control, and use rlimit as a backup safety measure to catch runaway
Oddly, if you just do
my $sub = sub { $var; };
it does not grow, definately something strange going on. Happens on
perl 5.004_04, 5.005_03 and 5.6.1.
You mean this works for you?:
while (1) {
{
my $var = 'x' x 50;
my $sub = sub { $var;
Just wanted to ask to any embperl user, is there any real advantage
about using embperl instead of PHP ?
If you want a high-level summary of Embperl features, you could take a look
at my article on perl.com:
http://www.perl.com/pub/a/2001/08/21/templating.html
- Perrin
sorry, I think I misread the question - the verbosity threw me.
No, I think you got it right. He wants to share a hash between multiple
Apache children.
I recommend using either MLDBM::Sync or Cache::Cache for this.
- Perrin
Syntax error on line 304 of /export/apache/conf/httpd.conf:
Can't load
'/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/DBI/DBI.so' for
module DBI: ld.so.1: /export/apache/bin/httpd: fatal: relocation error:
file /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/DBI/DBI.so:
With this simple test script:
print Content-type: text/html\n\n;
my $var = 'x' x 50;
my $sub = sub { my $sub2 = sub { $var; }; };
print Done\n;
$var does not get freed, and the process grows each request. Has anyone
seen this sort of behavior and have any ideas/workarounds (besides
The DBI installation went fine, I used CPAN. DBI version is 1.20. I looked
for the DBI.so and the DBI.pm files and they are in the correct paths.
What may be the problem?
I don't know, but you might have more luck asking about it on the DBI list.
Or you could do some searching on Google for
Further...no one needs to know or care about PerlMod around hereI
posted a
question two weeks ago about Apache::AuthDBI...and no one responded.
So looks like you are on your own..
Not true; people do know and care about Apache:: modules around here. There
are lots of reasons why you
I don't think Cache::Cache has enough logic for an atomic
read-modify-write in any of its modes to implement (for example) a
web hit counter. It has only atomic write. The last write wins
strategy is fine for caching, but not for transacting, so I can see
why Rob is a bit puzzled.
In his
I dont know what I've done, but somehow my httpd.conf has led to a
number of warnings about me redefining a number of things.
Are you running the latest mod_perl? Do you have PerlFreshRestart on?
- Perrin
2 - Is there anyway to have apache dump to the lag exactly what it is
doing so that I can get some idea of why it has my web browser idling
away and not returning anything?
You can use strace, truss, or some similar tool.
- Perrin
One of the shiny golden nuggets I received from said slice was a shared
memory cache. It was simple, it was elegant, it was perfect. It was also
based on IPC::Shareable. GREAT idea. BAD juju.
Just use Cache::Cache. It's faster and easier.
- Perrin
Odd thing #1: As it gets into evening time, load on the machine drops off
and there are fewer httpd children running, but I am not seeing free
memory return to that 1.3GB level. At most it comes back up to 400MB or
so. I don't think the httpd children are hanging on to memory, because
I wrote a program that converts 5 gigs of emails stored in mysql to
phisical messages on disk (resulting in approximately 10 gigs). The
program
consumes way to much memory although I've wrote it in a very clean way
(use
strict, no globals, use of udef $var; to help free memory). I start it
Nope, you've got it. If you don't have transactions (anything else?) to
worry about, I'd say to use
Apache::DBI.
Apache::DBI doesn't have a problem with transactions. If you're doing
strange things like changing isolation levels on particular requests you can
get into trouble, but that's an
Apache::DBI doesn't have a problem with transactions.
Ah, OK. What about when a shared connection is rolled back in one process,
will it effect other running processes with the same handle?
Database handles are never shared between processes. If you missed this,
you should re-read the
Are you using Apache::DBI? Are you opening a connection in the parent
process (in startup.pl or equivalent)?
Yes, yes.
Don't open a connection during startup. If you do, it will be shared when
Apache forks, and sharing a database handle is bad for the same reasons
sharig a file handle is.
After some time of work (about hundred of requests), I get
DBD::Oracle::db prepare failed: ORA-03113: end-of-file on communication
channel
(DBD: error possibly near * indicator at char 1 in '*select
slogan_text
from
slogans') at /usr/local/www/lib/SQL.pm line 221.
and all Oracle-using
On Saturday 18 August 2001 02:36 pm, Philip Mak wrote:
I have a RaQ4i server (450MHz AMD K-6 processor). If I have 20 mod_perl
httpd processes running concurrently, then the system's load average goes
up over 10.0 and CPU usage is 100%. The machine has RAM to spare, so
swapping is not the
I have two mod_perl programs on my site. One is in the directory inr2,
and the other is in the directory otherinr2.
These mod_perl programs have exactly the same code. Both of them do:
use cfg;
where cfg.pm is a file that's in both inr2 and otherinr2, but it's
different in these
My apache server does not start up when I add
PerlModule B::TerseSize
to the httpsd.conf file. Or any PerlModule flag. Any one can tell me
why? I am trying to determine a leakage in my script...
Do you have B::TerseSize installed on your system? It's not a standard
module. Check your
I have learned recently(and the original poster as well) that despite two
files having different file names, and doing a require
/full/path/to/file.pl, modperl will only compile the file once because
they
both have the same package name.
No, I don't think that's correct. Perl will compile
I am running mod_perl 1.2 on NT. I have been working with it for over 4
months, and am beginning to understand it. But for the past 4 months, I
have
complained about a socket problem using IO socket. The only answer I got
was
to turn the max child from 50 to 1. When I do that the IO::Socket
On Tue, 14 Aug 2001, Mike P. Mikhailov wrote:
I'm useing Apache/1.3.12 (Unix) mod_perl/1.25 Embperl 1.3b7 under RH
7.0. From request to request size of the httpd grows and eat all
available RAM. Daemon run under -X option. My question is:
how can I find out which exactly variable
On Tue, 14 Aug 2001, Aleksandr Vladimirskiy wrote:
I am running a perl 5.6.0, mod_perl 1.26, apache 1.3.19 on Solaris 2.6. I
get the following error in my logs:
[Tue Aug 14 10:45:10 2001] [notice] child pid 2630 exit signal
Segmentation Fault (11)
It looks like the child serves a request
On Tue, 14 Aug 2001, Rasoul Hajikhani wrote:
Are there any traps that I should be aware of when using s//g? I was
reading the online mod_perl docs and could not find anything to that
effect. But I do recall working with Perrin (correct me if I am wrong
Perrin) that there were some issues
I have a lot of large MP3 files, and want to restrict the number that
Apache
serves concurrently. Is this possible ? I'm posting it here since I assume
it would require some sort of module to achieve it. ?? (Win 32).
You want mod_throttle. I don't know if it works on Windows.
- Perrin
I see. You mean your session state is not stored on the database,
but stored as encrypted text in session id itself.
Yes, and the problem is whether there is some good
algorithm, which will generate this kind of session
ids. Security is not main part of this solution, but
easy finding of
I try to precompile a perl script on SERVER start-up using the typical
configuration. But I start the server a get a lot of errors or warnings
that
refer to standard Perl modules.
It looks like you're having problem stemming from mod_perl executing the
PerlRequire command twice during
So what is the REASON for this copy-on-first-call behaviour.(there have to
be some reason, if i'm not totaly dull to see it )
It's called a closure. You can read up on it in the Camel book or in Damian
Conway's OO book.
- Perrin
Long time no hear... I heard you moved to NY...
This is true. I'm exploring new territory.
I think I do send a response back to Apache! I
mean I return OK status. Or do you mean something else? Like
$r-header_out(...)?
You need to send the headers (with $r-send_http_header or something
Umm... Is
return OK;
the correct thing to return when using multiple handlers?
Yes, according the mod_perl docs. It only stops if you return something
other than OK or DECLINED.
- Perrin
There have been some messages on the Mason list about people experiencing
startup.pl being loaded twice, even without PerlFreshRestart on. I know the
server restarts during startup, but PerlRequire and PerlModule are both
supposed to obey the laws of %INC, right? I seem to remember some
Not having read anything before this, but it seems that your machine is
going into swap because there is not enough RAM available. That kills
your
performance always. Could you run your test on a different machine or
temporarily switch off the regular server?
Trying to run close to
on 8/4/01 1:34 PM, brian moseley at [EMAIL PROTECTED] wrote:
also, has there been any thought given to locking cached
items? when i'm using a shared cache with multiprocess
apache, the opportunity exists for multiple requests to
access a single session simultaneously, which can lead to
Stas Bekman wrote:
Maybe the guide should include links to the most mature peristence
abstraction layer projects out there:
- Class::DBI
- Alzabo
- Tangram
- SPOPS
I suppose that could fit into the help.pod. Otherwise it's not directly
related to mod_perl, and the guide has to start shrinking
Robert Landrum wrote:
The guide is a great thing, and removing items from it is risky.
Think of it as refactoring.
John Buwa wrote:
Isnt there a way to clear global variable to a null after a web transaction
is complete?
Apache::PerlRun does that.
- Perrin
I think a lot of people's approach, including mine, is to have OO Perl
modules for all database access. In my code (I use Mason), a web page
only gets its data through calls like this:
my $obj = NAIC::User-(DBH=$dbh, EMAIL='[EMAIL PROTECTED]');
$obj-load;
my $groups_list = $obj-groups();
not to mention the HTML embedded all throughout the perl (are they on
glue?)
What's the alternative there? Embed perl in the HTML?
You could do that (Text::Template), or you could use a tool like Template
Toolkit or HTML::Template. See
http://perl.apache.org/features/tmpl-cmp.html for a
As for SQL, I just wish people would expand their horizons a little and
start doing a bit of reading. There are so many different ways to avoid
embedding SQL in application code and I sincerely wish programmers would
THINK before just coding... it's what differentiates scripters from
I have found that stored procedures + perl module wrapper around the
procs.
is a nice, balanced approach.
The procs. give a nice performance boost as they are precompiled into
the
server (we use Sybase).
They are definitely faster, and significantly so.
Maybe so for Sybase. In
http://axkit.org/docs/presentations/tpc2001/anydbd.axp
Is this basically a hash of SQL statements, indexed by DBD type? Or is
there something more that I'm missing? (I should have gone to your TPC
talk...)
I have a CGI application where I do:
require 'db.pl';
where db.pl defines some functions and variables related to connecting to
the database, and then executes C$dbh = DBI-connect(...).
snip
I can get around this by changing Crequire to Cdo, but is that the
correct way of doing things?
Mmm, haven't seen it, but we use LONG instead of CLOB as the datatype
for the sequence. Is there any reason to use CLOB, and does using LONG
make the problem disappear?
Oracle doesn't want you to use LONG anymore. It's deprecated.
Questions for Steven:
Have you followed all the
Gunther Birznieks wrote:
At 07:16 PM 8/1/2001 -0400, Perrin Harkins wrote:
I have a CGI application where I do:
require 'db.pl';
where db.pl defines some functions and variables related to connecting to
the database, and then executes C$dbh = DBI-connect(...).
snip
I
Anybody know if exist some module how CGI::Out for buffering output in CGI
script ?
Is there a reason you can't just append everything to a variable until the
end? If that won't work, you can tie STDOUT. Apache::Filter might help.
- Perrin
http://perl.apache.org/features/tmpl-cmp.html
The article Choosing a Templating System is now available at the above
URL. This is the same material I presented at the O'Reilly conference,
but a bit less rushed. It gives an overview of currently available
templating tools and their basic
In my lightweight httpd.conf, I have:
RewriteRule ^/(.*)\.asp http://66.33.85.239/$1.asp [p]
If I go to http://www.buildreferrals.com/rotatorstats.asp, it gets proxy'd
correctly.
But if I go to http://www.buildreferrals.com/rotatorstats.asp?login=pmak0
(that's the same URL, but with a
But if I go to
http://www.buildreferrals.com/rotatorstats.asp?login=pmak0
(that's the same URL, but with a query string added), then I get a
404
Not Found error.
Of course you do. Your regex ^/(.*)\.asp doesn't match that URL with
the query string.
Why not? I did not put a $ at
Kevin Schroeder wrote:
I want to create a program for mod_perl that shares information in
between all the child processes so they all have current information.
There are many CPAN modules that cover this. Check the guide at
http://perl.apache.org/guide/. One option that's easy to get
is there any good thorough documentation on building custom
config directives other than what's in the eagle book? i
left mine back in au and i don't really want to buy another
one :)
You're in luck, that chapter is on-line:
http://www.modperl.com/book/chapters/ch8.html
I need to save some status informations about each request (in my
filter each request passes through 3 phases : PerlTransHandler,
PerlAccessHandler and PerlHandler.
You want $r-pnotes.
- Perrin
Good work as usual, Joshua.
mod_caucho
used to look a lot faster, but my testing methodology changed.
I used to take the results of the second benchmark run, and
publish those, but this time only ran the -test for minor
caching after starting resin ( tomcat ). So, I'm
Good work as usual, Joshua.
mod_caucho
used to look a lot faster, but my testing methodology changed.
I used to take the results of the second benchmark run, and
publish those, but this time only ran the -test for minor
caching after starting resin ( tomcat ). So, I'm
I do feel that compile time matters, but really with 60 seconds
and high MaxRequestsPerChild, these systems are getting plenty
of compiling caching.
The thing is, if mod_caucho takes 5 seconds the first time it hits each
template, but is the fastest afterwards, these numbers don't give a very
Does this mean that if there's a heavily used script on my system that
needs to be VERY fast, then it may be worth making it into a mod_perl
handler?
Not unless you get astonishing amounts of traffic and your script does
almost nothing. These are very simple test cases, so they exaggerate
no need to do a lookup or rely on PerlSetupEnv On I wouldn't think...
my $ssl = Apache::URI-parse($r)-scheme =~ m/^https/;
Or maybe just look at the port # of the request.
- Perrin
I've sent this email to Template-Toolkit mailing list... but there doesn't
seem to be anyone, so I'm sending it here ...
Um, you did send it at 6:30PM on a Sunday (yesterday). Support on that list
is really good, but you can't expect everyone to be on the same schedule as
you.
How can in
I think that CGI::FastTemplate does all of that.
Please have a look at it, and see if everything you need is not
already in it.
It's a good module for CGI, since it doesn't rely on caching/compiling
techniques, just simple regex stuff. It will use a lot less RAM than tools
that compile
Take a look at http://perl.apache.org/guide/ and read the stuff on libapreq.
- Perrin
What is needed, IMHO, is a clear
framework,/description/phlogeny/geneology of perl templating systems.
I'm writing such a beast for TPC this month, and will publish it when it's
ready. I'm not covering every templating module on CPAN though, just the
ones that people seem to actually use
We use ePerl for a fair number of things, and I have yet to run into
something we needed of which it was not capable. What are you
thinking of?
It's not a question of it not being capable, it's just that most people seem
to choose one of the more full-featured tools. There's lots of talk
on 7/8/01 2:46 AM, Gunther Birznieks at [EMAIL PROTECTED] wrote:
In addition one of the criteria for useful to me is fast. If the
template system is slow, it's quite annoying. However, this goes against
other people's ideas of useful being full featured. As Steven Wright
says (paraphrased) if
yes, i have *yet another* templating mechanism for
mod_perl, and i'd like to add it to CPAN if there are
no major objections.
I hate to be a naysayer, but this doesn't look sufficiently different from
the other options to merit adding it to CPAN. The trouble is, there are
already too many of
on 7/7/01 9:30 PM, Ron Pero at [EMAIL PROTECTED] wrote:
Just received my issue of Dr. Dobbs Journal today, and one of the articles
is A Tiny Perl Server Pages Engine. Pretty nifty.
Read about it here:
http://www.ddj.com/articles/2001/0108/0108g/0108g.htm
Here is an excerpt:
PSP is
I'm building a web application that has a User perl module. I have
several other perl modules that need to know the user id of the current
logged in user (or 0 for a guest user). I was thinking that I could write
the User class in such a way that every time (except the first) a
constructor was
2. Cause any httpd_perl child process which exceeds 20 megabytes in
memory usage to terminate after it's done.
Apache::SizeLimit (and others) can do this.
- Perrin
The minimal-module approach can be managed nicely via Autosplit, which
puts eash sub in its own module with a stub AUTOLOAD that snags things
into core only when they are called
Note that if they do get called this will end up using more memory than if
you had just loaded them during startup,
I've given Filter and SSI a shot according to the perldocs.
It didn't work. I stated to hhack on some of the problems, which first
involved
in the make install depositing them in the wrong diretory, and then they
SSI
needed use Apache::Filter statements added.
Finally, Filter cam back
Joachim Zobel wrote:
Including If-Modified-Since - 304 responding?
No, none of them handle that (well, AxKit?), probably because most sites
need to do more than stat-ing the template files to determine if the
page content has been modified. A site with no dynamic content could be
pre-generated
Brooklyn Linux Solutions CEO wrote:
I have modules controlling all the files and their access and content in the
directy. I have no idea
really why SSI is shut down. I never used it before.
It looks like you're trying to post-process the output of a PerlHandler
with SSI. The only way to
IS there a way of pre-processing and post processing a handler?
Only by using something like Apache::Filter. Apache itself does not support
chaining handlers.
- Perrin
I've seemed to have lost my ability to use SSI whenI use the content
handlers with Mod_perl.
Is there anyway I can fix this?
Can you be more specific about what you're trying to do? You can still use
mod_include with mod_perl installed, and you can use Apache::SSI either
alone or as a
At 14:33 19.06.2001 +0530, you wrote:
Is there something in SSI which cant be done in a better way using Perl
??
Yes.
1. SSI with XBitHack full plays the 304 game for me. Every time the
catalog
database is updated, its SSI frame gets a touch. Thats it. Simple.
Efficient.
2. SSI provides
BEGIN {
delete $INC{'/foo/bar/query.pl'} if exists
$INC{'/foo/bar/query.pl'};
require '/foo/bar/query.pl';
}
Mark, your suggestion doesn't work because of BEGIN.
Ooops, gotta go to sleep. Your suggestion, Mark, will work :) but only in
Registry/PerlRun which executes
Well, this is the last time I am going to bring this up. I am on Apache
NT,
and I have the following .pm file that I believe I localized everything in
order to create a socket. The code below does work. But it never makes a
new socket. As you can see I print out the IO::Socket::GLOB and it
I hate to belabor this point, but I don't want people to get the wrong idea:
BEGIN { do '/foo/bar/query.pl'; }
Sorry, I guess I should have been more explicit. I don't want to
require in the file on every request, but rather only allow the
same file to be require'd multiple times (to
Still seeking assistance form anyone who is experienced with sockets and
mod-perl /apache on NT.
No NT here, but...
Anyway, as my previous email showed, I built a site which used a global
filehandle to a socket. It worked great for about two hours, and then all
of
a sudden stopped. After
From: Steve Wells [EMAIL PROTECTED]
I can use $r-lookup_uri('/cgifile.cgi') to gather up the subrequest and
run it using the run() command. However, the information from the CGI
is passed back to the browser instead of handed off to me for
processing. Is there some way to capture that
wow. template toolkil took a big hit, there. (no mod_perl on
this list? hmm!)
This benchmark can be very non-representive. If you don't know how to
optimize each and every thing under test, you end up with unfair
benchmark and come to potentially wrong conclusions. Take TT, add compiled
Tom Lancaster [EMAIL PROTECTED] wrote:
Absolutely. But I'd like to bring up something I've noticed in
benchmarking
'real' sites: many, if not all, of the templating solutions appear to
parse the whole of an html page. This is at least true of Apache::ASP and
HTML::Mason, which I have used. Is
801 - 900 of 1288 matches
Mail list logo