[LU-14361] Add support for statahead pattern with regularized file name Created: 25/Jan/21  Updated: 23/Jan/24

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Qian Yingjin Assignee: Qian Yingjin
Resolution: Unresolved Votes: 0
Labels: statahead

Attachments: File statahead_mdtest.diff     File statahead_mdtest.v2.diff    
Issue Links:
Related
is related to LU-17399 sanity: test_123i Error: 'File name p... Open
is related to LU-14139 batched statahead processing Resolved
is related to LU-17450 sanity: interop test failures with ma... Open
is related to LU-14139 batched statahead processing Resolved
Rank (Obsolete): 9223372036854775807

 Description   

Some applications do stat() calls under a directory within which all the children files have regularized file name:

  • mdtest benchmark: mdtest.$i
  • du more than 10000 entries: file.$i
  • ML/AI with ingested data that have typically a rule of filename in the directory.

These applications call stat() on the files in the Alphabetic sorting order of the file name.

This kind of metadata operations can not be optimized by current statahead mechanism.
The current statahead mechanism works as follows:
1. Open the directory via opendir() call. It will authorize the statahead.
2. readdir() to get the name and inode number for the dentries.
3. do stat() on the dentries one by one.
4. Close the directory which will deauthorize the statahead.

In current statahead mechanism, the stat() calls in the order of populate the dentries via readdir(). For the ldiskfs backend, it is ordering by the hash of the file name, not a kinds fo sorting oder.

However, we can improve the statahead to support statahead pattern with regularized file name to optimize the metadata performance for the above applications



 Comments   
Comment by Gerrit Updater [ 25/Jan/21 ]

Yingjin Qian (qian@ddn.com) uploaded a new patch: https://review.whamcloud.com/41308
Subject: LU-14361 statahead: regularized fname statahead pattern
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: f0027f94edf2d022dfcfe027ff1121e54f3ef345

Comment by Gerrit Updater [ 26/Jan/21 ]

Yingjin Qian (qian@ddn.com) uploaded a new patch: https://review.whamcloud.com/41319
Subject: LU-14361 statahead: fname statahead pattern w/o opendir
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 8e5e9702b657cd354b00f58d5ad20b5324bb364f

Comment by Gerrit Updater [ 22/Sep/22 ]

"Qian Yingjin <qian@ddn.com>" uploaded a new patch: https://review.whamcloud.com/48625
Subject: LU-14361 statahead: add statahead support for mdtest
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 03a5ad01ecbf356b5d28580c36deb96f39ef6a19

Comment by Gerrit Updater [ 26/Oct/22 ]

"Qian Yingjin <qian@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/48954
Subject: LU-14361 statahead: add support for mdtest shared dir workload
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 377e3300cef3e297aab84bc317b3d6ad036f7167

Comment by Andreas Dilger [ 25/Nov/22 ]

One of the questions I had recently from a customer is whether this statahead would work with a filename that had numbers in the middle (e.g. "filename.12345.out" or similar) because the filename extension is needed for some programs to work correctly. The current version of the patch does not handle this correctly, but I could imagine that this can is detected fairly easily. Instead of just comparing numbers from the end of the filename, it should be possible to build a "format" of characters that are changing between two filenames (the byte offset of the first numeric character and the length, and the file suffix or an empty string if no suffix).

The first filename would just be saved, then the second one would do a byte-by-byte comparison to find the first character that is different, then do a forward and backward search with isdigit() to find the first and last number in the filename. It would then use "snprintf(buf + start, sizeof(buf) "%*0u%s", len, index, suffix)" (or similar, with/without leading zeroes and fixed or variable width) to write the new index number into the middle (or end) of the filename.

Comment by Gerrit Updater [ 01/Dec/22 ]

"Qian Yingjin <qian@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/49291
Subject: LU-14361 statahead: wait inuse entry finished during cleanup
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 05d7d9fdc417fb9ddfec7379a70d5f318a2d1333

