Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Operating Systems IT

FreeBSD Can Now Boot in 25 Milliseconds (theregister.com) 77

Replacing a sort algorithm in the FreeBSD kernel has improved its boot speed by a factor of 100 or more... and although it's aimed at a micro-VM, the gains should benefit everyone. From a report: MicroVMs are a hot area of technology R&D in the last half decade or so. The core idea is a re-invention of some of concepts and technology that IBM invented along with the hypervisor in the 1960s: designing OSes specifically to run as guests under another OS. This means building the OS specifically to run inside a VM, and to talk to resources provided by a specific hypervisor rather than to fake hardware.

This means that the guest OS needs next to no support for real hardware, just VirtIO drivers which talk directly to facilities provided by the host hypervisor. In turn, the hypervisor doesn't have to provide an emulated PCI bus, emulated power management, emulated graphics card, emulated network interface cards, and so on. The result is that the hypervisor itself can be much smaller and simpler. The result of ruthlessly chopping down both the hypervisor, and the OS that runs inside it, is that both ends can be much smaller and simpler. That means that VMs can use much fewer resources, and start up much quicker.

This discussion has been archived. No new comments can be posted.

FreeBSD Can Now Boot in 25 Milliseconds

Comments Filter:
  • Define "booted" (Score:5, Insightful)

    by Junta ( 36770 ) on Wednesday August 30, 2023 @10:33AM (#63808600)

    While I'm sure they've made great strides in a particular baseline benchmark, I find that the definition of "booting" to be a bit vague.

    Ask a firmware person how long their device takes to boot, and they'll stop counting when jumping to a boot loader.

    Ask a kernel person and they'll count 'booted' as when 'init' starts executing, which I presume is the case here (specifically probably booting when the kernel is already cached in RAM). The kernel people can't control how long init takes, so to them it's not that useful to include most of the time.

    • Re:Define "booted" (Score:5, Interesting)

      by dfghjk ( 711126 ) on Wednesday August 30, 2023 @11:01AM (#63808702)

      Right, and in this case "booting" is even more strained. Ordinarily, booting time would start at power-on and continue until some usable state. It's hard to boot in 25ms when PCIe devices takes 100's of milliseconds to become useable and systems don't even exit their firmware for far longer than that. "Boot" in this context is just how long a particular piece of software takes to execute.

      And "replacing a sort algorithm in the FreeBSD kernel" did NOT "improve its boot speed by a factor of 100 or more", it improved 7% of CPU consumption by that amount. Over many years of work, boot speed has been improved that greatly, not by one relatively modest change.

      If anyone is old enough to remember the transition from hard disk to SSD boot devices, they will remember making their slow boot times near-instantaneous. Now, boot times, with SSD, are agonizing once again. It's crappy software to blame, systems are not doing anything so sophisticated that it should take a minute to boot. The industry has been plagued by this since the 80's.

      • Have SSD's time-to-failure values reached a level suitable for inclusion in regular computers yet? I re-set the clock on "when I'll take the plunge" by a half-decade every time I have a flash-based memory device die on me. I've had one start throwing unpredictable errors just this week, which is why I have a paper tag saying "unreliable" tied to it.

        Do any server/storage farms use SSDs yet for their boot discs at least. I wouldn't expect them to be trusting their data to anything other than spinning rust fo

        • by Junta ( 36770 )

          A lot of datacenters are using SSDs for most of their storage. Once upon a time it was only selectively used as small fast tiers, now a lot of scenarios just have all flash. HDD still wins on $ per GB, so some workloads still prefer them when performance doesn't matter so much, but the margin is much closer than it used to be.

          Depending on your flash based device, your woes might not have much to do with expected desktop/laptop usage. Compared to USB keys, SSDs tend to have more carefully managed wear lev

          • by guruevi ( 827432 )

            That's not entirely accurate. What hasn't changed much is the volume of data required for the average business. If all you needed "back then" was 10TB to store your database over gigabit network, today, that database is likely still in the 10-20TB range, your access is likely still over gigabit.

            Now we have 2 and 4TB of flash, but we don't have 2TB and 4TB spindles anymore (at least not new). Getting to the 10-20TB is not that hard anymore, you only need 6 spindles or 6 SSDs to get the required redundancies,

          • Hmmm, still pretty marginal then, for me. I'm not particularly invested in a technology rather than results.

            I was looking at back-up solutions at the same time. In the data range I'm looking at moving into, the cost of backing up to tape would be more, substantially, than the cost of just getting a second drive of $DATA_DRIVE size and doing an occasional write to that with the current contents of $DATA_DRIVE. But you do remind me that I need to put the network onto wire again, not having bothered after my

      • Re:Define "booted" (Score:5, Informative)

        by tlhIngan ( 30335 ) <slashdot@worf.ERDOSnet minus math_god> on Wednesday August 30, 2023 @01:19PM (#63809278)

        . It's hard to boot in 25ms when PCIe devices takes 100's of milliseconds to become useable and systems don't even exit their firmware for far longer than that

        That's why the summary states it's for micro VMs - guest OSes that are aware of their environment and can skip a lot of the boot process. The firmware just has to set up the virtual processor just enough to jump into the kernel - there is no need to POST in a VM environment. The kernel doesn't need hardware like PCIe or other things because it knows its talking to virtual hardware. So instead of having real drivers, it uses VirtIO drivers that basically skip all the initialization stuff.

        VirtIO is useful if you have it - instead of an OS writing to a virtual hardware device, it just sends the data straight to the VMM using the VMM interface. So networking - instead of having to package up the packet into a memory buffer and starting DMA, the VirtIO driver takes the buffer from the kernel, then passes it to the VMM directly eliminating the emulation and driver overhead and the serialization/deserialization of packets.

        As the devices are already well configured, there is nothing to initialize so most of the VirtIO interface are stubs - you don't have to initialize hardware, you might have to set a flag telling the VMM your networking is up but that's it.

        Effectively, the hardware needs no time to initialize as it's already initialized by the VMM, so your 25ms boot time is just what the kernel software needs to get ready - initializing page tables, data structures and other management things.

        • by dfghjk ( 711126 )

          "That's why the summary states it's for micro VMs - guest OSes that are aware of their environment and can skip a lot of the boot process. The firmware just has to set up the virtual processor just enough to jump into the kernel - there is no need to POST in a VM environment. The kernel doesn't need hardware like PCIe or other things because it knows it's talking to virtual hardware. So instead of having real drivers, it uses VirtIO drivers that basically skip all the initialization stuff."

          Right, which emph

    • That reminds me of booting Windows in the 90 and 2000s. You would technically get to the desktop after “only” about two or three minutes (yeah) .. but it was unusable for about 5 more minutes while the hard drive spun loading various BS stuff Windows needs. If you tried to launch anything before that 5 minutes were up not only would the application have seizures but you dramatically increase the chance of a BSOD.

  • by MIPSPro ( 10156657 ) on Wednesday August 30, 2023 @10:37AM (#63808614)
    FreeBSD has some excellent virtualization features for both type-I and type-II hypervisors. As a user of both FreeBSD Jails and Linux LXC (and former user of OpenVZ) I have definitely come to prefer using Jails. They are more stable and feature-rich than LXC containers, in my experience.
    • by ebunga ( 95613 ) on Wednesday August 30, 2023 @10:55AM (#63808674)

      Best of all, no systemd.

      • Re: (Score:2, Informative)

        Don't forget good up to date documentation and native ZFS.

        • Re: (Score:2, Informative)

          by CAIMLAS ( 41445 )

          The FreeBSD documentation is only good and up to date for a very small surface of use cases. For the things which don't work, it's woefully inadequate.

          • Then it's a good thing the project is much better at keeping their system manual pages updated versus Linux, which is just a kernel and doesn't really care if the various distros have decent manual pages. Also, it's nice that the source code is mostly all in one place to reference instead of having to go to a zillion small projects and git-clone the various parts you care about.
            • by CAIMLAS ( 41445 )

              It sounds like you're saying a lot without making any concrete quality differentiation.

              • Well, I'd assert that frequent users of both systems know what I'm talking about while admitting I made an objective statement. Linux distros are often built from a zillion smaller projects, each with somewhat different build scenarios. They don't always bother with writing or installing a manual page. That's considered rude and bad form in FreeBSD and the folks in the project really won't let most system tools move forward with a release unless they have a manual page. Remember that any time someone writes
          • Have you notified anyone the documentation was wrong or outdated? What issues did you run into?

            • by CAIMLAS ( 41445 )

              I had. I'd found a hardware bug in the mptsas drivers years ago (freebsd 8/9 era) which was causing stability and data corruption problems and attempted to bring them up with the driver maintainer (via IRC). I was effectively told "not my problem, pound sand". One of the least hospitable communities I've ever had the displeasure of interacting with.

        • by nbvb ( 32836 )

          Excellent virtualization, solid fast containers, no systemd, good documentation, native ZFS ... Sounds more and more like Solaris by the second.

          Just a damn shame where it landed.

          https://www.youtube.com/watch?... [youtube.com]

      • Yeah, it's great having nothing to manage services on your system except some random init scripts.

        I'm pretty sure everyone who whines about systemd runs a single system at home and never actually thinks about the big picture.

    • by Shaiku ( 1045292 )

      It's only a matter of time before Linux rips off the concept and people will come to believe they invented it.

      • by CAIMLAS ( 41445 )

        What concept?

        You realize that the virtualization in FreeBSD has been a cargo lift of the features from virtio/KVM/lxc, and this has existed on linux for years?

        • You realize that Linux folks also just basically renamed 'qemu' to 'kvm' then thought they invented it right? Fabrice Bellard doesn't seem like a Linux cheerleader to me, given that qemu runs on a bunch of different platforms.
          • by CAIMLAS ( 41445 )

            .... no, KVM is not a rename of qemu. Not "basically" or in any other way. lol They're entirely different, interoperable components.

            Does KVM virtualization utilize qemu as an abstraction for ease/consistency of access? Yes. libvirt sits on the other side of qemu providing additional usability/abstraction.

            Do you need qemu to use KVM? No, you do not. You absolutely can run kvm machines directly without the complexity of qemu via API ioctls.

            • Dude do 'kvm -h' and 'qemu -h' and tell me how unrelated they are. Bullshit. KVM LITERALLY is a fork of Qemu with hardware virt support instead of software. Get a clue.
        • by Shaiku ( 1045292 )

          I'd like to hear more about your hypothesis that a bunch of GPL code was stolen and put into an incompatibly licensed OS. VirtIO is a standard. Don't confuse supporting a standard with porting some code. KVM is Linux-specific and has nothing to do with FreeBSD except a couple failed attempts to port it before the emergence of bhyve, which is also not connected to Linux.

          Anyway we were talking here about jails, which FBSD was blessed with over 20 years ago, well before the concept of Linux containers.

    • Re: (Score:2, Insightful)

      by CAIMLAS ( 41445 )

      I'm guessing you've not had to go through the upgrade process yet, then. Good luck. Jails are probably the least maintainable virtualization/container technology, and that's only because they're more niche than Docker.

      • Docker is a nightmare, please don't mention it in the same sentence with Jails. Yes, I have, in fact, upgraded several hardware systems with internal jails. I used 'freebsd-update' and went from 10.x all the way to 13. The portions of the jail that was being upgraded in my case, was shared with the master system. This is what the FreeBSD Handbook recommends [freebsd.org] in this scenario rather than having to do a make installworld on every jail, which it sounds like you tried. So, yeah, if you didn't plan well things wo
        • by CAIMLAS ( 41445 )

          So is it possible to update FreeBSD jails without a complete host/OS/kernel upgrade, first? Last I checked, there's still a fair amount of chicken/egg dependency crap going on there - eg. you've got to upgrade jail tools, but the jail tools require you to take the jails down before upgrade.

          Because that's not really something necessary with docker, as much as it sucks.

          • You do the make buildworld on the hardware/master box or use freebsd-update (whichever you prefer). This will upgrade your toolkit for Jails, possibly breaking any non-shared Jails you have setup. Shared Jails will be upgraded at the same time as the master/host box is upgraded. Having the containers down during the upgrade has always been possible and a good idea for me. So, I'm not sure about online-upgrades and such because I didn't need to do that. For non-shared jails, you'd often need to do a regular
            • by CAIMLAS ( 41445 )

              Hah - it'd have been really nice having a master build box or freebsd-update possibility when I last had to do this. Everything I had was peacemeal one-off and way out of sync. buildworld ran for weeks with multiple failures... it was a huge mess.

        • by CAIMLAS ( 41445 )

          That documentation didn't exist yet when I last used jails, largely because the tooling didn't exist. Had nothing to do with planning.

          • Okay, fair enough, but sounds like you were a super early adopter but didn't have the patience to let things stabilize and let the documentation catch up. By the time I started using Jails, they'd been around for many years, the documentation was more than adequate and the upgrade procedure was a known quantity. Personally, I don't consider Docker to be the same type of containerization as Jails, only similar. I'd say Jails compare more with LXC or OpenVZ. Personally, I had way better luck with OpenVZ than
            • by CAIMLAS ( 41445 )

              I inherited an environment which was built on STABLE initially, and this was some years since that. It was still long before any sane person would consider it STABLE, or usable for production. This was very early FreeBSD 7 RELEASE timeframe and I believe this was the first RELEASE with jail support. (It was still comparable to a barely usable beta and there was no way to really address the situation without migrating the jails elsewhere, or taking a significant outage.)

              I have no problem with upstream implem

              • I actually liked OpenVZ quite a bit. It's probably my overall favorite container system. It's got the best tools and features compared with what I've seen which is LXC, Zones, WPARs, and Jails. Parallels is the big driving force behind OpenVZ and it looks totally healthy to me with current development. The Proxmox guys said LXC has better storage support. However, I think the templates, tools, features, and ecosystem were better with OpenVZ, personally.
    • by sconeu ( 64226 )

      Are those Type-I and Type-II as measured on the Kardashev scale?

      Type-1: Uses all the resources of a single CPU
      Type-II: Uses all the resources of a PC
      Type-III: Uses all the resources of a LAN
      Type-IV: Uses all the resources available on the Internet

  • ...if I can wait that long.
  • On POWER machines, once you set up your two VIO servers (VIO servers are something odd to IBM, vms running a modified version of AIX called IOS, where they take the physical drives, virtualize everything, and hand it to the true VMs.) Because everything on the "virtual" size of the VIO servers is "generic", and requires no drives, the inner VMs that don't rely on any hardware can boot extremely quickly.

    I was wondering when we would see this functionality on PCs, where a hypervisor can do all the heavy lift

    • POWER boxes are pretty interesting. I had VIOS running and then wanted to switch back to bare metal. The ram previously allocated to VIOS was unavailable for other OS's until doing a factory reset. Now I'm seeing V7R2 IPL in under 5 minutes under VIOS.

    • by CAIMLAS ( 41445 )

      This functionality has existed for a very long time on linux. I'm not sure why it's even passingly mentionable on FreeBSD, except FreeBSD folks think they do everything better on the basis of a few small (but legitimate, highly useful) corner cases.

    • by groebke ( 313135 )

      Lol, I was going to snark post that it only took them ~15 years to catch up (sort of) to IBM VIO/AIX/Power...

  • by Tom ( 822 )

    use much fewer resources, and start up much quicker.

    And have a ton less code in ring 0 that could have (potentially exploitable) bugs.

    Now run your VM host on a seriously hardened system with MAC and RBAC and we're getting somewhere.

  • by jcochran ( 309950 ) on Wednesday August 30, 2023 @12:05PM (#63808932)

    The article being referenced says:

    FreeBSD (HEAD) no longer spends time running a bubblesort on its SYSINITs. We're now running a mergesort which is ~100x faster
    When the FreeBSD kernel boots in Firecracker (1 CPU, 128 MB RAM), it now spends 7% of its time running a bubblesort on its SYSINITs.
    O(N^2) can bite hard when you're sorting over a thousand items. Time to replace the bubblesort with something faster.

    Now, I don't see anything there that claims the boot itself is 100x faster, just that one small part of the boot is about 100x faster. And that part which is being improved only took 7% of the CPU's time.

    • by tlhIngan ( 30335 )

      FreeBSD (HEAD) no longer spends time running a bubblesort on its SYSINITs. We're now running a mergesort which is ~100x faster
      When the FreeBSD kernel boots in Firecracker (1 CPU, 128 MB RAM), it now spends 7% of its time running a bubblesort on its SYSINITs.
      O(N^2) can bite hard when you're sorting over a thousand items. Time to replace the bubblesort with something faster.

      Now, I don't see anything there that claims the boot itself is 100x faster, just that one small part of the boot is about 100x faster. An

    • WTF is a bubblesort doing anywhere at all and for all this time??? Linux I could see that being the case but in BSD?

      There is no way it's this much of a performance hit; it's all the goofy virtualization that is saving 100x speed. goofy because VMs are proving how much OS have failed at their jobs and now we've got separations being removed like some 60s idea for a more abstracted HAL. If you did the HAL properly you'd not need part of what a VM is for.

      I'm still hoping for a micro kernel system to get some

  • It is official: Netcraft now confirms: BSD is dying. One more crippling bombshell hit the already beleaguered BSD community when IDC confirmed that BSD market share has dropped yet again, now down to less than a fraction of 1 percent of all servers. Coming close on the heels of a recent Netcraft survey which plainly states that BSD has lost more market share, this news serves to reinforce what we've known all along. BSD is collapsing in complete disarray, as fittingly exemplified by failing dead last in th
  • At one point does it stop being a Virtual Machine and just become a protected memory space? I mean, if it's not really managing it's own disks and such, is it really an OS?

    • by dfghjk ( 711126 )

      When it stops virtualizing the whole machine and instead only virtualizes memory.

      "I mean, if it's not really managing it's own disks and such, is it really an OS?"

      What do you think an OS is? What do you think "it" is here?

      An OS *can* "manage its own disks and such" while those "disks and such" are actually virtualized because, you know, there's a VM. But they don't have to be because there's, you know, a VM. A VM uses virtualization hardware other than virtual memory.

  • Advertising for regulations to be created that require sharing details about hardware publicly! Thank you so very much!

  • Reads like the moment has arrived where compute become virtual and hardware is immaterial or synthetically abstracted away.

    Can SNOW suddenly handle images, streaming and movies? MacOS flippantly run Windows applications by throwing it all over the FreeBSD fence? Maybe ChatGPT can LLM humungous datasets spread over clusters of supercomputers?

    What hath freedom from OS’n wrought now that the data hath been set free, as in speech?

    • by dfghjk ( 711126 )

      "Reads like the moment has arrived where compute become virtual and hardware is immaterial or synthetically abstracted away."

      That moment arrived in the mid-60's. How old are you?

      "Can SNOW suddenly handle images, streaming and movies? MacOS flippantly run Windows applications by throwing it all over the FreeBSD fence? Maybe ChatGPT can LLM humungous datasets spread over clusters of supercomputers?

      What hath freedom from OS’n wrought now that the data hath been set free, as in speech?"

      Nice try,. but it

    • Reads like the moment has arrived where compute become virtual and hardware is immaterial or synthetically abstracted away.

      For me that moment arrived the first time I read the introduction to The Art of Programming... lol

      Nothing new is described here. What they're talking about is simply shifting which part of the code runs where, and removing redundant parts where the OS and the hypervisor both knew about the details of the hardware. Saying that only the hypervisor needs to know that stuff is useful, but the hypervisor is still part of the "compute."

      • Scalar memory maps on the fly addresses economy of scale rather than compute homogeneity. Abstractions are huge wins but that’s not evidently what AWS is selling – just bigger silos and flex runtime. That boils down to hotswap compute with infinite RAM potentials bandwidth-limited. The heavy haul provider for large data over their data paths. Sighhoped it presaged more.

  • Reboots fix lots of issues, right? When something goes wrong, reboot, and see if that helps! So if you can reboot in 25 ms, that allows you to reboot 40 times a second. Your system should run flawlessly all the time!

  • Colin Percival is the one who's been doing most of the work to speed up the FreeBSD boot process, for the last several years.
    He's made a lot of small improvements, and a few pretty big ones.
    His focus has mostly been Amazon VMs, but a lot of his changes have sped up the boot process on other hardware too.
    When FreeBSD 14.0-RELEASE comes out in October, it'll boot much zippier on everybody's computer.

  • Is this really a VM, then? At this point, with no hardware emulation and just talking to the hypervisor, you're blurring the line between a virtual machine it becomes just a regular application... running on a platform locked into a particular vendor. So we rediscovered the wheel here, good job.

  • Nice to see that modern OSs are finally catching up to where BeOS was about 25 years ago ;)

Children begin by loving their parents. After a time they judge them. Rarely, if ever, do they forgive them. - Oscar Wilde

Working...