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
Unknown Object (File)
Thu, Mar 14, 10:18 PM
Unknown Object (File)
Thu, Mar 14, 10:18 PM
Unknown Object (File)
Thu, Mar 14, 10:18 PM
Unknown Object (File)
Mon, Mar 11, 7:25 AM
Unknown Object (File)
Jan 16 2024, 10:45 PM
Unknown Object (File)
Dec 25 2023, 3:01 AM
Unknown Object (File)
Dec 23 2023, 10:07 AM
Unknown Object (File)
Dec 12 2023, 9:36 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