by Leon Rosenshein


A plate of latkes with sour cream

Yesterday was our 14th annual Latke Fry. Not just any latkes, but vegan, gluten free, Rosenshein latkes. 30+ hours after the cooking began, and I still smell a little like the short order cook I was one summer many years ago.

After last year’s disappointing 25 pounds of potatoes, this year’s 9 hours of cooking and 40 pounds of potatoes helped me realize something. The limiting factor in how many latkes get eaten and how many pounds of potatoes get used isn’t how hungry folks are, the number of guests, how hard I work, or how pipelined the latke assembly line is. It’s the size of my frying pans.

Or really, the size of my stove/counter. My stove and counter are big enough for me to have two 18 in frying pans going at once. That means that at any given moment I have 8 latkes frying. If a batch of latkes takes 10 minutes (round numbers), I can do 50 latkes an hour. 50 latkes an hour for 9 hours is ~ 450 latkes. That works out to be 80-100 happy people, but it also means that somewhere around 2:00 I have folks lined up by the stove, taking the latkes as soon as they’re ready.

And there’s not much I can do about that with my current setup. I’m already starting to cook early so I have a cached supply of latkes warming in the oven to help with peak demand. Outside of that, there’s not much more I can other than starting to cook earlier and increasing the size of the cache.

Shredding the potatoes and onions faster won’t help. Other folks are already doing that and there are always shredded potatoes ready for me. They’re already sitting in bowls waiting, and I want the potatoes to be as freshly shredded as possible. Pre-mixing the dry ingredients (salt, pepper, flour) might save a little time, like 10 seconds a batch, maybe 10 minutes over the whole day at best. Plus, the mixing of a batch happens while there are latkes frying, so and I’m mostly idle (other than schmoozing with my friends), so that’s not going to help with peak demand. I can’t just cook them faster by turning up the heat. The oil starts to burn and smoke, which leads to latkes with burnt outsides and raw insides. It also sets off the smoke detectors. And no-one wants that.

I could invite fewer folks over and reduce demand, but that goes directly against the vision of having as many happy guests get as many latkes as possible. That translates into more latkes. Which means higher throughput. So what’s a latke cook to do? My current plan is that next year I’ll try adding a third, smaller, frying pan, to increase batch size.

Latke Frys are great and we all had a good time, but what has any of this got to do with software? It’s the classic struggle of a batch system. How do you increase throughput when you can’t do anything about latency? It takes 10 minutes to cook a latke, whether you’re making 1 or 10 at a time. All you can do is do more at once. Which means finding the bottleneck and working on that. In my case it’s cooking area.

I know I can’t get my throughput up to meet peak demand. Latency (cooking time) is too high, and bandwidth (cooking surface area) is too limited. Instead, I maximize use of available bandwidth (adding another frying pan) to increase my throughput from the beginning, which lets my increase the size of my cache (more latkes in the oven staying warm). The increased cache size then lets me reduce apparent latency for the customer (latke eaters) by letting them pull from the cache (pre-cooked latkes) which has almost zero latency.

Just like any other distributed, pipelined, batch processing system.