Project

General

Profile

Actions

Bug #20054

closed

librbd memory overhead when used with KVM

Added by Sebastian Nickel almost 7 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
% Done:

0%

Source:
Tags:
Backport:
luminous,mimic
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Hi,
we are running a jewel ceph cluster which serves RBD volumes for our KVM
virtual machines. Recently we noticed that our KVM machines use a lot more
memory on the physical host system than what they should use. We collect the
data with a python script which basically executes 'virsh dommemstat <virtual
machine name>'. We also verified the results of the script with the memory
stats of 'cat /proc/<kvm PID>/status' for each virtual machine and the results
are the same.

Here is an excerpt for one pysical host where all virtual machines are running
since 26th of April (virtual machine names removed):

"""
overhead actual percent_overhead rss
---------- -------- ------------------ ---------
1.4 GiB 1.0 GiB 141 2.4 GiB
0.0 MiB 1.0 GiB 0 950.5 MiB
1.4 GiB 1.0 GiB 141 2.4 GiB
0.0 MiB 2.0 GiB 0 1.8 GiB
986.9 MiB 1.0 GiB 96 2.0 GiB
0.0 MiB 4.0 GiB 0 2.9 GiB
723.7 MiB 2.0 GiB 35 2.7 GiB
0.0 MiB 8.0 GiB 0 4.8 GiB
947.3 MiB 1.0 GiB 92 1.9 GiB
2.5 GiB 1.0 GiB 250 3.5 GiB
3.0 GiB 2.0 GiB 151 5.0 GiB
2.5 GiB 2.0 GiB 123 4.5 GiB
54.5 MiB 2.0 GiB 2 2.1 GiB
1.2 GiB 1.0 GiB 124 2.2 GiB
2.9 GiB 1.0 GiB 286 3.9 GiB
2.1 GiB 2.0 GiB 104 4.1 GiB
2.2 GiB 1.0 GiB 220 3.2 GiB
1.6 GiB 1.0 GiB 163 2.6 GiB
1.9 GiB 2.0 GiB 94 3.9 GiB
2.2 GiB 1.0 GiB 223 3.2 GiB
1.5 GiB 1.0 GiB 148 2.5 GiB
934.6 MiB 2.0 GiB 45 2.9 GiB
1.3 GiB 1.0 GiB 134 2.3 GiB
192.4 MiB 1.0 GiB 18 1.2 GiB
939.4 MiB 2.0 GiB 45 2.9 GiB
"""

We are using the rbd client cache for our virtual machines, but it is set to
only 128MB per machine. There is also only one rbd volume per virtual machine.
We have seen more than 200% memory overhead per KVM machine on other physical
machines as well. After a live migration of the virtual machine to another host the
overhead is back to 0 and increasing slowly back to high values.

Here are our ceph.conf settings for the clients:
"""
[client]
rbd cache writethrough until flush = False
rbd cache max dirty = 100663296
rbd cache size = 134217728
rbd cache target dirty = 50331648
"""

We noticed this behavior since we are using the jewel librbd libraries. We did
not encounter this behavior when using the ceph infernalis librbd version. We
also do not see this issue when using local storage, instead of ceph (there we can see an overhead of about 10%).

Some version information of the physical host which runs the KVM machines:
"""
OS: Ubuntu 16.04
kernel: 4.4.0-75-generic
librbd: 10.2.7-1xenial
"""

We did try to flush and invalidate the client cache via the ceph admin socket,
but this did not change any memory usage values.

I was also able to reproduce the issue with a test VM and the help of 'fio':

"""
  1. This job file tries to mimic the Intel IOMeter File Server Access Pattern
    [global]
    description=Emulation of Intel IOmeter File Server Access Pattern
    randrepeat=0
    filename=/root/test.dat
  2. IOMeter defines the server loads as the following:
  3. iodepth=1 Linear
  4. iodepth=4 Very Light
  5. iodepth=8 Light
  6. iodepth=64 Moderate
  7. iodepth=256 Heavy
    iodepth=8
    size=80g
    direct=0
    ioengine=libaio

[iometer]
stonewall
bs=4M
rw=randrw

[iometer_just_write]
stonewall
bs=4M
rw=write

[iometer_just_read]
stonewall
bs=4M
rw=read
"""

Then let I it run for some time via:
$> while true; do fio stress.fio; rm /root/test.dat; done

I was able to get an overhead of 85% (2.5 GB for a 3GB VM).

Is this overhead non avoidable or could be minimized somehow?


Files

Actions

Also available in: Atom PDF