Netflix优惠码论坛
如何判断 OpenVZ VPS 是否超售 - 可打印的版本

+- Netflix优惠码论坛 (https://www.sinovoter.com)
+-- 版块: 合租专栏 (https://www.sinovoter.com/forum-18.html)
+--- 版块: VPS 主机 服务器优惠 (https://www.sinovoter.com/forum-20.html)
+--- 主题: 如何判断 OpenVZ VPS 是否超售 (/thread-8127.html)



如何判断 OpenVZ VPS 是否超售 - netflix - 09-11-2023

VPS 真的有“保证内存”吗?当你运行
代码:
free
时它显示:
代码:
$ free -m
             total       used       free     shared    buffers     cached
Mem:           512         65        446          0          0          0
-/+ buffers/cache:         65        446
Swap:            0          0          0
显示总共 512MB 总内存和 0 个交换空间?这里只使用了 65MB 的内存,远远低于“保证”数量。没有swap交换,因为这正是很多VPS 处理其内存帐户的方式。但真的是所有的进程都驻留在物理 RAM 中吗?
让我们挖掘出 ol' user_beancounters。
代码:
$ sudo cat /proc/user_beancounters | grep -E '(uid|physpages|oomguarpages)'
uid  resource              held       maxheld       barrier         limit       failcnt
     physpages             6662         11570             0    2147483647             0
     oomguarpages          8085         12750         65536    2147483647             0
突出显示“ physpages ”和“ oomguarpages ”数量。根据:
引用:physpages
Total number of RAM pages used by processes in this container.
oomguarpages
oomguarpages parameter accounts the total amount of memory and swap space used by the processes of a particular container.
看起来一个是容器使用的物理页面总数,而另一个是容器使用的页面总数(物理+交换)。这意味着当您获取oomguarpages(您获得的 physpages)时,该容器中进程的交换页面数!现在回到 UBC 读数,这里有
引用:(8085 – 6662) * 4096 / 1024 / 1024 = 5.56MB!
已换出的 31.58MB(8,085 页)。而“
代码:
free
”返回的 65MB 数字仅仅是进程分配了多少——所以实际上只有 1/2 被使用,其中 18% 已经被换出。
这样你你就可以判断你的 VPS 供应商是否“超售”内存并导致您的页面换出。