in reply to Database driven web content: live or tape?

I am at a similar point in the planning of a project too; having finished over a month of interviews and page specifications, am about to roll up the sleeves.

I'm planning on using HTML::Template, CGI::Application, and DBI with MySQL and using MySQL's query cache. Cron will generate images and possibly pdfs or word documents at night or when modified, the main load being searches on a product catalog by up to 2000 distributors, and the templating.

I am leaning toward mod_perl for performance, though because of very limited time to build it, may develop without mod_perl (but with strict) first.

I'm wondering about how much speed is gained in maintaining a persistent connection with Apache::DBI, and with templates being cached, so I can make an better decision about using mod_perl. I know it's great, and have used it, but I don't have time to wrestle with CGI::Application and restart the server a hundred times. I'm looking at. Application Performance using DBI and mod_perl now.

I also was just looking at The HTML::Template page and it mentions a 90% speed increase using Template caching in mod_perl, plus a way to save a ton of memory by sharing the template cache between the processes.

  • Comment on Re: Database driven web content: live or tape?

Replies are listed 'Best First'.
Re: Re: Database driven web content: live or tape?
by fuzzyping (Chaplain) on Jul 20, 2002 at 20:12 UTC
    This is an excellent solution, IMHO. I'm implementing the very same design for my DNS submission site, and the performance difference between mod_perl and non-mod_perl is breathtaking. The main (minimal) differences you'll find with coding for mod_perl is the care you must take with your scoping. It was this project, in fact, that helped me to finally understand lexicals.

    Abstracting the HTML via HTML::Template was a wonderful choice as well... our non-perl coders will be able to update/modify the template pages to fit our company's overall site theme. Note, however, that HTML::Template shouldn't be called directly... CGI::Application has inherited the necessary methods from HTML::Template.

    With respect to Apache::DBI, I don't know that it's necessary to restart your server each time you make modifications to your code. Yes, it's recommended (but is it necessary?), but I've been able to continue coding and testing without being *required* to restart. The main difference... you'll notice some namespace(?) errors in your error_log until the next time you restart. As far as performance, I can't really help you there... it's my understanding that when using mod_perl, Apache will automagically use Apache::DBI if you're using the MySQL drivers (although I might be talking out of my ass).

    I'll probably play with Benchmark::Timer this week to track the difference between my mod_perl and non-mod_perl scripts. Mind you, there's no difference in the code, just the interpreter.

    -fp
Re: Re: Database driven web content: live or tape?
by talexb (Chancellor) on Jul 22, 2002 at 01:44 UTC
    I am drooling at the thought of using mod_perl but unfortunately I don't have that option (I am hosted on pair Networks and they don't offer mod_perl). I expect to setup and teardown a DBI connection with each uncached page hit, so after a page has been hit once, we just go to the cache for it after that.

    I may well set the expiry date to half an hour in the future so that the cache doesn't get too stale.

    --t. alex

    "Mud, mud, glorious mud. Nothing quite like it for cooling the blood!"
    --Michael Flanders and Donald Swann

      I wonder if it would be possible to simulate the persistent db handle of mod_perl with an IPC connection to a separate cgi process. Supposedly could renew itself every few minutes if the provider limits processing time.