EC2 Micro Instance CPU每天定期间隔达到100%

pix*_*eak 8 linux ubuntu amazon-ec2

在此输入图像描述

我知道亚马逊会限制微实例,如果它占用了一定数量的CPU时间,但我不认为是这种情况.所有尖峰出现在UTC时间6:30到6:40左右.我检查了我的cron工作,那时没有安排任何事情:

@reboot ~/path/to/script1.sh >> ~/log/cron.log
0 13 * * * ~/path/to/script2.sh >> ~/log/cron.log
Run Code Online (Sandbox Code Playgroud)

还有什么呢?

PS:请注意,CPU利用率下拉列表设置为"最大值".该图表看起来类似于"平均值".PPS:此实例是双实例负载平衡设置的一部分.

这是我的/etc/cron.daily里面的内容(其他的crons是空的):

apport,apt,aptitude,bsdmainutils,dpkg,logrotate,man-db,mlocate,passwd,popular-contest,standard,update-notifier-common

rhe*_*nik 10

通常情况下,亚马逊上的Ubuntu AMI在/etc/cron.daily早上安排他们的日常cron工作.此计划使用管理/etc/crontab.以下是样本的/etc/crontab样子:

$ cat /etc/crontab 
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
Run Code Online (Sandbox Code Playgroud)

显然,每日任务在上午6:25运行.如果这会影响服务器的直接交付,您可能需要调整这些设置以将日常任务移动到其他时间.此外,您可以调查下的项目/etc/cron.daily.对我来说,它看起来像:

$ ls /etc/cron.daily/
apport  apt  aptitude  bsdmainutils  dpkg  logrotate  man-db  mlocate  popularity-contest  standard
Run Code Online (Sandbox Code Playgroud)

这些中,通常man-dblogrotate会占用CPU的主要时间执行.这些是标准任务,可以进行调整以获得最佳性能.您可能希望调整logrotate和man-db策略.

希望这可以帮助.