struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: [offtopic] periodic cleanup task scheduling for webapp?
Date Mon, 04 Dec 2006 23:22:35 GMT
Hash: SHA1


Leon Rosenberg wrote:
>> On 12/4/06, Christopher Schultz <> wrote:
>>> J. Patrick Bedell wrote:
>>> Hello,
>>>   Sorry for the offtopic question!
>>>   How might I configure my servlet container or webapp web.xml so
>>> that a periodic application performs a cleanup task for my webapp's
>>> database?  I want to have a cleanup application (say, a particular
>>> java class) run periodically without triggering it on user input.
>> Does your cleanup have to run from your webapp? If not, I would
>> recommend just using a plain-old command-line java program and schedule
>> it regularly using cron (UNIX) or whatever task scheduler is available
>> on win32.
> Why if i may ask?

I recommend off line batch processing for a number of reasons:

1. There is usually no reason to make it part of the webapp.
   If it's not necessary, my policy is not to do it.

2. If you have several app servers and only one database, why
   have all the app servers run database cleanup routines?

3. Why take up resources in your app server (connections, CPU time,
   etc.) that you can offload to another machine for these operations.

4. An out-of-process utility can be run from anywhere, and does not
   require the weight of a servlet container -- in case you want
   to run it standalone independently of your webapp (related to
   #2 and #3).

#1 is really my -- heh -- #1 reason not to do it. Cron is also simpler
and more reliable than an in-webapp scheduled job. It can run scheduled
processes that should have been run during downtime and it can run while
the webapp itself is down.

- -chris

Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message