Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
如何判断 OpenVZ VPS 是否超售
#1
VPS 真的有“保证内存”吗?当你运行
Code:
free
时它显示:
Code:
$ 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。
Code:
$ 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 ”数量。根据:
Quote: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 读数,这里有
Quote:(8085 – 6662) * 4096 / 1024 / 1024 = 5.56MB!
已换出的 31.58MB(8,085 页)。而“
Code:
free
”返回的 65MB 数字仅仅是进程分配了多少——所以实际上只有 1/2 被使用,其中 18% 已经被换出。
这样你你就可以判断你的 VPS 供应商是否“超售”内存并导致您的页面换出。
默认联系方式为telegram,需要微信号请留言。
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  如何判断 Xen VPS 是否超卖内存? netflix 0 451 09-11-2023, 06:26 PM
Last Post: netflix

Forum Jump:


Users browsing this thread: