doumen6532 2014-05-20 19:01
浏览 21

正确使用Cron Jobs的方法

I am currently developing a website that has to perform a task every 10 seconds. The website checks a database every ten seconds, finds rows that are to be processed, and then run a short script on each row.

The service is working great right now, but I just want to make sure that once the database gets very large, the service will still work efficiently.

I am using a cron job that runs every minute, with sleep functions every 10 seconds.

Thank you for your help!

  • 写回答

1条回答 默认 最新

  • dongluo9156 2014-05-20 19:06
    关注

    Just make sure your tasks don't overlap, i.e. wait till the previous task is over before launching a new one. Otherwise, if your tasks take more than a minute (or whatever timer you've set for them), you'll end up with tons of those running in parallel and your system will run out of available resources.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度