You are here

Blogs

Making my home NFS server go faster for $22

It was time to replace my home file server, but first I needed to figure out how to solve a performance problem:

NFS is generally pretty good at reading and writing big files. If you're just copying a big file to an NFS partition, usually all you need to know is the bandwidth your network and your drives are capable of, and that will tell you how long the transfer will take.

So people are sometimes surprised when they need to do something that *isn't* just reading or writing a big file, and suddenly get much worse performance.

For example, let's extract an archive of the Linux kernel source. It's 176M. My client is connected to my server by gigabit ethernet, and the exported filesystem is striped across a couple of hard drives. It takes a couple seconds to copy the archive over, but a simple "tar -xzf ~/linux-5.9.tar.gz" onto the NFS filesystem takes nearly 2 hours.

The problem isn't the 176M; the problem is that it's trying to create about 75,000 files. Each file create requires a round trip to the server. Worse, the NFS protocol forbids the server from replying until it has guaranteed that the file is safely on disk. (The reasons for this are a bit subtle, but it's basically a consequence of the NFS protocol's guarantee to provide correct behavior even if the server crashes and comes back up while you're using it.)

Hard drives have RAM caches which allow them to respond quickly to writes, but those RAM caches are lost on power failure, so the NFS server code waits for the file to create to actually reach disk, an operation which takes the typical hard drive 10ms or more.

And "tar" isn't smart enough to use any paralellism--it's literally just creating a file, then setting some attributes, then writing the data, then closing it, then moving onto the next file. Do that 75,000 times, with several 10ms+ waits at each step, and it adds up.

So, you need faster storage. In particular, storage that's faster at committing data to "stable storage". (By which we mean, storage that will survive a power failure.) The traditional solution is a big fancy disk array with a RAM cache that's backed by battery, but those turn out to be expensive, and not something I want in my basement.

SSDs are fast, right? Well, yes, they're faster at most stuff, but it turns out that at this particular thing--committing data to stable storage--they're not necessarily much faster than hard drives.

The exception is "enterprise SSDs"--look for a feature that's usually called something like "enhanced power loss protection". These drives have big capacitors that work like batteries, so when the power dies unexpectedly, they have enough energy to get the data in their cache to stable storage before they shut down. They're a lot cheaper than big drive arrays. (And also much less annoying to have running in your basement 24/7.) But they're still kind of expensive.

But these days it turns out there's another option for cheapskates: this Intel 16GB Optane Memory. You can use it with Windows to do some special tricks if you have the right kind of motherboard, but it also works as a perfectly standard M.2 NVMe SSD. It's small, but it's only $22, and it turns out it's pretty fast at this one particular thing we need it to do--it can commit a write to stable storage in a fraction of a millisecond instead of needing 10ms or more.

Also, recent Linux kernels have a feature called dm-writecache that allows you to use a fast SSD as a write cache in front of slower drives. In my case I set up striping across two hard drives and the write cache on the Optane device with:


pvcreate /dev/sdb
pvcreate /dev/sdc
vgcreate export /dev/sdb /dev/sdc;
lvcreate -i 2 -l 100%VG stripehds
vgextend export /dev/nvme0n1
lvcreate -n optane -l 100%FREE export /dev/nvme0n1
lvchange -a n /dev/export/optane
lvconvert --type writecache --cachevol optane export

Then I NFS-exported /dev/export/stripehds.

All those file creates then go to the Otpane, which responds very quickly, and then they get flushed out to the hard drives over time.

The result is that the "tar -xzf linux-5.9.tar.gz" is down to 4-5 minutes. Still not great (it takes about 12s to a local disk on my machine), but a major improvement over 2 hours.

There's another way to do this, by the way: ext4 and xfs both allow you to put the journal onto a separate device from the device that hosts the rest of the filesystem. If you put the journal on the right kind of SSD (either an Optane, or an SSD with power loss protection), then you'll get a similar boost, though I find dm-writecache is doing better.

(Also, the 5.10 kernel I was using had a bug which limited performance; thanks to Mikulas Patocka for figuring it out. Hopefully the patch fixing the bug should be available in any kernel you'd use by the time you read this.)

There are still ways we could do better:

  • A high-end enterprise NVMe drive would probably be faster. I was going for cheap.
  • programs like tar could be rewritten to use parallelism.
  • If the Linux NFS server supported write delegations, that might help.
  • We've also considered adding support for write directory delegations to the protocol, which would allow the client to create files without waiting for the server. But that's a complicated project that would take a long time.

Planning Commission, Dec. 15 2020

Agenda and more here.

Not a complete agenda, just stuff I was mildly interested in:

Next meeting is January 5, 2021.

etrakit links

Have you ever wanted to link to a particular project or search result in etrakit? You can!

OK, this is the sort of thing that probably interests, like, 3 people. But maybe YOU are one of the lucky 3!

Some examples:

Lowertown zoning

The development at the south end of Broadway is adding hundreds of housing units in walking distance of our largest employer. It also cleaned up a long-standing pollution problem. It's exactly the kind of thing Ann Arbor needs, in a lot of ways.

A determined group of Broadway-area neighbors, however, was never happy with it. One of them has repeatedly claimed that the choice of zoning for the parcel lost $8,676,900 for affordable housing.

That claim is misleading.

There's a lot of zoning technicalities there, but basically it comes down to a claim that if the city could have driven a harder bargain, the developer would have built exactly the same building and given the city $8.7 million.

Which... who knows, maybe?! It's kind of hard to prove or disprove a hypothetical like that.

But it's a fairly big claim that there was an extra $8.7 million sitting around in their budget, or that they could have gone to their investors and said "hey, we're going with exactly the same plan as before, except you're going to advance us millions more, for no additional return!"

The more likely result is that they would have had to change the development somehow to make the numbers work out. Or that they would simply have given up and we'd still be arguing over an empty, polluted lot.

And, again, hundreds of housing units down the street from the UM medical campus is already a huge win, as far as I'm concerned.

It's also not clear that this group of neighbors would really have been appeased by an affordable housing contribution. There was plenty of public feedback during the planning process, and affordable housing was mentioned a few times, but their bigger focus was on making the buildings smaller, and on adding more retail, and more parking. None of which would be the kinds of changes required to make a big affordable housing contribution work out, quite the opposite.

Anyway, a little bit on the zoning details:

The request to city council was to rezone the parcel to C1A/R "Campus Area Business Residential District". It was originally zoned PUD.

The PUD zone includes some rules about housing density, which allow higher density than would otherwise be permitted if the project either includes a certain amount of affordable housing, or makes an equivalent contribution to the city's affordable housing fund.

Calculating that is complicated; from page 202 of the city's zoning code:

Proposed PUD projects exceeding the residential density
recommendation of the master plan, or the underlying zoning when the
master plan does not contain a residential density recommendation, by up
to 25% shall provide 10% of the total Dwelling Units as Affordable
Housing for Lower Income Households. Proposed PUD projects
exceeding the residential density recommendation of the master plan, or
the underlying zoning when the master plan does not contain a
residential density recommendation, by over 25% shall provide 15% of
the total Dwelling Units as Affordable Housing for Lower Income
Households.

b. Affordable Housing for Lower Income Households shall be provided by
the Development of units on-site, or payment of an affordable housing
contribution in lieu of units consistent with the formula adopted by
annual resolution of City Council, or by a combination of affordable
housing Development and contributions.

So, to work it out, you'd need to figure out that base level of density from the master plan or the previous zoning, figure out how much the project exceeded that density, and look up the annual city council resolution with the formula.

Tom Stulberg claims to have done this, and gotten the answer $8,676,900 (details of how he probably got that).

But, again, nobody actually brought a proposal to develop this project under PUD zoning, so nobody ever offered us that $8,676,900. The best you can say is that if we'd turned down the project that was proposed and suggested they try again as a PUD, maybe they would have proposed exactly the same plan. I'm not clear why anyone thinks that's the most likely result.

Some references:

(August 2021 addendum: Tom Stulberg tells me this post is "full of holes"; "I wasted a lot of time elsewhere explaining things to you. In my opinion, you don’t do your homework." Specific examples of such holes have not been forthcoming.)

Ann Arbor permits and projects going back to 1930

All the paperwork for permits and projects since about 2008 is in etrakit.

Previously, you need to make a trip to city hall for older stuff. I just noticed that they've now digitized documents going back to about 1930, which you can search by address:

Neat-o.

The 2020-2021 school year will be weird

(Note: I update this occasionally as I see new stuff.)

I'm working on our PTO's budget for next year, and I have questions.

Will be able to hold our usual events? Will there be field trips? (The PTO usually pays for field trips, and field trip expenses (especially busing) are a big part of the budget.)

My ramblings follow. The short version: we don't know. But it will probably not be a normal school year, even if it does include some in-person instruction.

I see the same headlines as everyone, but as much as possible I'd rather base our decisions on official recommendations--the school system, the state, etc. Unfortunately, there's not a lot of that yet, so I'm making some of my own guesses too.

One place to start is with the state's MI Safe Start Plan. It has six phases, from "1: uncontrolled growth", to "6: post-pandemic". Each phase has its own restrictions, criteria that must be met before we're considered in that phase. We can also move backwards through phases, for example if numbers start to trend up again.

Phase 6 essentially requires the pandemic to be over: "Community spread is not expected to return (e.g., because of a vaccine) and the economy is fully reopened." As far as I can tell from news reports, we're unlikely to reach phase 6 during the 2020-2021 school year. (See, for example, this New York Times article on the vaccine outlook, which reports optimism from vaccine research, but skepticism about our ability to scale to the production required to reach herd immunity through vaccination this year.)

So, realistically we'll likely be in phases 1 through 5. Phase 5 is the first phase to permit in-person K-12 education.

Phase 5 is still subject to social distancing ("maintain a six-foot distance from others when outdoors/in public"), requires face coverings, and requires gatherings be of "limited-size groups with social distancing" (limits unspecified).

Running in-person elementary school under those requirements sounds challenging.

West Bloomfield may be the only school district to have released a plan so far, reported on here. Students will attend school two days a week. Half will attend Monday and Tuesday, the other half Thursday and Friday, and Wednesday will be used for cleaning. This allows classes of half the size, for better social distancing. Also from that article:

Education officials who spoke to Bridge over the past few weeks regarding fall plans said schools are planning for multiple scenarios, from traditional school with facemasks and extra cleaning, to hybrid plans like West Bloomfield unveiled that limit the number of students in school buildings at any one time.

Alternating school attendance days is one plan being discussed; another is having half of students attend school in mornings, and half in afternoons.

The AAPS met Wednesday night: video, slides.

Flexibility is a big theme from that meeting. They expect a combination of "modified face-to-face", "virtual", and "blended" instruction, and hope to make the transition between those three as seamless as they can, to accommodate both changes in the public health system and varying family preferences. (They expect some families will choose to stay home even when not officially required to.)

It sounds like the hope to announce more in mid July. Probably we should meet to revise our budget after that.

They mentioned social events and field trips only to say that they understood they were important, that they would be impacted, and that they didn't know how yet.

---

Some more resources that I ran across:

The Bridge also has a list of colleges that have announced plans for the fall. Many are planning in-person classes, but I haven't tried to look into what that means in detail.

The CDC's considerations for schools.

This might be a source of links of plans from other states.

Other countries might provide more examples of what school reopening could look like:

UNESCO says 70% of students are out of school worldwide.

Korea

France

June 15 update: Michigan schools lean toward returning kids to classrooms amid coronavirus: more schools are considering in-person 5-day-a-week instruction, but coronavirus numbers are currently going in the wrong direction so this may be contentious.

Zoning and master planning

MSU has an article explaining the difference between a zoning map and a master plan.

Bascially: the master plan explains goals for our community, and what we'd like to do, but it's the zoning map that is the actual law. Even when the planning process requires review against the master plan, my understanding is that that review is mostly just advisory. If the project otherwise meets zoning and code, it probably can't be rejected just because of the master plan.

Ann Arbor's master plan is actually a collection of documents; see the City Master Plan page for links.

You can look at the zoning map here. Or, there are more ways to get it (like as pdfs) on the city's zoning administration page. If you just want to look up the zoning of a single property, simplest is probably to a "properties" search on etrakit.

But then you need to know what the zones mean. The definitive reference for that is the code.

Bond millages

So, the stuff I said here and here about millages doesn't really apply to bond millages, which are different in a few ways.

First, when we approve a bond millages, we don't approve a millage rate (like "1.5 mills"), we approve a total amount of borrowing; see for example the ballot language for the 2020 AAPS bond:

Shall the Public Schools of the City of Ann Arbor, County of Washtenaw, Michigan, borrow the principal sum of not to exceed One Billion Dollars ($1,000,000,000) and issue its general obligation unlimited tax bonds for the purpose of defraying the cost of making the following improvements....

So they're basically asking to borrow up to a billion dollars, and future millage rates will be determined by whatever's required to pay back the loan. (The ballot language has some more details, in particular estimates of likely millage rates.)

I said before that new construction brings new property tax revenue, but that isn't the case for bond millages--the total revenue is determined by what's needed to pay back the bonds. So, new construction in the AAPS district just spreads those payments over more taxpayers, decreasing the millage rate a little.

Of course, new residents in the AAPS district may also require new school expenses, so may require new bonds. The decrease due to new taxpayers should approximately balance out the increase due to new bonds: when we add more students to a geographical area, the cost per student should stay about the same.

(Except, that's not quite true: for example, the more students you have in the same area, the more students you can serve with a single bus and a single bus route, so the cheaper busing is per student. So, there's probably a slight decline in per student costs as you increase the number of students. I wonder how much it is?)

Bond millages aren't subject to Headlee rollbacks, for obvious reasons--we don't want to default on the bonds.

If you look up property tax information for a property in the property tax database, you can see an example of a bond millage on the "AAPS DEBT" line:

Wastewater

Another week, another A2CA session, this time, at Ann Arbor's Wastewater Treatment plant.

If you ask Google Maps for transit directions there, it tells you to take the 3 to Geddes and Dixboro, walk along Geddes to Parker Mill County Park, then walk south through the park to the plant.

So, that's what I did. The walk through the park, alongside Fleming Creek, was lovely. At the end of it, I could see the treatment plant--just on the other side of some fences and a railroad track.

So much for Google Maps.

So, I walked west along the path, across a bridge over the Huron River, to Old Dixboro Rd, where I thought I saw a railroad crossing. Alas, it was behind a locked gate. By this time it was getting dark, and I was getting discouraged, so I texted a fellow A2CA participant for help. That was when my phone died.

So, it was cold, and dark, I was on the wrong side of some railroad tracks, and I had no working phone (or map).

Anyway, it took a little more trial and error, but I did make it, about 20 minutes late.

I was a little miffed, after all that, that we spent the whole session in a conference room. I'll have to go back for an actual plant tour.

Earl Kenzie, the plant manager, is an affable and interesting guy. His presentation is here and includes some cool historic photographs of the plant being constructed in the 1930's, so you should go look at it now.

As it turns out, maybe my walk there did help my appreciate one of their challenges: the plant is locked in by a triangle of the active railroad, the Huron River, and Fleming Creek, which limits expansion.

When you flush the toilet, this is where it eventually ends up, after a trip through a sewer network that serves 130,000 people in the city of Ann Arbor and in Ann Arbor, Scio, and Pittsfield Townships. By the time it gets here, apparently it's basically a lot of grey water--18.4 million gallons a day of it on average, but it can go much higher during storms, and part of the plant is taken up by a huge system that can hold the surge when the plant temporarily can't keep up. Treated liquids are eventually released back into the Huron River, and solids go to either landfill or farm fields (where, for fear of contamination, they can only be used for crops like animal feed which don't go directly to humans).

Our sewer system is entirely separate from our storm water system--the latter is what handles water, for example, collected from storm drains in our roads. But during a big storm some storm water still can make it into the sewer system.

The annual budget is 15 million, which I believe is mainly from user fees. The city is required to base utility fees on costs (it can't use them as a way to raise general fund revenue), and to charge by use, as best it can. But of course our houses don't have sewage meters. So, if you've seen a bill, you probably know that your wastewater charges are based on your water meter--what comes in is a good approximation to what goes out.

We also heard from the Systems Planning and Engineering departments (roads!). That'll have to wait for another day....

Police and Fire

I didn't have any one big take-away from the police and fire session at the Ann Arbor Citizens Academy, just a collection of interesting bits:

  • I learned that there's a difference between EMTs and paramedics: EMTs provide "basic life support"--they can administer CPR and oxygen and provide some medications, for example. Paramedics have much more training and can do things like insert IVs. Fire department employees are EMTs. They can still be more useful in medical emergencies if they can get there earlier.
  • Judging from the police station tour, our police spend a lot of their time dealing with drunk drivers. The breathalyzer was a stop on the tour, as was the prominent line of tape on the floor designed to make it easy to find navigate to the breathalyzer room, even when it's 3am and you're terrifically drunk.
  • I'm no longer a toddler, but turns out that even for grownups a visit to the fire station, and a look at the big ladder truck, is fun. We did not get little plastic helmets to take home, but we did get to see the fire chief put on his fire-resistant suit, oxygen tank, helmet, and mask. Man, that stuff looks awkward and heavy.
  • So, wait, how do you fight a fire on the 12th story? You take the elevator. I guess that's kind of obvious, but it still surprised me--I'm so used to those warnings not to use the elevator in a fire. I guess that applies to residents going down, not firefighters going up. So isn't fire in a tall building scary? Well, steel and concrete don't burn easily, and big new buildings have well-engineered fire suppression systems, so that 12th-story fire is probably contained to the kitchen where it started. The fire chief said he'd rather fight a fire in a new, well-engineered building any day, compared to a century-old wood house that's been split up into apartments with a mystery floor layout.
  • The police department public relations guy is unhappy that they no longer have officers in the high schools. It's a point of disagreement between the fire department and the school board, apparently. I can imagine the arguments on both side, and it's something I'd be curious to dig into some day.
  • In the fire department, sounds like responding to crashes on the freeway is a big part of the job. I can't imagine. (Update: looking back at the annual report, they list 5 "vehicle extrications" (as opposed to, for example, 103 cooking fires) so maybe it's not *that* frequent.)

One question that I would like to get answered and didn't: from what I've seen, emergency fire department access is a big constraint on the design of our streets and buildings. I wonder where I'd go to understand those constraints, and whether there's anything we could do in cooperation with the fire department to loosen them in places. Somebody asked about this, but there wasn't time to go into it.

Fire department 2019 annual report. The police presentation isn't online--I'll link it in the future if I find it--but as usual the city website has plenty of information.

(Update: a friend recommends this article as an introduction to the fire code and building access requirements. Also note the fire department's inspections page says "The City of Ann Arbor has adopted the International Fire Code, 2015 edition (2015 IFC) as published by the International Code Council. Together with the provisions of Chapter 111 of the City Ordinance, shall be known as the Ann Arbor Fire Prevention Code." They note the IFC can be consulted at city hall, but it looks like the full text is online. Googling for US vs European fire access code also turns up this article.)

Pages

Subscribe to RSS - blogs