Page MenuHomeFreeBSD

Make boot block read-ahead caching algorithm smarter
ClosedPublic

Authored by sobomax on Aug 20 2021, 7:50 PM.
Tags
None
Referenced Files
F102593463: D31623.diff
Thu, Nov 14, 1:04 PM
Unknown Object (File)
Wed, Oct 23, 10:58 AM
Unknown Object (File)
Oct 1 2024, 7:57 AM
Unknown Object (File)
Sep 27 2024, 6:19 PM
Unknown Object (File)
Sep 26 2024, 9:41 PM
Unknown Object (File)
Sep 25 2024, 4:24 AM
Unknown Object (File)
Sep 22 2024, 11:20 PM
Unknown Object (File)
Sep 21 2024, 5:56 AM
Subscribers

Details

Summary

This patch improves block caching algorithm to work better for remote media on low-BW/high-delay links by only triggering read-ahead if two subsequent blocks have been requested by the upper-level code. This cuts boot time over IP KVMs noticeably (like 15-20x from 10-15 minutes to less than a minute till it even start loading kernel), since the initialization stage reads bunch of small .4th (and now .lua) files that are not in the same cache stripe.

The regression came in 2017 with revision 87ed2b7f5a. Even doing something like ls is painful on a remote KVMs ever since.

Here is a real-world deployment back in 2018 taking 10 minutes just to start loading kernel: https://youtu.be/g1iWzExHFJE

Test Plan

We have had this patch since 2018, now deployed at hundreds of physical boxes and contless VMs out there. 0 issues.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sobomax retitled this revision from Make boot block read caching algorithm smarter to Make boot block read-ahead caching algorithm smarter.Aug 20 2021, 7:53 PM

I think, https://reviews.freebsd.org/D30848 should improve your use case even more.

stand/common/bcache.c
300

suggest using ra != 0 as ra is size_t, not boolean.

This revision is now accepted and ready to land.Aug 20 2021, 8:08 PM