Re: How do you use mod_perl for your web application?
On 06/16/2011 12:01 AM, Fred Moyer wrote: I'll start. I have a couple of Apache::Dispatch based applications I wrote. I also work on an Apache::ASP large codebase, and a couple of different Catalyst based systems. All are running on mod_perl 2.0.4 in production (the ops haven't upgraded to 2.0.5 yet). We use CGI::Application on mod_perl 1.31 (I know, I know) with Apache 2 as a reverse proxy. If I were to migrate, I would probably try out something like Mojolicious on Plack on mod_perl2. Performance of mod_perl2 has never been an issue to date, but I have Perlbal doing connection handling as a reverse proxy. We're looking at migrating to PSGI. We actually plan to do a full evaluation of backends (mod_perl2 vs Starman) and proxies (varnish, lighttpd, nginx, apache2, perlbal) with SSL thrown in the mix too (some proxies don't do SSL so we'll look at doing proxy + pound) -- Michael Peters Plus Three, LP
Re: How do you use mod_perl for your web application?
I'm interested in hearing about what application frameworks (Catalyst, CGI::App, Mojolicious) are used here with mod_perl. Currently, I use plain mod_perl2 2.0.4 with apache2 for a project about 10k LOC on the web side and about 32k application's LOC. I would like to know a better framework to use in a very specific case: web side and application are separated in different virtual servers. I see no gain in using Mojolicious in my case. -- Anton Petrusevich
apache2 or mod_perl2 oddball error
I'm not sure this is the best place to ask about this problem, and this is my first posting to this mailing list. I have already asked the freebsd-questions mailing list about this, but have received no replies as of this writing. I'm running FreeBSD 8.2-STABLE #0: Thu Jun 9 09:25:05 EDT 2011 on i386 and I rebuilt all my ports from source shortly after the upgrade. I got a weird error when I tried to start apache2 (using % apachectl -t first): [Mon Jun 13 10:16:15 2011] [error] syntax error at (eval 21) line 1, near require Apache2::Const -\n [Mon Jun 13 10:16:15 2011] [error] Can't load Perl module Apache2::Const -compile = ':common' for server localhost:80, exiting... The Perl module in question is present here: freebsd% ls -l /usr/local/lib/perl5/site_perl/5.14.0/mach/Apache2/Const.pm -r--r--r-- 1 root wheel 25924 Jun 10 17:08 /usr/local/lib/perl5/site_perl/5.14.0/mach/Apache2/Const.pm The httpd.conf file is unchanged and was working since from before the upgrade. In the /usr/local/etc/apache22/httpd.conf file are these lines among several hundred other lines: LoadModule perl_module libexec/apache22/mod_perl.so Include etc/apache22/Includes/*.conf The only reference to the Apache2::Const module is in an Apache config include file: PerlModule Apache2::Const -compile = ':common' I have these FreeBSD ports installed among several hundred others: perl-5.14.0 apache-2.2.19 ap22-mod_perl2-2.0.5,3 Neither of these two commands gave any output at all: freebsd% perl -e 'use Apache2::Const qw( :common ); freebsd% perl -M'Apache2::Const -compile = qw(:common)' -e 1; This command gave one line of output: freebsd% perl -MApache2::Const -e 'print $Apache2::Const::VERSION, \n'; 2.05 The above problem did not occur before the upgrade when I was running: perl-5.12.3 apache-2.2.17_1 ap22-mod_perl2-2.0.4_2,3 I don't know how to debug this problem. No log files in /var/log were changed by running the apachectl(8) command and there have been no new lines added to /var/log/httpd-error.log since I rebooted and shut down apache2 on June 9th as part of the upgrade. Any and all ideas welcome. Regards, web... -- William Bulley Email: w...@umich.edu 72 characters width template -|
Re: apache2 or mod_perl2 oddball error
On Thu, Jun 16, 2011 at 9:28 AM, William Bulley w...@umich.edu wrote: The httpd.conf file is unchanged and was working since from before the upgrade. In the /usr/local/etc/apache22/httpd.conf file are these lines among several hundred other lines: LoadModule perl_module libexec/apache22/mod_perl.so Include etc/apache22/Includes/*.conf The only reference to the Apache2::Const module is in an Apache config include file: PerlModule Apache2::Const -compile = ':common' Hmm, odd that it wouldn't work under 2.0.5 but it would under 2.0.4. No idea why offhand. Do you use a startup.pl in your application? I have these FreeBSD ports installed among several hundred others: perl-5.14.0 apache-2.2.19 ap22-mod_perl2-2.0.5,3 Neither of these two commands gave any output at all: freebsd% perl -e 'use Apache2::Const qw( :common ); freebsd% perl -M'Apache2::Const -compile = qw(:common)' -e 1; You need to call these statements in the context of a mod_perl interpreter.
Re: apache2 or mod_perl2 oddball error
According to Fred Moyer f...@redhotpenguin.com on Thu, 06/16/11 at 13:56: Hmm, odd that it wouldn't work under 2.0.5 but it would under 2.0.4. My point exactly... :-( No idea why offhand. Do you use a startup.pl in your application? No. The application's URL points to a directory with Mason laden HTML files starting with index.html. Why do you ask? Neither of these two commands gave any output at all: ? freebsd% perl -e 'use Apache2::Const qw( :common ); ? freebsd% perl -M'Apache2::Const -compile = qw(:common)' -e 1; You need to call these statements in the context of a mod_perl interpreter. Forgive me, but I don't understand what you mean. :-( Recall the error message: freebsd# apachectl -t [Thu Jun 16 14:29:15 2011] [error] syntax error at (eval 21) line 1, near require Apache2::Const -\n [Thu Jun 16 14:29:15 2011] [error] Can't load Perl module Apache2::Const -compile = ':common' for server localhost, exiting... I have just searched the entire application source hierarchy for the string :common using the find(1) command. The only file that contains that string is the apache Includes file which has not changed since my system upgrade. Here are several of the lines in that file: #begining of file PerlModule ModPerl::Util PerlModule Apache2::Request PerlModule Apache2::RequestRec PerlModule Apache2::RequestIO PerlModule Apache2::RequestUtil PerlModule Apache2::ServerUtil PerlModule Apache2::Connection PerlModule Apache2::Log PerlModule Apache::Session PerlModule APR::Table PerlModule ModPerl::Registry PerlModule Apache2::Const -compile = ':common' === PerlModule APR::Const -compile = ':common' === PerlModule Apache2::SiteControl PerlModule HTML::Mason::ApacheHandler # Uncomment this next line if you get errors from libapreq2 # about an 'undefined symbol' # LoadModule apreq_module /usr/lib/apache2/modules/mod_apreq2.so LoadModule apreq_module /usr/local/libexec/apache22/mod_apreq2.so . . . Later in this file (and elsewhere in the application) there are uses of, and references to, Apache2::Const, but there are no references to the APR::Const module. I have tried commenting these lines out and tried removing the trailing parameters. In some of the many permutations of these two lines, I get a successful parsing of the httpd.conf file, but likely that is because I commented out the entire line. However, in these cases, I get a dozen error lines like this one: Attempt to free unreferenced scalar: SV 0x28bda050 during global destruction. In no case do I get a successful launch of the apache server, nor do I get any lines in the httpd_error.log file. Any other ideas? Regards, web... -- William Bulley Email: w...@umich.edu 72 characters width template -|
Re: How do you use mod_perl for your web application?
On Thu, Jun 16, 2011 at 12:01 AM, Fred Moyer f...@redhotpenguin.com wrote: I'm interested in hearing about what application frameworks (Catalyst, CGI::App, Mojolicious) are used here with mod_perl. Mason 1.x on mod_perl 1.x and apache 1.x, baby! - Perrin
Re: How do you use mod_perl for your web application?
On Jun 16, 2011, at 12:14 PM, Perrin Harkins wrote: On Thu, Jun 16, 2011 at 12:01 AM, Fred Moyer f...@redhotpenguin.com wrote: I'm interested in hearing about what application frameworks (Catalyst, CGI::App, Mojolicious) are used here with mod_perl. Mason 1.x on mod_perl 1.x and apache 1.x, baby! Whatever old man! David
Re: How do you use mod_perl for your web application?
On Thu, Jun 16, 2011 at 4:07 PM, David E. Wheeler da...@kineticode.com wrote: Whatever old man! I know, it's just a reality of working on applications that have been around for years. These tools are so reliable that they tend to stick around. If I started something new I would probably use Plack, since I've enjoyed using similar stuff in Python. - Perrin
Re: How do you use mod_perl for your web application?
On Thu, Jun 16, 2011 at 1:13 PM, Perrin Harkins per...@elem.com wrote: On Thu, Jun 16, 2011 at 4:07 PM, David E. Wheeler da...@kineticode.com wrote: Whatever old man! I know, it's just a reality of working on applications that have been around for years. These tools are so reliable that they tend to stick around. If I started something new I would probably use Plack, since I've enjoyed using similar stuff in Python. Maybe I'm not completely grokking how people are starting new projects using Plack, but it seems like the way to go is to not use Plack itself to write the code, but to use one of the many web frameworks (Mason2, Catalyst, Mojolicious) and then use Plack to specify what webserver is used. Plack is just middleware. There is a Mason handler for Plack, so it almost seems like you could migrate your existing application to the Plack middleware stack while changing little in your Mason codebase. I see the role of mod_perl2 going forward as not something that applications are written on, but something that webserver middleware interfaces with.
Re: How do you use mod_perl for your web application?
On Thu, Jun 16, 2011 at 1:19 PM, Daniel Risacher mag...@alum.mit.edu wrote: Of late, I've been wanting to go to PSGI or node.js, but I haven't taken the plunge yet. Many of my mod_perl apps relied on client-side PKI and SSL renegotiation, which I don't think can be done in PSGI, (or at least not well) and mod_perl really shines by having hooks for all phases of request handling. Having support for these request phases is definitely something that middleware authors should keep in mind when looking to support mod_perl2 well. I don't think Plack does this right now.
Re: How do you use mod_perl for your web application?
On 06/16/2011 04:18 PM, Fred Moyer wrote: Maybe I'm not completely grokking how people are starting new projects using Plack, but it seems like the way to go is to not use Plack itself to write the code, but to use one of the many web frameworks (Mason2, Catalyst, Mojolicious) and then use Plack to specify what webserver is used. Plack is just middleware. Yes, but lots of people are using Plack to refer to the Plack family of stuff. Mainly the PSGI spec, the middleware and possibly one of the new Plack/PSGI oriented servers (like Starman). I see the role of mod_perl2 going forward as not something that applications are written on, but something that webserver middleware interfaces with. Yeah, that's what I see too. I'd like to see the performance of Starman vs mod_perl for normal applications (that don't need to do anything fancy with Apache). If it's anywhere close to mod_perl than I suspect lots of people would use it instead since it's much easier to setup and also much easier to package with your app since it's just a CPAN module. Would be nice to through FastCGI into that benchmark too. -- Michael Peters Plus Three, LP
Re: How do you use mod_perl for your web application?
- Original Message From: Fred Moyer f...@redhotpenguin.com To: Perrin Harkins per...@elem.com Cc: David E. Wheeler da...@kineticode.com; mod_perl list modperl@perl.apache.org Sent: Thu, June 16, 2011 4:18:17 PM Subject: Re: How do you use mod_perl for your web application? On Thu, Jun 16, 2011 at 1:13 PM, Perrin Harkins per...@elem.com wrote: On Thu, Jun 16, 2011 at 4:07 PM, David E. Wheeler da...@kineticode.com wrote: Whatever old man! I know, it's just a reality of working on applications that have been around for years. These tools are so reliable that they tend to stick around. If I started something new I would probably use Plack, since I've enjoyed using similar stuff in Python. Maybe I'm not completely grokking how people are starting new projects using Plack, but it seems like the way to go is to not use Plack itself to write the code, but to use one of the many web frameworks (Mason2, Catalyst, Mojolicious) and then use Plack to specify what webserver is used. Plack is just middleware. There is a Mason handler for Plack, so it almost seems like you could migrate your existing application to the Plack middleware stack while changing little in your Mason codebase. I see the role of mod_perl2 going forward as not something that applications are written on, but something that webserver middleware interfaces with. Sigh. The big win with mod_perl2 is you get to interface with the rest of the C modules for httpd, often via subrequests. At the ASF we've been running mod_perl2 as our frontline mailserver for over 5y, and recently I wrote an ASF-wide CMS with it that's gaining more and more users as time goes on, in under 5K LOC. Haven't seen the need for app frameworks because most of my code is mod_perl2 specific- it just won't work in any other webserver.
Re: How do you use mod_perl for your web application?
- Original Message From: Fred Moyer f...@redhotpenguin.com To: Perrin Harkins per...@elem.com Cc: David E. Wheeler da...@kineticode.com; mod_perl list modperl@perl.apache.org Sent: Thu, June 16, 2011 4:18:17 PM Subject: Re: How do you use mod_perl for your web application? On Thu, Jun 16, 2011 at 1:13 PM, Perrin Harkins per...@elem.com wrote: On Thu, Jun 16, 2011 at 4:07 PM, David E. Wheeler da...@kineticode.com wrote: Whatever old man! I know, it's just a reality of working on applications that have been around for years. These tools are so reliable that they tend to stick around. If I started something new I would probably use Plack, since I've enjoyed using similar stuff in Python. Maybe I'm not completely grokking how people are starting new projects using Plack, but it seems like the way to go is to not use Plack itself to write the code, but to use one of the many web frameworks (Mason2, Catalyst, Mojolicious) and then use Plack to specify what webserver is used. Plack is just middleware. There is a Mason handler for Plack, so it almost seems like you could migrate your existing application to the Plack middleware stack while changing little in your Mason codebase. I see the role of mod_perl2 going forward as not something that applications are written on, but something that webserver middleware interfaces with. Sigh. The big win with mod_perl2 is you get to interface with the rest of the C modules for httpd, often via subrequests. At the ASF we've been running mod_perl2 as our frontline mailserver for over 5y, and recently I wrote an ASF-wide CMS with it that's gaining more and more users as time goes on, in under 5K LOC. Haven't seen the need for app frameworks because most of my code is mod_perl2 specific- it just won't work in any other webserver. Agreed with this I've been looking around at all these discussions the situation I'm in is probably more complex than writing a single application I manage a large infastructure for a large scientific institute with a small core webteam - and upwards of 200 developers. So my approach to development is probably considerably different to some of the projects here. Currently we are migrating our website to a new mod_perl backed system. It has many requirements so our framework (Developed in house) has to be compact, easy, flexible, and easily extensible, but at the same time give good diagnostics and stop bad code being submitted. The system is a mixture of: * mod_perl handlers to perform routing, mapping URL spaces to perl modules; to handle temporary files; improve error reporting; handle user identity etc; built in caching, optimisation of images/ js/css; * mod_perl output filters to handle page decorating; * javascript/css libraries tied into the system; * integrated support for AJAX; * a series of modules which handle Components (parts of pages which can be included into static HTML/dynamically generated HTML); and Actions (web pages, JSON/XML documents etc) * an SVN based sandbox/dev/staging/production system to pubish code, and check quality tool to force good HTML, Javascript; * tools to monitor changes, etc * ability to write applications as either CGI scripts, mod_perl (using registry) [but both are frowned on], Ruby, PHP, Java, HTML/JavaScript and still have the benefits of the decoration and component system (Ruby, PHP, Java etc just produce raw HTML containing component instructions) e.g. http://www.sanger.ac.uk/resources/databases/tiffin/table.jsp?col=3 Is a JSP wrapped using Perl to look like the rest of the site... In other projects I combine it with PHP to handle a lot of the initial set up - parsing cookies for users etc and populating variables that other applications can use; It has a few more lines of code than yours - but the core of the system is quite compact - it's just the fluff and added features which make it longer... (plus getting the code through perl::critic!) -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
Re: How do you use mod_perl for your web application?
On Thu, Jun 16, 2011 at 4:18 PM, Fred Moyer f...@redhotpenguin.com wrote: Maybe I'm not completely grokking how people are starting new projects using Plack, but it seems like the way to go is to not use Plack itself to write the code, but to use one of the many web frameworks (Mason2, Catalyst, Mojolicious) and then use Plack to specify what webserver is used. Plack is just middleware. I'm just saying Plack looks fun. Maybe I miss the days of writing OO mod_perl handlers. That was fun. There is a Mason handler for Plack, so it almost seems like you could migrate your existing application to the Plack middleware stack while changing little in your Mason codebase. It's clear that you haven't seen this Mason codebase ;) - Perrin
Re: How do you use mod_perl for your web application?
On Thu, Jun 16, 2011 at 1:30 PM, Joe Schaefer joe_schae...@yahoo.com wrote: Sigh. The big win with mod_perl2 is you get to interface with the rest of the C modules for httpd, often via subrequests. At the ASF we've been running mod_perl2 as our frontline mailserver for over 5y This is Apache2::Qpsmtpd right? Nice module. , and recently I wrote an ASF-wide CMS with it that's gaining more and more users as time goes on, in under 5K LOC. Haven't seen the need for app frameworks because most of my code is mod_perl2 specific- it just won't work in any other webserver. I guess I should rephrase what I said earlier; I don't see use of mod_perl2 for web applications going away. I see the usage pattern for Perl based web applications that use frameworks like Catalyst et al becoming one where there is less usage of tightly coupled modules such as Apache::Session and Apache::DBI. The ability to interface with the httpd C modules is a big win that I don't think a lot of users appreciate until their application gets big enough to cause pain. Output compression is one area I've seen people struggle with in Perl land, and write elaborate hacks into their Catalyst application, when they could do the same thing in httpd.conf with 'Include conf/deflate.conf' and just stuff all the mod_deflate directives in that file.
Re: How do you use mod_perl for your web application?
- Original Message From: Fred Moyer f...@redhotpenguin.com To: Joe Schaefer joe_schae...@yahoo.com Cc: mod_perl list modperl@perl.apache.org Sent: Thu, June 16, 2011 5:01:49 PM Subject: Re: How do you use mod_perl for your web application? On Thu, Jun 16, 2011 at 1:30 PM, Joe Schaefer joe_schae...@yahoo.com wrote: Sigh. The big win with mod_perl2 is you get to interface with the rest of the C modules for httpd, often via subrequests. At the ASF we've been running mod_perl2 as our frontline mailserver for over 5y This is Apache2::Qpsmtpd right? Nice module. , and recently I wrote an ASF-wide CMS with it that's gaining more and more users as time goes on, in under 5K LOC. Haven't seen the need for app frameworks because most of my code is mod_perl2 specific- it just won't work in any other webserver. I guess I should rephrase what I said earlier; I don't see use of mod_perl2 for web applications going away. I see the usage pattern for Perl based web applications that use frameworks like Catalyst et al becoming one where there is less usage of tightly coupled modules such as Apache::Session and Apache::DBI. To me writing to a generic webserver API is not all that exciting. Python people love it, but they've never had a proper exposure to httpd in the first place. Yes it means you gain some portability, but the downside is that you lose an awful lot of power that comes from the existing open source module ecosystem for httpd. That's not easily replaced, no matter what others may say. The ability to interface with the httpd C modules is a big win that I don't think a lot of users appreciate until their application gets big enough to cause pain. Output compression is one area I've seen people struggle with in Perl land, and write elaborate hacks into their Catalyst application, when they could do the same thing in httpd.conf with 'Include conf/deflate.conf' and just stuff all the mod_deflate directives in that file. Yup. Content negotiation is another area where people come up with lotsa sloppy hacks. Just run a subrequest with content-negotiation enabled and be happy- it just works.
Re: How do you use mod_perl for your web application?
On Thu, Jun 16, 2011 at 1:26 PM, Michael Peters mpet...@plusthree.com wrote: I'd like to see the performance of Starman vs mod_perl for normal applications (that don't need to do anything fancy with Apache). If it's anywhere close to mod_perl than I suspect lots of people would use it instead since it's much easier to setup and also much easier to package with your app since it's just a CPAN module. Would be nice to through FastCGI into that benchmark too. I tweeted @miyagawa to see if he had this benchmark, and if memory serves mod_perl2 was about 75% the speed of Starman in a hello world benchmark with an unknown mod_perl2 configuration. I believe the Starman cpan page has benchmarks vs FastCGI. My takeaway from those benchmarks was that all of the webservers tested were essentially equally fast since they were within 25-50% of the performance of each other with a simple benchmark. I'm not sold on packaging the webserver with the application though. I've been moving towards using the webserver (in my case httpd/mod_perl2) that is installed with the platform. One less thing for me to worry about, in my case the Centos packagers take care of that problem for me.
Re: How do you use mod_perl for your web application?
Hi Fred, I use mod_perl on a custom built framework written back in 2005 Performance of mod_perl has never been an issue, internal authenication and network speed are more issues. This runs on an intranet and services around 5000 users Regards Greg George From: Fred Moyer f...@redhotpenguin.com To: mod_perl list modperl@perl.apache.org Date: 16/06/2011 02:01 PM Subject:How do you use mod_perl for your web application? I'm interested in hearing about what application frameworks (Catalyst, CGI::App, Mojolicious) are used here with mod_perl. Given the number of emerging Perl based webservers on CPAN (in addition to Nginx, lighty, etc), it seems like there are many more Perl web application and webservers out there now than there were five years ago. I'll start. I have a couple of Apache::Dispatch based applications I wrote. I also work on an Apache::ASP large codebase, and a couple of different Catalyst based systems. All are running on mod_perl 2.0.4 in production (the ops haven't upgraded to 2.0.5 yet). If I were to migrate, I would probably try out something like Mojolicious on Plack on mod_perl2. Performance of mod_perl2 has never been an issue to date, but I have Perlbal doing connection handling as a reverse proxy. *** Please consider the environment before printing this e-mail. This message is intended solely for the individual(s) and entity(s) addressed. It is confidential and may contain legally privileged information. The use, copying or distribution of this message or any information it contains, by anyone other than the addressee, is prohibited. If you have received this message in error, please notify postmas...@orica.com. The mailbox address from which this message has been sent is for business mail only. Mail sent to it may be subject to security scanning and delivery on non-business messages sent to this address may not occur. Thank you. ***
Re: How do you use mod_perl for your web application?
On Thu, Jun 16, 2011 at 2:01 PM, Fred Moyer f...@redhotpenguin.com wrote: I'm interested in hearing about what application frameworks (Catalyst, CGI::App, Mojolicious) are used here with mod_perl. We have a lot of code using CGI::App as well as a mix of in-house custom frameworks (old legacy stuff that goes back 8 to 10 years). All our apache/mod_perl servers sit behind three nginx boxes that do caching, SSL offloading and content compression. 90% of what is behind the proxies is running apache2/mod_perl2 (stock debian packages for ease of maintenance), but there is still some apache1.3/mod_perl1 stuff hanging around too. Some apps run through FastCGI, but the majority are mod_perl content handlers or Registry scripts. Cheers, Cees