vSphere - memory sharing?

User avatar
Flash-04
Уже с Приветом
Posts: 63377
Joined: 03 Nov 2004 05:31
Location: RU -> Toronto, ON

vSphere - memory sharing?

Post by Flash-04 »

Вопрос к спецам по vSphere / ESX:
Это так и задумано что память для VM выделяется под 100% даже если она не используется? Попробовал гуглить, "ничего не понял" (с) какие то рассуждения про ballooning и прочая. В сухом остатке вижу, что если я отдал 8 Gb RAM VM Ubuntu, то столько она и оттяпала, несмотря на что free говорит что 7Gb из них не используется никак.
Not everyone believes what I believe but my beliefs do not require them to.
uncle_Pasha
Уже с Приветом
Posts: 19939
Joined: 30 Aug 2000 09:01
Location: WA

Re: vSphere - memory sharing?

Post by uncle_Pasha »

Flash-04 wrote: 06 Apr 2019 14:09 Вопрос к спецам по vSphere / ESX:
Это так и задумано что память для VM выделяется под 100% даже если она не используется? Попробовал гуглить, "ничего не понял" (с) какие то рассуждения про ballooning и прочая. В сухом остатке вижу, что если я отдал 8 Gb RAM VM Ubuntu, то столько она и оттяпала, несмотря на что free говорит что 7Gb из них не используется никак.
Дык, это скорее Linux - если память есть, то она будет использоваться под page cache.
"free", к стати, должен это показать как buff/cache
User avatar
Flash-04
Уже с Приветом
Posts: 63377
Joined: 03 Nov 2004 05:31
Location: RU -> Toronto, ON

Re: vSphere - memory sharing?

Post by Flash-04 »

ну вот смотрите что творится:
You do not have the required permissions to view the files attached to this post.
Not everyone believes what I believe but my beliefs do not require them to.
uncle_Pasha
Уже с Приветом
Posts: 19939
Joined: 30 Aug 2000 09:01
Location: WA

Re: vSphere - memory sharing?

Post by uncle_Pasha »

Flash-04 wrote: 06 Apr 2019 16:28 ну вот смотрите что творится:
Т.е. реально линух попытался отожрать порядка 2.5 GB (total - free)
"consumed host memory" - это сколько сконфигурировано, насколько я понимаю.
"active memory" - это сколько реально отдано в данный момент VM (замаплено на реальную память после page fault вызванного попытками доступа к страницам, а некоторые из ранее замапленных страниц были возвращены)
Last edited by uncle_Pasha on 06 Apr 2019 16:52, edited 1 time in total.
User avatar
Flash-04
Уже с Приветом
Posts: 63377
Joined: 03 Nov 2004 05:31
Location: RU -> Toronto, ON

Re: vSphere - memory sharing?

Post by Flash-04 »

нет... что тогда "consumed"?
You do not have the required permissions to view the files attached to this post.
Not everyone believes what I believe but my beliefs do not require them to.
User avatar
Flash-04
Уже с Приветом
Posts: 63377
Joined: 03 Nov 2004 05:31
Location: RU -> Toronto, ON

Re: vSphere - memory sharing?

Post by Flash-04 »

и вот что хост показывает: 2 * 8Gb + 2Gb по себя
You do not have the required permissions to view the files attached to this post.
Not everyone believes what I believe but my beliefs do not require them to.
uncle_Pasha
Уже с Приветом
Posts: 19939
Joined: 30 Aug 2000 09:01
Location: WA

Re: vSphere - memory sharing?

Post by uncle_Pasha »

Flash-04 wrote: 06 Apr 2019 16:50 нет... что тогда "consumed"?
то, что в конфигурации VM
т.е.
active memory - это реальная память, отданая VM прямо сейчас
consumed memory - это будет худший случай, если guest OS попытается использовать все страницы, которые ей теоретически доступны.
uncle_Pasha
Уже с Приветом
Posts: 19939
Joined: 30 Aug 2000 09:01
Location: WA

Re: vSphere - memory sharing?

Post by uncle_Pasha »

Flash-04 wrote: 06 Apr 2019 16:52 и вот что хост показывает: 2 * 8Gb + 2Gb по себя
а сколько VMs в данный момент запущено?
uncle_Pasha
Уже с Приветом
Posts: 19939
Joined: 30 Aug 2000 09:01
Location: WA

Re: vSphere - memory sharing?

Post by uncle_Pasha »

Там все хитрее: active memory - это оказывается оценка, сколько можно (теоретически) оставить гостю
https://www.vmware.com/content/dam/digi ... gement.pdf
At the beginning of each sampling period, the hypervisor intentionally invalidates several randomly selected guest physical pages and starts to monitor the guest accesses to them. At the end of the sampling period, the fraction of actively used memory can be estimated as the fraction of the invalidated pages that are re-accessed by the guest during the epoch.
Т.е. замаплено на рельную память в данный момент может быть больше.
uncle_Pasha
Уже с Приветом
Posts: 19939
Joined: 30 Aug 2000 09:01
Location: WA

