Monday, October 24, 2016

FreeBSD on Intel NUCs

I've been away from FreeBSD for a few years but I wanted some more functionality on my home network that I was able to configure with my Synology NAS and router. Specifically, I wanted:

  • a configurable caching name server that would serve up authoritative private names on my LAN and also validates responses with DNSSEC.
  • a more configurable DHCP server so I could make the server assign specific IPs to specific MAC addresses.
  • more compute power for transcoding videos for Plex.

Running FreeBSD 11 on an Intel NUC seemed like an ideal solution to keep my closet tidy. As of this week, $406.63 on Amazon buys a last generation i3 Intel NUC mini PC (NUC5I3RYH), with 8GB of RAM and 128GB of SSD storage. This was the first model I tried since I found reports of others using this with FreeBSD online, but I was also able to get it working on the newer generation i5 based NUC6i5SYK with 16GB of RAM and 256GB of SSD. The major issue with these NUCs is that the Intel wireless driver is not supported in FreeBSD. I am not doing anything graphical with these boxes so I don't know how well the graphics work, but they are great little network compute nodes.


I downloaded the FreeBSD 11 memory stick images, and was pleased to see that the device booted fine off the memory stick without any BIOS configuration required. However, my installation failed trying to mount root ("Mounting from ufs:/dev/ufs/FreeBSD_Install failed with error 19."). Installation from an external USB DVD drive and over the network with PXE both proved more successful at getting me into bsdinstaller to complete the installation.

I partitioned the 128GB SSD device with 8GB of swap and the rest for the root partition (UFS, Journaled and Soft Updates). After installation I edited /etc/fstab to add a tmpfs(5) mount for /tmp. The dmesg output for this host is available in a Gist on Github.

Warren Block's article on SSD on FreeBSD and the various chapters of the FreeBSD Handbook were helpful. There were a couple of tools that were also useful in probing the performance of the SSD with my FreeBSD workload:

  • The smartctl tool in the sysutils/smartmontools package allows one to read detailed diagnostic information from the SSD, including wear patterns.
  • The basic benchmark built into diskinfo -t reports that the SSD is transferring 503-510MB/second.
But how well does it perform in practice?

Rough Benchmarks

This post isn't meant to report a comprehensive suite of FreeBSD benchmarks, but I did run some basic tests to understand how suitable these low power NUCs perform in practice. To start with, I downloaded the 11-stable source from Subversion and measured the build times to understand performance of the new system. All builds were done with a minimal 2 line make.conf:


Build Speed

Build CommandEnvironmentReal Times
make -j4 buildkernel/usr/src and /usr/obj on SSD10.06 minutes
make -j4 buildkernel/usr/src on SSD, /usr/obj on tmpfs9.65 minutes
make -j4 buildworld/usr/src and /usr/obj on SSD1.27 hours
make buildworld/usr/src and /urs/obj on SSD3.76 hours


In addition to the build times, I also wanted to look more directly at the performance reading from flash and reading from the NFS mounted home directories on my 4-drive NAS. I first tried Bonnie++, but then ran into a 13-year old bug in the NFS client of FreeBSD. After switching to Bonnie, I was able to gather some reasonable numbers. I had to use really large file sizes for the random write test to eliminate most of the caching that was artificially inflating the results. For those that haven't seen it, Brendan Gregg's excellent blog post highlights some of the issues of file system benchmarks like Bonnie.

Average of 3 bonnie runs with 40GB block size
ConfigurationRandom I/OBlock InputBlock Output
Seeks/SecCPU UtilizationReads/secCPU UtilizationWrites/secCPU Utilization

The block input rates from my bonnie benchmarks on the SSD were within 5% of the value provided by the much quick and dirtier diskinfo -t test.

Running Bonnie with less than 40GB file size yielded unreliable benchmarks due to caching at the VM layer. The following boxplot shows the random seek performance during 3 runs each at 24, 32, and 40GB file sizes. Performance starts to even off at this level but with smaller file sizes the reported random seek performance is much higher.

Open Issues

As mentioned earlier, I liked the performance I got with running FreeBSD on a 2015-era i3 NUC5I3RYH so much that I bought a newer, more powerful second device for my network. The 2016-era i5 NUC 6i5SYK is also running great. There are just a few minor issues I've encountered so far:

  • There is no FreeBSD driver for the Intel Wireless chip included with this NUC. Code for other platforms exists but has not been ported to FreeBSD.
  • The memory stick booting issue described in the installation section. It is not clear if it didn't like my USB stick for some reason, or the port I was plugging into, or if additional boot parameters would have solved the issue. Documentation and/or code needs to be updated to make this clearer.
  • Similarly, the PXE Install instructions were a bit scattered. The PXE section of the Handbook isn't specifically targetting new manual installations into bsdinstall. There are a few extra things you can run into that aren't documented well or could be streamlined.
  • Graphics / X11 are outside of the scope of my needs. The NUCs have VESA mounts so you can easily tuck them behind an LCD monitor, but it is not clear to me how well they perform in that role.

Wednesday, January 7, 2015

AsiaBSDCon 2014 Videos Posted (6 years of BSDConferences on YouTube)

Sato-san has once created a playlist of videos from AsiaBSDCon. There were 20 videos from the conference held March 15-16, 2014 and papers can be found here. Congrats to the organizers for running another successful conference in Tokyo. A full list of videos is included below. Six years ago when I first created this channel videos longer than 10 minutes couldn't normally be uploaded to YouTube and we had to create a special partner channel for the content. It is great to see how the availability of technical video content about FreeBSD has grown in the last six years.

