跳到主要内容
博客LinodeLinode Cron时代

Linode Cron时代

以下是我发给host3和host5的会员的邮件。 大多数情况下,这只适用于早期的会员--在我有机会更新模板文件系统之前部署的会员。 看一下你的cron时间也无妨。 删除,或至少把更新b的cron时间从每天移到每周会有帮助。

--

亲爱的Linode会员、

为了减少你的主机服务器上的磁盘I/O负载,我要求你
执行以下命令(以root身份),为你的发行版:

Debian
mv /etc/cron.daily/find /etc/cron.weekly/

红帽子
mv /etc/cron.daily/slocate.cron /etc/cron.weekly/

Gentoo
mv /etc/cron.daily/slocate /etc/cron.weekly/

Mandrake:
mv /etc/cron.daily/slocate.cron /etc/cron.weekly/

Slackware
mv /etc/cron.day/slocate /etc/cron.weekly/

Fedora
不需要改变

这使 "更新b "作业从每天运行改为每周运行。 该
updateb "命令重新索引你的整个文件系统,这样你就可以通过 "locate(文件名)"命令快速找到文件
这样你就可以通过使用 "locate (filename) "命令快速找到文件。 如果你不经常使用
如果你不经常使用 "locate "命令,把索引更新改为每周一次(或者完全删除这个cron job
完全删除)将有助于减少清晨时分的负载。 目前、
当许多 Linodes 试图重新索引他们的
文件系统。

在较新的主机上,这不是一个太大的问题,因为我修改了模板
文件系统,人们在部署时已经移动了这些文件。

如果你做了修改,它没有抱怨说找不到文件(说明它已经被移动了)。
它已经被移动了),请给我发电子邮件,让我知道。

谢谢你、
-克里斯


评论 (3)

  1. Author Photo

    [quote:90ec82635e=”caker”]Below is the email I sent to members on host3 and host5. Mostly this only applies to early members — member’s that deployed before I had a chance to update the template filesystems. It couldn’t hurt to take a look at your cron times. Removing, or at least moving the updatedb cron time from daily to weekly would help.
    [/quote]

    I would like to add that if you do not move your daily cron jobs to weekly as mentioned, or delete them, that you at least “randomize” the times that your daily cron jobs run. This is probably the best way to solve this problem as it allows you to install services as normal and not worry about whether they put cron jobs in daily or weekly, and yet help prevent huge loads on the Linode host at specific times. To do this, simply edit your /etc/crontab file, under the # run-parts entry.

    Here is an example section from an /etc/crontab file:

    [code]
    # run-parts
    01 * * * * root run-parts /etc/cron.hourly
    02 4 * * * root run-parts /etc/cron.daily
    22 4 * * 0 root run-parts /etc/cron.weekly
    42 4 1 * * root run-parts /etc/cron.monthly
    [/code]

    These indicate that cron.hourly jobs run at 1 minute past the hour, cron.daily jobs run at 4:02 am every day, cron.weekly jobs run at 4:22 am every Monday, and cron.monthly jobs run at 4:42 am on the first day of each month.

    An example random change would be:

    [code]
    # run-parts
    16 * * * * root run-parts /etc/cron.hourly
    25 6 * * * root run-parts /etc/cron.daily
    45 6 * * 2 root run-parts /etc/cron.weekly
    55 6 3 * * root run-parts /etc/cron.monthly
    [/code]

    This moves the hourly jobs to the 16th minute of every hour, dailies to 6:25 am, weeklies to Wednesday at 6:45 am, and monthlies to 6:55 on the third day of each month.

    If we all stagger our times randomly like this, we can go a long way towards eliminating some common performance bottlenecks on Linodes.

    Thanks!

  2. Author Photo

    In addition to ‘randomising’ start times, I schedule maintenance cron jobs after hours or on weekends, 😀

  3. Author Photo

    Just a reminder that each time you upgrade the package containing the “find” utility (in Debian, it’s “findutil”), the cron job will likely be unpacked into /etc/cron.daily again, while the old cron job you have moved into /etc/cron.weekly will be left there as an orphan.

    So remember to move /etc/cron.daily/(find|slocate(.cron)?) back to /etc/cron.weekly (overwriting the orphan) after each upgrade of the parent package.

留下回复

您的电子邮件地址将不会被公布。 必须填写的字段被标记为*