Re: vSphere - memory sharing?

Post by uncle_Pasha »

Flash-04 wrote: 06 Apr 2019 16:52 и вот что хост показывает: 2 * 8Gb + 2Gb по себя
Вот хорошее объяснение терминов
https://blog.heroix.com/blog/vmware-mem ... y-planning
Судя по всему, пока память есть - ESX отдает гостям все, что сконфигурировано (за исключением того, что пущено под samples)
User avatar
Flash-04
Уже с Приветом
Posts: 63377
Joined: 03 Nov 2004 05:31
Location: RU -> Toronto, ON

Re: vSphere - memory sharing?

Post by Flash-04 »

uncle_Pasha wrote: 06 Apr 2019 17:02
Flash-04 wrote: 06 Apr 2019 16:52 и вот что хост показывает: 2 * 8Gb + 2Gb по себя
а сколько VMs в данный момент запущено?
две по 8
Not everyone believes what I believe but my beliefs do not require them to.
uncle_Pasha
Уже с Приветом
Posts: 19939
Joined: 30 Aug 2000 09:01
Location: WA

Re: vSphere - memory sharing?

Post by uncle_Pasha »

Flash-04 wrote: 06 Apr 2019 17:51
uncle_Pasha wrote: 06 Apr 2019 17:02 а сколько VMs в данный момент запущено?
две по 8
Т.е. этому можно верить - то что я написал вначале полная фигня, с данному случаю отношения не имеет.
Пока есть память, ее будет выделено по максимуму, за минусом samples
By default, ESX samples 100 guest physical pages for each 60-second period.
Т.е. ~400KB/min, некоторые из которых будут востребованы обратно гостем (1/16 судя по вашим цифрам).
User avatar
Flash-04
Уже с Приветом
Posts: 63377
Joined: 03 Nov 2004 05:31
Location: RU -> Toronto, ON

Re: vSphere - memory sharing?

Post by Flash-04 »

А если я их напихаю много, "гостей"?
Not everyone believes what I believe but my beliefs do not require them to.
uncle_Pasha
Уже с Приветом
Posts: 19939
Joined: 30 Aug 2000 09:01
Location: WA

Re: vSphere - memory sharing?

Post by uncle_Pasha »

Flash-04 wrote: 06 Apr 2019 21:46 А если я их напихаю много, "гостей"?
Тогда будет интереснее. Из того же документа.
in the high state, the aggregate virtual machine guest memory usage is smaller than the host memory size. Whether or not host memory is overcommitted, the hypervisor will not reclaim memory through ballooning or swapping. (This is true only when the virtual machine memory limit is not set.) If host free memory drops towards the soft threshold, the hypervisor starts to reclaim memory using ballooning. Ballooning happens before free memory actually reaches the soft threshold because it takes time for the balloon driver to allocate and pin guest physical memory. Usually, the balloon driver is able to reclaim memory in a timely fashion so that the host free memory stays above the soft threshold. If ballooning is not sufficient to reclaim memory or the host free memory drops towards the hard threshold, the hypervisor starts to use swapping in addition to using ballooning. Through swapping, the hypervisor should be able to quickly reclaim memory and bring the host memory state back to the soft state
Но balloon driver исталлируется только с VMWare Tools, так что если вы их не поставили, то его не будет.
User avatar
Flash-04
Уже с Приветом
Posts: 63377
Joined: 03 Nov 2004 05:31
Location: RU -> Toronto, ON

Re: vSphere - memory sharing?

Post by Flash-04 »

Vmtools есть! Но open

попробую несколько "жирных" гостей создать, посмотрим как оно будет.
Not everyone believes what I believe but my beliefs do not require them to.
User avatar
Flash-04
Уже с Приветом
Posts: 63377
Joined: 03 Nov 2004 05:31
Location: RU -> Toronto, ON

Re: vSphere - memory sharing?

Post by Flash-04 »

чудеса в решете продолжились. после быстрого анализа решил что 8GB RAM - сильно жирно. Хватит и 6. Остановил VM, изменил колво RAM, запустил, и... теперь колво consumed - 2.09 Gb, а active memory - 3.72 Gb!
как такое может быть?!
Not everyone believes what I believe but my beliefs do not require them to.
uncle_Pasha
Уже с Приветом
Posts: 19939
Joined: 30 Aug 2000 09:01
Location: WA

Re: vSphere - memory sharing?

Post by uncle_Pasha »

Flash-04 wrote: 08 Apr 2019 00:08 как такое может быть?!
Это глюк
User avatar
Flash-04
Уже с Приветом
Posts: 63377
Joined: 03 Nov 2004 05:31
Location: RU -> Toronto, ON

Re: vSphere - memory sharing?

Post by Flash-04 »

Видимо да. Обновил страничку, стало показывать нормально, чуть более 3Gb. Что кстати хорошо. Но блин, это же последний 6.7U1 vSphere, а глюки как у 0.9 8)
Not everyone believes what I believe but my beliefs do not require them to.

Return to “Вопросы и новости IT”