|P is for Practical|
More than mod_cgi less than mod_perl.by techcode (Hermit)
|on Jun 07, 2005 at 10:16 UTC||Need Help??|
techcode has asked for the
wisdom of the Perl Monks concerning the following question:
Hello fellow Monks.
I've been thinking about this for a while - and after some time I posted it on devshed.com Perl forum. Got some nice responses and a hint that I should post it here (after I refine it a little bit). So here I am.
Currently to create web applications with Perl, you have (mostly used) two options : mod_perl and mod_cgi
1. mod_perl - great, fast and beside requiring from you to be a good programmer isn't widely available (security problems mostly - some people point out higher memory usage). So you need some form of dedicated hosting (virtual private host an option too) to be able to run it.
2. mod_cgi - It has served us for years but it's getting quite old and what most people care for - it's slow.
[There are other things like Fast CGI, Apache::PerlRun and things like that, but they are even less available than mod_perl. Or run under mod_perl, so it's basicly same thing.]
What I thought that it would be a good thing is that we should get something between these two. Something that would be faster than mod_cgi, yet not as "complicated" as mod_perl. As you may know : "Sometimes, less is more!".
Ideally it would :
- intended for plain people, regular John Doe's who doesn't have money or knowledge to get an dedicated hosting.
- be able to run unaltered Perl/CGI code, even if it's bad style ...
- be part of Apache distribution. Actually it should replace mod_cgi if it can comply with previous
- be faster than mod_cgi by using some of the techniques of mod_perl, not necessarily as fast as mod_perl
That's about it. If anyone has something to add, I would like to hear it.
My idea :
- Embed Perl "inside" Apache so that it doesn't need to be reloaded on each request. It should help with the speed.
- Provide clean memory on each request, so that dirty CGI scripts would also run.
- Maybe cache things like precompiled application and such things. But then again it shouldn't cache too much things because then memory usage would rise.
My first thought when I saw Apache::PerlRun is to simply use it. But as it turns out, it's not so great. I mean, if it were so great, then Apache would be configured in such a way. That PerlRun would run all CGI scripts ...
I also wondered how PHP (I'm not sure if PHP under Apache runs only under mod_php or if there is another way) is doing it (faster than CGI - almost as fast as mod_perl but uses less memory)
Any ideas and/or comments are welcome.
PS. Please don't reply with comments about how mod_perl is great. I know! I know that it can do much more things than PHP - like Apache handlers and other things. Many replied with post like that on devshed, waisting their time to tell me something I already know. Just think that something faster than CGI, yet not as powerful as mod_perl is needed - something for the masses to use.