A
A
akordik2020-08-08 12:25:29
linux
akordik, 2020-08-08 12:25:29

High SWAP consumption in KVM operation?

Installed Proxmox Virtual Environment 5.2-1, FS ZFS
(Linux 4.15.17-1-pve #1 SMP PVE 4.15.17-9 (Wed, 9 May 2018 13:31:43 +0200))
RAM installed 62GB in operation approximately 50 %-60%
Pay attention to the high consumption of swap.
In the task manager, I saw a large consumption of SWAP by running vm processes. KVM (took 2GB)
5f2e6e4cef69d207531618.jpeg
Why does KVM use SWAP so much with free RAM?
How normal is this and what will happen with an increase in the number of cars (I'm afraid to see 100%)?
If it's not normal, how can I fix it?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
Puma Thailand, 2020-08-08
@opium

Reduce the swap size
Give up the zfs It
will get much better

L
Lev Zabudkin, 2020-08-09
@zabudkin

activate zswap, 27 gigs of swap is not normal.
When you read about zswap. set up there.

E
edo1h, 2020-08-10
@edo1h

“Swap consumption” should first of all be looked at not in gigabytes, but in operations per second, if you don’t have any monitoring, then you can use iostat -mxzp 10
If you have a lot of IOPS on a swap partition, then you need to do something, if no - rejoice, you have unused data settled there, you can say the memory was added for free (although for a noticeable effect, the size of the swap should be of the same order as the size of the memory, of course).
"A lot of IOPS" - how much? It can be considered as a percentage of disk performance, conditionally HDD can do 100 IOPS, so less than 10 swap accesses per second (less than 10% of disk capacity) will not have a significant impact on system performance. For SSD, the numbers will be much higher, and thousands of IOPS per swap can be normal there (but for desktop SSDs, you need to remember about disk resource / SLC cache clogging).

what will happen with an increase in the number of cars (I'm afraid to see 100%)?

This in itself is not terrible. But if applications (virtual machines in your case) do not have enough total memory (physical + swap), then the kernel has no choice but the OOM killer.
I repeat, I don’t see much point in swap, which is an order of magnitude smaller than the amount of physical memory.
Usually I set it up with either RAM size (where it is needed, as in your case), or no swap at all (if the host, say, has only postgresql or elsaticsearch).
Summarizing:
- if everything is fine with performance, IOPS associated with the swap is small - then do nothing, except to consider the possibility of increasing the partition with the swap "for growth";
- if the disk system slows down, then increase the amount of RAM (or moderate the appetites of applications).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question