Cron作业每分钟超过100个,太多了吗? [英] Cron jobs over 100 per minute, too many?

查看:86
本文介绍了Cron作业每分钟超过100个,太多了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一台服务器,其中包含100个客户端站点,每个站点都有自己的数据库。
我需要每个人每24/7分钟执行一次cron作业,以查看客户端
是否已设置了当时要发布的帖子,如果设置了 is_published 设置为1。
我的问题是,没有可用的基准测试,每分钟100个cron作业会大大降低我的服务器速度吗?我知道这很模糊,但是我正在运行一个Linux服务器,其10MBps端口上具有1024MB的RAM。

Hello I have a server with 100 client sites, each with its own database. I need each one to run a cron job every minutes 24/7 to check to see if the client has set a post to publish at that time, if so set is_published to 1 in the post table. My question is, without benchmark testing available, is 100 cron jobs every minute going to slow down my server significantly? I know this is vague, but I am running a Linux server with 1024MB of ram on a 10MBps port.

推荐答案

是的,出于许多原因,这是一个坏主意。服务器上的负载就是其中之一。您是否真的想投资硬件来在数百个数据库中设置标志 is_published ?客户是否关心长达一分钟的延迟?如果客户数量的增长快于您的预期,会发生什么?

Yes, this is a bad idea, for a number of reasons. Load on the server is one of them. Do you really want to invest your hardware dollars in setting the flag is_published in hundreds of databases? Do clients care about the up-to-one minute lag? What happens if the number of clients grows more quickly than you expect?

有一种更简单的方法。只需在 posts 表中的列中包含 PostedTime 。然后创建一个使用此列的视图:

There is an easier way. Just have a column with PostedTime in the posts table. Then create a view that uses this column:

create view v_posts as
    select p.*, (PostedTime >= now()) as is_published
    from posts;

这篇关于Cron作业每分钟超过100个,太多了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