This is a discussion on Re: Refreshing stored data at administrator's signal - modperl ; John ORourke wrote: > Colin Wetherbee wrote: >> At the moment (and not in a production environment), every time the >> drop-down list is generated for a web page, the script queries the >> database to retrieve the entire list ...
John ORourke wrote:
> Colin Wetherbee wrote:
>> At the moment (and not in a production environment), every time the
>> drop-down list is generated for a web page, the script queries the
>> database to retrieve the entire list of aircraft. I would prefer to
>> retrieve the list of aircraft when each Perl interpreter starts and
>> then not retrieve it again until the administrator sends a signal.
>> For this particular table, the signal would only occur when new
>> aircraft hit the market, like the Boeing 787 will (hopefully) in
>> December of this year.
>> The most UNIX-ish way to do this, I guess, would be to send SIGHUP to
>> each running perl process, causing it to reload its configuration,
>> update its stored lists, and so forth. I'd rather do this in a more
>> Perl-ish or Apache-ish way, though, and I'd also rather be specific
>> about which list it should update.
> Wouldn't a simpler approach be to just restart Apache when you want to
> update the lists? You could even have the 'add to list' function send
> SIGUSR1 to the parent Apache, causing a graceful restart.
I'm trying to avoid restarting Apache altogether, although I admit it
would be a pretty simple solution.
> Having said that, if running 20 DB queries returning a few hundred
> records is causing you a speed problem, are you sure the DB is running
> efficiently? Is this a very high traffic site? Is there a requirement
> for ultra-fast page generation? I've got pages that make dozens and
> dozens of DB queries returning hundreds of records and do lots of
> post-processing, and I can generate pages in under a second much of the
The point is more like "well, this isn't really super-dynamic data, so
running a query every time I need it seems like a waste of processor
time and disk activity."
It's not causing any slow-down right now, though when the site goes
live, it certainly could.