本站文章总数为:165
Search Posts

甲骨文vps虚拟机实例防回收保活教程

内容纲要

甲骨文条款 https://docs.oracle.com/en-us/iaas/Content/FreeTier/freetier_topic-Always_Free_Resources.htm

 Important   重要

Reclamation of Idle Compute Instances
空闲计算实例的回收

Idle Always Free compute instances may be reclaimed by Oracle. Oracle will deem virtual machine and bare metal compute instances as idle if, during a 7-day period, the following are true:
Oracle可以回收空闲的始终空闲计算实例。如果在7天内,以下情况属实,Oracle将视虚拟机和裸机计算实例为空闲:

  • CPU utilization for the 95th percentile is less than 10%
    第95百分位的CPU利用率低于10%
  • Network utilization is less than 10%
    网络利用率低于10%
  • Memory utilization is less than 10% (applies to A1 shapes only)
    内存利用率低于10%(仅适用于A1形状)

利用以前写的教程

服务器空跑使用率(cpuburn/memtester)

但是甲骨文的免费vps虚拟机性能比较羸弱,只跑内存测试就够了,附带也会提升CPU占用

amd实例 运行memtester cpu  20-25%左右,我就压测1m内存,毕竟机器才768m内存

脚本

wget --no-check-certificate  https://pyropus.ca./software/memtester/old-versions/memtester-4.6.0.tar.gz
tar -zxvf memtester-4.6.0.tar.gz
cd memtester-4.6.0
make
cp memtester /usr/bin/
nohup memtester 1M >/dev/null 2>&1 &

arm实例内存较大,改为3G,如果你上面跑了东西 内存占用超过3G了,你按上面的1M也可以.cpu会占用30-35%

wget --no-check-certificate  https://pyropus.ca./software/memtester/old-versions/memtester-4.6.0.tar.gz
tar -zxvf memtester-4.6.0.tar.gz
cd memtester-4.6.0
make
cp memtester /usr/bin/
nohup memtester 3G >/dev/null 2>&1 &

如果make  出现 ./compile: line 3: exec: cc: not found
提示这个的 yum install gcc
如果不想全天候跑,可以root添加定时任务
每天00:05到08:05运行

echo "5  0    * * *   root    nohup memtester 1M >/dev/null 2>&1 &" >>/etc/crontab
#有$()命令改为单引号
echo '5  8    * * *   root    kill -9 $(ps -ef|grep memtester|grep -v grep|awk '{print $2}')' >>/etc/crontab

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注