优雅的帮助群友吃掉多余的内存

发布于 2023-02-10  75 次阅读


甲骨文新政策,闲置实例可能会被回收。所以挖矿脚本跑起来,小鸡需要充分的锻炼哈哈。闲置的始终免费计算实例可能会被甲骨文回收。若七天内符合以下情况,甲骨文会将裸金属和虚拟机计算实例视为闲置:

95% 时间的 CPU 使用率不足 10%
网络使用率不足 10%
内存使用率不足 10% (仅适用于 A1 实例,即 ARM 实例)

据说是某个 MJJ 收到的停机【非删机】邮件:

As a reminder, Oracle Cloud Infrastructure (OCI) will soon be reclaiming idle Always Free compute resources from Always Free customers. Reclaiming idle resources allows OCI to efficiently provide services to Always Free customers.

On Monday, January 30, 2023, you were notified by email that one or more Always Free compute instances in your account had been idle for 7 days. If these instances continue to be identified as idle, they will be stopped on Monday, February 6, 2023 at 00:00 UTC. If your idle Always Free compute instance is stopped, you can restart it as long as the associated compute shape is available in your region. You can keep idle compute instances from being stopped by converting your account to Pay As You Go (PAYG). With PAYG, you will not be charged as long as your usage for all OCI resources remains within the Always Free limits.

优雅的帮助群友吃掉Oracle A1实例里面多余的内存 quq

将会直接吃掉2G,不够的话可以把下面的bs=20M改成30M quq

只需要把上面的文件放在 /etc/systemd/system/ 目录下面,然后执行

systemctl enable --now just-eat-some-mem.service

就可以简单的在每次开机的时候增加额外的 2G 内存占用,

如果你不希望每次开机自动启动,也可以选择手动启动她!

systemctl start just-eat-some-mem.service

如果临时需要大量内存,希望释放占用也可以简单的执行!

systemctl stop just-eat-some-mem.service

下面是 just-eat-some-mem.service 源代码~~

just-eat-some-mem.service
[Unit]
Description=Just eating some mem for keep Always Free Avalible
 
[Service]
Type=oneshot
ExecStart=/usr/bin/dd if=/dev/random bs=20M count=100 of=/dev/shm/Just-eating-some-mem.bin
RemainAfterExit=true
ExecStop=/usr/bin/rm /dev/shm/Just-eating-some-mem.bin
StandardOutput=journal
 
[Install]
WantedBy=multi-user.target