Practical mod_perl 121
Practical mod_perl | |
author | Stas Bekman & Eric Cholet |
pages | 858 |
publisher | O'Reilly |
rating | 8 - Good book, some flaws |
reviewer | Tony Williams |
ISBN | 0596002270 |
summary | Good overall guide for running and developing with mod_perl |
The almost 900 pages are divided into five parts and a bunch of appendices. Part I, "mod_perl Administration" covers building, configuring and installing mod_perl, followed by some Apache details and an 80-page guide to coding with mod_perl in mind. Part II, 'mod_perl Performance' deals with ways of getting the best out of Apache and mod_perl, with a little about security. Part III deals with databases, including persistent connections and data sharing. Part IV is a great guide to debugging and troubleshooting. Part V is a brief look at Apache 2 and mod_perl 2.
The appendices are useful. The first is a short section of around a dozen small 'recipes' for performing various tasks using mod_perl. I found these a good base for more complex tasks, particularly when combined with examples from elsewhere in the book. The second is a list of Perl modules that extend Apache and mod_perl with a brief description of each. The third gives some strategies for providers wanting to host Apache with mod_perl. The fourth and fifth give good overviews of the Template Toolkit and AxKit, an XML application server built on mod_perl.
The book is readable, tending towards heavy writing and certainly dense, but I didn't feel this was a problem in a book meant for a fairly advanced audience. I think you'd want to be a fairly good Perl programmer and well versed in Apache before needing this volume and shouldn't expect to be spoon fed. I thought it well written.
In a book of this size you expect to find a lot of example code, and you won't be disappointed. The book is peppered with short Perl examples and example command lines and configurations, all well explained. The one shortcoming is that there aren't many examples of full-blown applications where you can see everything discussed and have it explained all in one place. I would have appreciated some more of this, the examples tend to be on the short side.
This book sits well in the marketplace. It provides more details on running, installing and configuring mod_perl and Apache than mod_perl Developer's Cookbook (and also delves more into the reasons for doing something one particular way and much more help on debugging), though the Developer's Cookbook becomes a good companion to this volume as it provides a lot more in the way of examples. For those that want to get deep into the high end of mod_perl there is Writing Apache Modules in Perl and C, which is at core a good book on high end mod_perl programming.
O'Reilly have their usual website with Table of Contents, an example chapter, and errata. The authors have their own website with some of the same information and all the code examples from the book as both individual files and one 40k tarball.
I would recommend this book to anyone who administers and writes for mod_perl, it fills the missing pieces in mod_perl Developers Cookbook and is a good companion volume to it.
You can purchase Practical mod_perl from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
I'd like to draw your attention to (Score:1, Informative)
Re:Perl != Good (Score:2, Funny)
it's Perl ne 'Bad', duh.
Re:Perl != Good (Score:1)
thanks-- (Score:4, Insightful)
There. Isn't a little common courtesy refreshing?
Re:thanks-- (Score:1)
although i think in this case (attempting to summarize a 900 page behemoth) it might be.
Re:thanks-- (Score:2)
An e-mail to the author would be wonderful (it's on his home page). Posting it on Slashdot isn't a scalable behavior. Just ask, "what would happen if everybody who likes an article posts a 'thank you' note?" Low signal-to-noise ratio, that's what. If these folks also add accolates to their posts, pointing out how wonderful they are, they'll probably receive accusations of karma-whoring or smugness.
Re:thanks-- (Score:1)
When I stepped back to chew over your post, I realize that I agree.
However, I must say 'thanks' once in a while in a public forum, where the author can get a little approbation in front of his/her audience.
too much bitterness--lack of sweetness and light.. sugar low-- blacking out...
Re:thanks-- (Score:1)
--Eric, co-author
Re:thanks-- (Score:2)
But even informative posts tend to be negative. The nature of dicussion forums is that signal is information that isn't in the article, so it is just natural that most signal is the opposing view. This results in quite a negative atmosphere. So it's good to have a reminder like
Re:thanks-- (Score:2)
Re:thanks-- (Score:1)
I'm climbin' on my high horse, here.
every review I've read here gets trashed by people that write as if they're proof that life exists at -6 sigma. Trust me. We and this website will NOT catch fire and die if someone bursts into spontaneous politeness, once in a while, eh? They may hyperventilate a bit, but it's good for you. Just try to STOP breathing for a while.
Re:thanks-- (Score:1)
I see your thanks--, and raise you a thanks++
err, I made myself groan on that one, perhaps enough bad humor for the day
Re:My $0.02 (Score:1, Troll)
Re:My $0.02 (Score:2)
general note: what is it (Score:4, Informative)
This is what I know mostly by reputation, rather than direct experience, experts please feel free to correct me
Re:general note: what is it (Score:1)
You can attach Perl to Apache by
how does mod_perl activate? must one compile it in, or is it a configuration switch?
Re:general note: what is it (Score:5, Informative)
A more general view of mod_perl is that it's the Perl interface to the apache API. This means a lot of things to a lot of different kinds of developers, since the Apache API is so rich. It can be used for any of the following things:
You can go on and on with this. The bottom line is that mod_perl isn't really an application builder's toolkit, so much as it's the toolkit-builder's toolkit.
So many times, I've heard people try to compare mod_perl to full-fledged content management systems, and that's just not what mod_perl is. In fact, it's not even a templating system like PHP. It's just the Apache API mocked up into Perl. Granted, there's more than that. There are some utility features, but if you want templating, look at HTML::Mason. If you want content management, look at bricolage. These are systems build on top of mod_perl, and they will reduce (vastly) the number of wheels you need to re-invent.
Re:general note: what is it (Score:2)
I have a couple to add to this. These are ways I have used mod_perl in my current job.
Re:general note: what is it (Score:2)
Re:general note: what is it (Score:2)
Then mod_perl is the wrong choice.
However, I suspect you have other constraints that you're not stating that make it more ideal, but still leave other tools (layered on top of mod_perl) as better choices.
First off, if you just need to add two numbers really fast and return the result via HTTP, you should be writing a C module for apache that does what you want. No need to invoke Perl there.
If you wanted to write something m
Re:general note: what is it (Score:1)
Then mod_perl is the wrong choice.
No it isn't. You suggest alternatives to writing Perl. If he wants Perl to run fast on Apache, which is what he said, then yes, mod_perl is exactly the way to do that.
It maintains an in-memory copy of the perl environment, and compiled versions of your scripts. In addition to giving you a lightning-fast perl environment, it also gives you access to Apache's API from Perl if you want it.
T
Stas is the man (Score:4, Informative)
Maybe this is a stupid question... (Score:1)
Surely, if you'd read the Camel Book and some tutorials/references on the Apache site, you'd be covered?
Re:Maybe this is a stupid question... (Score:2)
Re:Maybe this is a stupid question... (Score:1)
Re:Maybe this is a stupid question... (Score:2)
While Learning Perl gets you started pretty quickly and Programming Perl gets you up to speed, there is still a lot to learn about this complex language.
Likewise, Apache is very complex itself. When you decide to combine them with mod_perl, you have an ever more complex situation to figure out. As one of the other individuals on this thread pointed out, examples are highly prized, and previously there weren't many to be had with a nice detailed explanation. That's the
For price comparisons.... (Score:1, Informative)
There are three good urls for book shopping:
BookPool [bookpool.com], AddAll [addall.com], BestBookBuys [bestbookbuys.com]. Why not let bots do your shopping? And if you like the newer bots, check out Froogle.Google [google.com]
Re:For price comparisons.... (Score:2)
YMMV- I am in no way affiliated with either of those sites.
Is there anything in there... (Score:2)
As an administrator rather than a developer, and as someone who cannot influence what perl goes on the server, was there anything in the book that could help me stop the huge memory footprint per child (th
Re:Is there anything in there... (Score:5, Informative)
Re:Is there anything in there... (Score:1)
It's one thing when computer lingo results in sentences that are unfathomable by the non-tech types. This is an example of a sentence that's even worse...
Re:Is there anything in there... (Score:1)
Re:Is there anything in there... (Score:2)
How about programmers that know how to plug leaky code?
Another option is administrators that know about Apache's MaxRequestsPerChild directive until the leaks are plugged?
Don't blame the tool for the faults of its users.
Re:Is there anything in there... (Score:4, Informative)
Since mod_perl compiles the perl code and keeps it resident in your apache children, code that isn't designed for mod_perl can eat a ton of memory. It's often pretty straightforward to fix this kind of thing, often just by "preloading" some modules. Taking it at face value that you have ABSOLUTELY no control of what code is running on your server, what you need to do is have Apache limit how big Apache children can grow.
Check out the mod_perl docs on child memory size http://perl.apache.org/docs/1.0/guide/performance
Summarizing, play with MaxRequestsPerChild if you're "in a hurry" and check out Apache::SizeLimit or Apache::GTopLimit if you have the time/inclination to do something less heavy handed.
Re:Is there anything in there... (Score:2, Informative)
As to your other problems.... I would get new perl programmers (not that it sounds like that is up to you). The "problem" with mod_perl is that it gives you access to apache at a very low level and that power can be missused rather easily. use strict;
Re:Is there anything in there... (Score:1)
Just a guess. But Solaris needs dramatically more swap than Linux for the same amount of Apache processes. That's because Solaris does not allow you to overcommit memory. Not even if you really really want it, because you know all those Apache processes share a lot of pages.
Re:Is there anything in there... (Score:2)
Having less processes is not really a problem. Newer connections will just be accepted by the kernel and apache will pick them up when it's ready. As to mod_perl taking up more memory, that's expected behaviour. I've got 25Mb mod_perl processes, but no problems because I'v
ModPerl vs Php? (Score:2)
I used to love ModPerl back when I wrote for Unix systems. I thought it was, unlike ASP, simple and elegant. But now it seems like Php is more "in vogue". Is modPerl still actively used as the preferred way to get scalable web server performance?
Re:ModPerl vs Php? (Score:1)
No, you'll be modded down because IIS sucks donkey ballz in terms of stability and security, and because of the obvious flamebait.
I suppose you _could_ run ASP in Apache, but for gods sake why?
I have issues with PHP meself (method signature overloading please???) but I'd take it in a heartbeat over any M$ junk, if only because I'd need M$ junk to test, debug and deploy it...
Re:ModPerl vs Php? (Score:3, Informative)
Re:ModPerl vs Php? (Score:4, Informative)
Re:ModPerl vs Php? (Score:1)
Mason is indeed best run with mod_perl and it's definitely the least painful way of using it, not to even mention most aesthetically pleasing.
Mason can be used through a CGI script, too - basically, you make a CGI script to be an apache Action, and then just set-handler your files to it. Setup might be tricky, but it works.
If you get reasonably bored with ordinary every-day templating modules, you can even run Mason stand-alone (you can simply make an instance of HTML::Mason::Interp and there you go...)
I use both, all day every day (Score:1, Flamebait)
If you want performance, rm -f
Re:I use both, all day every day (Score:2)
Funny. I've never seen Apache installed under /usr/local/etc/. You must be confused. Can I interest you in one of these [naturesdistributors.com]?
Re:I use both, all day every day (Score:1, Flamebait)
so, er, fuck you
Re:I use both, all day every day (Score:2)
So, er, eat a dick.
yawn .... (Score:1)
Ha (Score:1)
Re:Ha (Score:1)
would you like the last word or can we call this pointless diatribe over?
Re:Ha (Score:2)
Re:ModPerl vs Php? (Score:3, Interesting)
Is modPerl still actively used as the preferred way to get scalable web server performance?
We're using it. It's big advantage over PHP is that I write Perl code instead of PHP. Sorry but I just don't like PHP itself.
Re:ModPerl vs Php? (Score:2)
No room for Mason? (Score:1)
I know they can only have room for so much but at 900 pages it's not like they were not shy of a big book.
Re:No room for Mason? (Score:1)
Re:No room for Mason? (Score:1)
--Eric, co-author
Re:No room for Mason? (Score:1)
Enjoyed flicking through the sample chapter on the Web, it's a nicely written book.
Perl, and web security documentation (Score:1, Informative)
www.cgisecurity.com/lib/ [cgisecurity.com]
reading documentation for Perl? as if! (Score:1)
mod_perl 2 contents (lack of) (Score:1)
After all, everyone is itching to have the various filters chained after one another, like running Apache's server side include mechanism over the output of your perl scripts... which is possible only with Apache 2.x.
Good (Score:1)
Good book, but for us noobies more examples are needed.
kris@maficstudios.com [mailto]
sales@maficstudios.com [mailto]
jobs@maficstudios.com [mailto]