Friday, June 28, 2013

Trip Report from USENIX ATC 2013

I spent half of the week at USENIX ATC in San Jose. I previously attended in 2000, 2001, 2002, and 2004, and I have been to other more academic USENIX conferences in the intervening years such as FAST and OSDI, but I have not made it back to Annual Tech in nearly a decade.

The conference is very familiar but has also definitely changed since '04 (no more terminal rooms and the BoF board was nearly empty!) I was very happy with the caliber of the accepted papers in the main conferences as well as in many of the workshops of Federated Conferences Week (HotStorage, HotCloud, etc.). There is less industry and open-source participation now, but still a variety of really interesting talks about storage, networking, operating systems, virtualization, and more from academia and (a smaller subset of) industry.

As I've previously noted on this blog, I think the BSD conferences are great, but that it is very important for the FreeBSD community to also present work at some of the broader open-source and academic systems conferences. I would be much more likely to attend EuroBSDCon if it were held adjacent to EuroSys or FOSDEM, for example. And would be more likely to attend a U.S.-based BSD conference if it were held adjacent to a USENIX or O'Reilly Strata event.

On Wednesday my team presented one of our main projects of last year, Janus: Optimal Flash Provisioning for Cloud Storage Workloads. This work describes a method for automatically segregating hot and cold storage workloads in a large distributed filesystem, formulates an optimization problem to match the available flash to different workloads in such a way as to maximize the total reads going to flash, and then places that hot data on the distributed flash devices instead of distributed disk devices.

There were a number of other really interesting talks about flash, virtualization, and distributed storage systems, but I wanted to highlight two short-papers that I think would most appeal to the FreeBSD audience here:

  • Practical and Effective Sandboxing for Non-root Users, Taesoo Kim and Nickolai Zeldovich, MIT CSAIL
    This was a nice practical short paper about interposing system calls, using unionfs in a clever way, and taking some revision control ideas for a nice little tool.
  • packetdrill: Scriptable Network Stack Testing, from Sockets to Packets, Neal Cardwell, Yuchung Cheng, Lawrence Brakmo, Matt Mathis, Barath Raghavan, Nandita Dukkipati, Hsiao-keng Jerry Chu, Andreas Terzis, and Tom Herbert, Google
    Another practical short paper about a portable tool, which works on FreeBSD or Linux, that enables testing the correctness and performance of entire TCP/UDP/IP network stack implementations, from the system call layer to the hardware network interface, for both IPv4 and IPv6. This tool was instrumental in identifying 10 bugs in the Linux network stack and enabling the development of three new features: TCP—Early Retransmit, Fast Open, and Loss Probes.

I'm not sure if I'll go to FAST, or USENIX ATC, or both next year, but it's likely I'll attend at least one. What other industry conferences outside of the BSDCan/EuroBSDCon circuit does the FreeBSD community congregate at these days? For folks that have been in industry 10+ years, do you go to more or less industry conferences now than in the past?

Saturday, February 4, 2012

Updated TCP Proposals and FreeBSD

There are a number of proposals for improving TCP performance coming out of Google that have some implications for FreeBSD. These proposals have taken the form of a group of IETF proposals, RFCs, patches to the Linux kernel, and research publications. A nice summary of the different initiatives is available from Lets Make TCP Faster on the Google Code Blog.

TCP Fast Open by Radhakrishnan, Cheng, Chu, Jain, and Raghavan is based on the observation that modern web services are dominated by TCP flows so short that they terminate a few round trips after handshaking. This means that the 3-way TCP handshake is a significant source of latency for such flows, and they describe a new mechanism for secure data exchange during the initial handshake to reduce some of the round-trip network transmission and associated latency for such short TCP transfers. This work shares many goals and challenges with T/TCP, which was previously in FreeBSD but suffered from some security vulnerabilities.

David Malone posted some thoughts on my Google+ post about how FreeBSD could implement the various changes. Maybe we could have some Summer of Code students work in this area this summer?

Friday, August 19, 2011

Two New Videos: SuperPages and NanoBSD

Thanks to Kirk McKusick, I'm happy to announce two new fully edited high quality videos from BSDCan 2011 in the BSD Conferences YouTube channel. I've also created a new playlist for the BSDCan 2011 videos.

The first talk is "Superpages in FreeBSD" by McKusick, and it describes the addition of superpage support to the FreeBSD 8 kernel on the Intel PC architecture. Superpages aggregate together standard-sized hardware pages into much larger "superpages". Each superpage requires only one entry in the page table replacing the numerous entries used by the standard-sized hardware pages.

The second talk is "Updates from NanoBSD: FreeNAS drives NanoBSD development" from Warner Losh, and it describes the basics of NanoBSD and how FreeNAS moved over to NanoBSD.

We now have 108 high-quality videos in the BSD Conferences channel. These videos have been watched in aggregate over 400,000 times, and our most popular video remains McKusick's FreeBSD Kernel Internals Lecture.

As a reminder, this channel was setup specifically for the BSD technical community and does not have the standard limitations on video size for other types of YouTube uploads. If you have additional video content from a conference, presentation, or class about BSD Unix please get in touch and I'd be happy to help you publish the content here.

Thursday, August 18, 2011

Luigi Talks Netmap on Google Tech Talks Channel

Last week, Luigi Rizzo visited Google and gave a talk on high-speed networking with Netmap.

This was Luigi's second talk at Google and the third talk about FreeBSD in the Google Tech Talks YouTube channel. We also have more than 100 videos available in the BSD Conferences channel.