path: root/rpc/glfs-operations.h
diff options
authorPrasanna Kumar Kalever <>2017-06-01 00:31:45 +0530
committerPrasanna Kumar Kalever <>2017-06-05 11:47:16 +0000
commit3994aa8cf1bdcf3a07cddfefdb96cc2b94e01a97 (patch)
tree88fef27e5dd333c2d1321ff04a43f2dc6feed4ae /rpc/glfs-operations.h
parent780849822afb665344e76eecf0d05e403840dd52 (diff)
cache: implement LRU cache to hold glfs objects
Problem: ------- 1. Currently, each cli command take ~5 secs for execution. The Maximum latency is due to initializing a glfs object (glfs_init() and friends). 2. OOM kills due to glfs_fini() leaks (~10MB per object) Solution: -------- Caching bipasses glfs_init() calls from the very next command, as in the first command it goes via the glfs_init route, since there will be cache miss. Hence with caching cli command on a local machine should take ~1 sec. ATM, the cache query looks at the volume name only, as the host name will be localhost in our case and transport will be tcp 24007 always. The default cache capacity is 5 i.e there can be a max of five glfs entries in the cache, anything more will lead to release of least recently used object. This way, if there are <= 5 volume in use for block, there will be no glfs_fini() calls, hence no leaks, no OOM's. The next patch will help in making cache capacity configurable. Change-Id: Ia891451cb92cf09959c1aff85976d78302ec7014 Signed-off-by: Prasanna Kumar Kalever <> [ndevos: correct compiling+linking against]
Diffstat (limited to 'rpc/glfs-operations.h')
1 files changed, 1 insertions, 2 deletions
diff --git a/rpc/glfs-operations.h b/rpc/glfs-operations.h
index 150554e..bd6b497 100644
--- a/rpc/glfs-operations.h
+++ b/rpc/glfs-operations.h
@@ -17,8 +17,7 @@
# include <stdbool.h>
# include <errno.h>
-# include <glusterfs/api/glfs.h>
+# include "lru.h"
# include "block.h"