Details
-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
None
-
9223372036854775807
Description
Batching processing can obtain boost performance.
However, in some file system tree, each level may contain less than 100 entries, but with high depth.
It can do statahead according to Breadth First Search (BFS) or Depth First Search (DFS) access pattern once detect, each time statahead a subtree with more than 1 level, collect enough statahead entries, send the batching RPC via bulk I/O, to improve the tree walking performance.
BFS_Traverse(DIR, Q) { Q.enqueue(DIR); while |Q| > 0 do dir = Q.dequeue() opendir(dir); while dent = readdir(dir) != NULL do stat(dent); process(dent); if dent is a directory do Q.enqueue(dent); end if end while closedir(dir); end while } DFS_Traverse(dir) { openddir(dir); while (dent = readdir(dir) != NULL) do if dent is a file then stat(dent); process(dent); else /* a directory */ DFS_Traverse(dent) end if end while closedir(dir); }