Apache, mod_perl and a few lessons

Ranguard on 2002-01-10T17:18:26

Well, I launched the site, and supprisingly (considering the lack of testing time we had) it's all working rather well. I have had to learn some lessions very quickly though to make sure it stays working.

The site www.foxtons.co.uk Has front end apache servers serving images and static content which then proxy to a backend DB / CGI / Mod_perl machine.

Lesson 1
Expect double your highest estimate of traffic (it was all running off one box previously, so I assumed not too much even though it was over loaded) and then double it and add some more. - We are getting loads more traffic than I though, there were no usable stats on the old server.

Lesson 2
Set your Apache MaxClients to the highest you can, taking in to account the memory on the machine, it was embarising to realise that the site was slow, not because of the machine load or memory but because it was being hit harder than I thought and just couldn't open enough processes.

Lesson 3
See lesson 2 and apply to back end mod_perl server.

Lesson 4
The mod_perl guide on line http://perl.apache.org/ should be used in conjunctoin with the book "Writting Apache Modules with Perl and C". There were several thing in the online guide that I couldn't find in the book.

Lesson 5
There is NO lesson 5

The main script was written for Apache::Registry, the load on the machine is between 2 and 5 so I definatly need to make it a propper mod_perl handle so it can share global variables such as a TT object. I hadn't realised until recently that this can not be done with Apache::Registry, though thinking about it it make sence.

I did find it interesting that when asking about, it turns out that most people, like my self, haven't ventured into mod_perl handles and tend to use Apache::Registry instead. I got my first mod_perl handle working today, was a lot easier than I thought it would be, still looking into some apache config options, there are just soo many.

Lession 6
PerlInitHandler, the mod_perl book says it can be put anywhere, but then it's quick reference card says it has to be in a Directory block in the conf. Only just remembered this lession.

Well, as usual enough rambeling...


Lesson 5

koschei on 2002-01-10T17:43:56

Hmm. I take the inverse approach. I use mod_perl handlers wherever possible rather than Apache::Registry code.

Except for actual content handlers, for which I use Mason =)

mod_perl handlers

geoff on 2002-01-10T18:38:16

mod_perl handlers really require a paradigm shift, which is why I personally think many programmers don't get into them - Apache::Registry speeds up their CGI scripts and they are happy. Pulling out their authentication code and putting it into a handler just isn't intuitive at first.

if you are really interested digging into the cooler aspects of mod_perl, well, you'll have a ready resource in only a few days :)

Erk

Matts on 2002-01-10T19:37:14

You killed my mozilla! You bastard! ;-)

Not sure what's up with that. I get total freeze up when I go there.

Re:Erk

pudge on 2002-01-10T19:53:07

That's your lesson!

Re:Erk

Ranguard on 2002-01-17T14:06:42

Ahh, yes, umm, sorry :) ?

Darn design agencies and their JavaScript.