简体   繁体   中英

Periodic action under mod_perl

How do I perform periodic actions under mod_perl, specifically Apache2?

For instance, I need to reload some data from remote location, process it, and store it in memory. Ideally, I don't want to do this while a request is being served.

I highly doubt alarm is never used across our codebase, so just setting up a periodic alarm won't work. Also external storage (like Redis/Memcached) can be fast but still not as fast as process's own memory.

I believe this can be done using some custom signal, pkill and cron. Signal handler execution may be postponed until cleanup phase if needed.

But maybe there's a more straightforward way? Something really obvious I don't see?

If you built the Perl you embedded into Apache with threading support, just create a thread in the startup script.

If not, it's going to be really complicated to make sure that every Apache process updates itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM