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)
Wed, Dec 18, 1:05 PM
Unknown Object (File)
Thu, Dec 5, 6:34 PM
Unknown Object (File)
Nov 18 2024, 5:26 AM
Unknown Object (File)
Nov 14 2024, 9:07 PM
Unknown Object (File)
Nov 14 2024, 1:04 PM
Unknown Object (File)
Oct 23 2024, 10:58 AM
Unknown Object (File)
Oct 1 2024, 7:57 AM
Unknown Object (File)
Sep 27 2024, 6:19 PM
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 Skipped
Unit
Tests Skipped

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