Comment by Gerrit Updater [ 05/Jul/23 ]

"Qian Yingjin <qian@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/51572
Subject: LU-14361 statahead: add tunable for fname pattern statahead
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 77f13ed7daa5858bc1a65a7ad782e6bdc6689981

Comment by Gerrit Updater [ 06/Jul/23 ]

"Qian Yingjin <qian@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/51587
Subject: LU-14361 statahead: return ENOENT for batched statahead
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 514378215024010c1a7318e01e201028ce56b7c4

Comment by Gerrit Updater [ 06/Jul/23 ]

"Qian Yingjin <qian@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/51592
Subject: LU-14361 statahead: add tunable for fname pattern detection
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 533efbf4c0f3ba13f7b18d6998c1d6f7f2e8738e

Comment by Gerrit Updater [ 21/Jul/23 ]

"Qian Yingjin <qian@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/51730
Subject: LU-14361 statahead: Add test for statahead advise
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: c774d17f9a572d01629f7cead0a126d88a9c290b

Comment by Gerrit Updater [ 31/Aug/23 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/48625/
Subject: LU-14361 statahead: add statahead advise IOCTL
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 1288681bb8aa76f43af5c53ec3ef68ecc8d412d7

Comment by Gerrit Updater [ 03/Nov/23 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51730/
Subject: LU-14361 statahead: Add test for statahead advise
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 5317f8a523ac32b616713396f60eda4995dea85e

Comment by Gerrit Updater [ 08/Nov/23 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51572/
Subject: LU-14361 statahead: add tunable for fname pattern statahead
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 6fbffd9c09ad4526ce3a03b8d85f0ce273cac037

Comment by Gerrit Updater [ 17/Nov/23 ]

"Timothy Day <timday@amazon.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/53173
Subject: LU-14361 tests: add aheadmany to .gitignore
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 5027f6bc7fceee920ac5a54480db572dbfbcd5bd

Comment by Gerrit Updater [ 20/Dec/23 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/53173/
Subject: LU-14361 tests: add aheadmany to .gitignore
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 46d69b57d4a2d9eeb4ac7adc472a7667394de919

Comment by Gerrit Updater [ 03/Jan/24 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/41308/
Subject: LU-14361 statahead: regularized fname statahead pattern
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: e10bf68d7c3eb71a7e84986089c020aa4c9f98f7

Comment by Andreas Dilger [ 09/Jan/24 ]

It looks like the newly-added sanity test_123i from patch https://review.whamcloud.com/41308 "LU-14361 statahead: regularized fname statahead pattern" is failing fairly often since the patch was landed (33/561 = 1/17 runs in the past week). Since the test is in sanity, it is run many times for each patch and much more likely to cause problems:

https://testing.whamcloud.com/search?horizon=2332800&status%5B%5D=FAIL&test_set_script_id=f9516376-32bc-11e0-aaee-52540025f9ae&sub_test_script_id=7d5be5fb-0bc8-4e25-a53f-3a833bca78bd&source=sub_tests#redirect

Comment by Qian Yingjin [ 10/Jan/24 ]

The reason for these failures may be that @sbi->ll_sa_min is too small, the default value is 

#define LL_SA_REQ_MIN_DEF 8,

it results in the stat-ahead is not so aggressive, too low hit rate and quit wrongly...

Increasing this value in sanity/123i should fix the failure. 

 

I will make a patch later.

Comment by Gerrit Updater [ 10/Jan/24 ]

"Qian Yingjin <qian@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/53634
Subject: LU-14361 statahead: increase the initial statahead count
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: dd6b7c0f476085c0cbe0c0a4c05710e1205b5d25

Comment by Gerrit Updater [ 23/Jan/24 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/53634/
Subject: LU-14361 statahead: increase the initial statahead count
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 76ff18798974b15c4a171dbb76a1077623a66d8a

Generated at Sat Feb 10 03:09:04 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.