Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Perl cgi without mod_perl, your experience

by Seumas (Curate)
on Jun 22, 2004 at 14:54 UTC ( #368746=note: print w/ replies, xml ) Need Help??


in reply to Perl cgi without mod_perl, your experience

Before I describe my situation, let me mention that I am not a web developer or a professional coder and my site is a hobby.

I run a large auction site. I wrote the entire engine from scratch -- 15,000 lines of PERL with HTML::Template as the presentation layer, PostgreSQL on the backend, served by Apache 1.3.29 on Debian (testing).

My code is somewhat of a mess because I've been learning as I go over the years and without coding experience prior to perl, grasping OO is a huge leap. I'm rewriting my code so in an OO way bit by bit so that I can eventually use mod_perl.

I serve approximately 30,000 pages per day (filled with photos and thumbnails for auctions) on a dual 1.5ghz AMD Athlon machine with 2gb RAM and have an average server load of perhaps 25%. During extreme peak times, it might reach 60% but only for a short duration.

There's really no reason not to use mod_perl unless you're just not sure that your code is up to snuff. Even then, you can run in a modified mode which will still give you some speed benefits to the tune of four or five times.


Comment on Re: Perl cgi without mod_perl, your experience
Re^2: Perl cgi without mod_perl, your experience
by kiat (Vicar) on Jun 22, 2004 at 15:50 UTC
    Thanks, Seumas!

    I'm rewriting my code so in an OO way bit by bit so that I can eventually use mod_perl.
    From my understanding, plain perl code will run with mod_perl. No? I thought all that mattered was making sure that you don't have globals?
      Since your code is persistant under mod_perl, you just want to make sure that it's clean code so it isn't necessary to write your stuff in an OO way.

      Really, you want to write clean code - whether or not you're using mod_perl. If it's clean, you'll be able to move to mod_perl later if you want/need/can.

      Unfortunately, in my case, I'm re-writing a system I wrote from scratch when I was first picking up the language so it's kind of messy.
      It doesn't need to be OO, but as you progress you'll find it's much easier to build modules out of your code and then use them in your applications.

      You are correct about globals, programming under mod_perl is what finally got me into the habit of using my.

      Saying what everyone else has said in a different way:
      Since you're running on Windows, remember that you're going to be loading and unloading perl.exe and the perlxx.dll for every request. This can begin to fragment your memory over time. XP reclaims memory much better than NT did, neither as well as a *nix will. Consider a thousand requests coming in, each loading an interpreter and parsing a script, each with a footprint of between 2mb and 10mb each. This can eat up memory very quickly.

      I suggest opening up task manager and adding the mem usage, vm size, and peak mem usage columns to the processes page. Then try to fire up 10 (or as many as you can) connections to your script and watch the processes come in and out. It's a real simple and fast way to see how that's going to scale. I think somebody posted a simple stress test here before, you could easily do it with a quick POE script as well.

      HTH

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://368746]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2014-08-30 17:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls