Whamcloud - gitweb
LU-15033 llite: Increase default RA sizes 75/46475/5
authorPatrick Farrell <pfarrell@whamcloud.com>
Mon, 12 Feb 2024 18:57:01 +0000 (13:57 -0500)
committerOleg Drokin <green@whamcloud.com>
Mon, 4 Mar 2024 20:00:25 +0000 (20:00 +0000)
The default max_readahead_mb is 1/32 of all cached pages,
which doesn't make much sense but isn't usually a problem
since most real nodes have very high RAM or it is tuned to
larger values.

It is reduced further for the per-file limit, which is also
reasonable.

However, on test VMs with smaller RAM sizes, this results
in hilariously tiny max_read_ahead_per_file_mb values, like
20.  This is small enough it causes extra misses because
two RPCs cannot be reliably sent.  This edge case isn't
important for performance, but it makes small scale testing
of readahead nearly impossible.

To avoid this, we add a minimum readahead requirement of
256 MiB, which is used unless it's > half of RAM.  This
should avoid this case on test VMs without changing the
behavior for real clients unless they are extremely small.

Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: Ie8aab6b04ad520e4633d634d846e7ef23cc91ced
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46475
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c

index 82cb06d..5690f0d 100644 (file)
@@ -690,6 +690,10 @@ static inline void ll_inode_unlock(struct inode *inode)
 
 /* default read-ahead on a given client mountpoint. */
 #define SBI_DEFAULT_READ_AHEAD_MAX             MiB_TO_PAGES(1024UL)
+/* on small nodes (ie, testing VMs), we need at least this much to make
+ * readahead easily testable
+ */
+#define SBI_DEFAULT_READ_AHEAD_MIN             MiB_TO_PAGES(256UL)
 
 /* default read-ahead for a single file descriptor */
 #define SBI_DEFAULT_READ_AHEAD_PER_FILE_MAX    MiB_TO_PAGES(256UL)
index 9cff0f1..7e67cf5 100644 (file)
@@ -158,6 +158,14 @@ static struct ll_sb_info *ll_init_sbi(struct lustre_sb_info *lsi)
 
        sbi->ll_ra_info.ra_max_pages =
                min(pages / 32, SBI_DEFAULT_READ_AHEAD_MAX);
+       /* on very small nodes (ie, testing VMs), we need a minimum readahead
+        * size to get sane testing behavior, so we try to enforce this
+        * minimum.  This only kicks in at small RAM sizes, so generally won't
+        * affect real clients
+        */
+       if (sbi->ll_ra_info.ra_max_pages < SBI_DEFAULT_READ_AHEAD_MIN)
+               sbi->ll_ra_info.ra_max_pages =
+                       min(pages / 2, SBI_DEFAULT_READ_AHEAD_MIN);
        sbi->ll_ra_info.ra_max_pages_per_file =
                min(sbi->ll_ra_info.ra_max_pages / 4,
                    SBI_DEFAULT_READ_AHEAD_PER_FILE_MAX);