大网数据广告活动
服务器运维问答

server virtualization shared ram

· 52CE 我爱测

My friend and I got a dedicated server. We'd like to virtualize, so that he has his own linux server and I have my own too. I'd like to share unused RAM between these two virtual machines, so I could run RAM exessive tasks when t…

问题原文

原帖链接 · RealMaks · CC BY-SA 3.0

My friend and I got a dedicated server. We'd like to virtualize, so that he has his own linux server and I have my own too. I'd like to share unused RAM between these two virtual machines, so I could run RAM exessive tasks when there is free RAM avaiable. Is it possible to share unused RAM between two or more machines?

Thanks in advance

已采纳解答

原帖链接 · Roger Jacobson · CC BY-SA 3.0

If I understand correctly, you are asking if it's possible for two virtual machines on the same host to "share" RAM resources, rather than dedicating roughly half of the physical memory to each.

It is possible to do something like this on most of the major hypervisors, though it may not work exactly as you want. The feature is typically called "Memory Overcommit" or "Memory Ballooning". The way it works under the hood, is that each guest VM has a special "balloon" driver that signals to the guest operating system that it is using a chunk of memory. The driver uses a special call to the host hypervisor to inform it that the memory can be reclaimed by the hypervisor for other guests to use.

You could think of the metaphor of a physical balloon that's inside both guests. When you squeeze (deflate) the balloon in one guest, it gets bigger (inflates) in the other guest. The guests can decide how space to provide for the balloon to inflate.

There are a few issues with this scheme:

  1. The balloon driver can only reclaim unused memory inside the guest, so the sharing is cooperative. If one VM has an application that happens to hold onto the memory, the other one is out of luck.
  2. Not all hypervisors can inflate and deflate the memory balloon automatically. For the ones that do, it may not always inflate/deflate when you expect or want.
  3. The fallback for memory overcommit when the balloon isn't able to help, is usually to use swap space on disk. If you end up having to using swap then you're probably in trouble. Performance will slow to a crawl.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-05-25)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。