简体   繁体   中英

will it harmful for server to run a cron job in every second

For the checking of online users who doesn't log out properly but close the browser, I want to run a cron job in every 2/3 second. (I am updating database in every 10 second when logged in)

Will it harmful for server?

Cron lowest possible frequency is 1 minute so you cannot fire anything more often with it. As for overkill - it may or may not be there, but you need to review the code and load it produces yourself.

You can't run cron jobs more frequently than once a minute so this isn't possible from a cron anyways. You'd have to have a process running in a loop with sleep to achieve this, but the idea is overkill anyways - once a minute is fine.

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