Daniel Gryniewicz has uploaded this change for review.

View Change

MDCACHE - Insert scanned entries differently

When we're doing a readdir and the size of the directory is larger than
the cache size, then a poor interaction between the LRU and the readdir
could occur.

When the cache is above high-water, and a new chunk is read, then the
entries for the beginning of the chunk are created and inserted in LRU
of L1. Later entries from the chunk recycle (because we're above
high-water). If the L2 is empty (likely, if the readdir is early in the
workload, or if it goes on long enough and recycles the enire L2), then
the LRU of L1 is recycled. These, however, are likely to be the entries
created earlier in the chunk.

Then, when the readdir gets around to calling the callback for the upper
layer, it has to do a lookup() and a getattr() on each entry. This
causes a huge number of round-trips to the cluster, destroying
performance.

However, the current LRU behavior is desirable for many cases. If an
entry is created, but not used immediately, we want it to fall out of
the cache quickly.

This fix distinguishes between entry creation from a scan and from other
sources. Scan creations are inserted into the MRU of L2, rather than
the LRU of L1. The downside of this is that 2 refs are necessary to
move to MRU of L1. The upside is that entries from a readdir are
recycled in FIFO order, rather than LIFO order, meaning that the cached
entry will stick around long enough to be used in the readdir.

Change-Id: I45e71106e66f7ba15b7b8635c7f67622fc751048
Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
---
M src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_handle.c
M src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_helpers.c
M src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_int.h
M src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_lru.c
M src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_lru.h
5 files changed, 40 insertions(+), 16 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/13/411313/1

To view, visit change 411313. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-MessageType: newchange
Gerrit-Change-Id: I45e71106e66f7ba15b7b8635c7f67622fc751048
Gerrit-Change-Number: 411313
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Gryniewicz <dang@redhat.com>