]> git.proxmox.com Git - mirror_qemu.git/commit - block/gluster.c
block/gluster: memory usage: use one glfs instance per volume
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Thu, 27 Oct 2016 15:24:50 +0000 (20:54 +0530)
committerJeff Cody <jcody@redhat.com>
Tue, 1 Nov 2016 11:55:57 +0000 (07:55 -0400)
commit6349c15410361d3fe52c9beee309954d606f8ccd
tree9e2ab9a0c9e2df6fa40a7680a92992c8a20ba38c
parentd9b789745b88df367674e45c55df29e9c7de8d8a
block/gluster: memory usage: use one glfs instance per volume

Currently, for every drive accessed via gfapi we create a new glfs
instance (call glfs_new() followed by glfs_init()) which could consume
memory in few 100 MB's, from the table below it looks like for each
instance ~300 MB VSZ was consumed

Before:
-------
Disks   VSZ     RSS
1       1098728 187756
2       1430808 198656
3       1764932 199704
4       2084728 202684

This patch maintains a list of pre-opened glfs objects. On adding
a new drive belonging to the same gluster volume, we just reuse the
existing glfs object by updating its refcount.

With this approch we shrink up the unwanted memory consumption and
glfs_new/glfs_init calls for accessing a disk (file) if belongs to
same volume.

From below table notice that the memory usage after adding a disk
(which will reuse the existing glfs object hence) is in negligible
compared to before.

After:
------
Disks   VSZ     RSS
1       1101964 185768
2       1109604 194920
3       1114012 196036
4       1114496 199868

Disks: number of -drive
VSZ: virtual memory size of the process in KiB
RSS: resident set size, the non-swapped physical memory (in kiloBytes)

VSZ and RSS are analyzed using 'ps aux' utility.

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Message-id: 1477581890-4811-1-git-send-email-prasanna.kalever@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
block/gluster.c