• P
    block/gluster: memory usage: use one glfs instance per volume · 6349c154
    Prasanna Kumar Kalever 提交于
    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: NPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
    Reviewed-by: NJeff Cody <jcody@redhat.com>
    Message-id: 1477581890-4811-1-git-send-email-prasanna.kalever@redhat.com
    Signed-off-by: NJeff Cody <jcody@redhat.com>
    6349c154
gluster.c 45.3 KB