Mice and elephants: queueing theory in computer science

Should you have to wait behind someone with a full trolley if all you’re buying is a loaf of bread? A similar question arises in data centres, where small and large jobs queue up to run. Mor Harchol-Balter (Carnegie Mellon University, US) uses queueing theory to work out which jobs should go first. She received the 2026 Van Wijngaarden Award for her research.

Mor Harchol-Balter first became fascinated by queueing theory as a young researcher at the University of California, Berkeley, when she took a course in the operations research department. “Sitting in those lectures, I thought, ‘We could use these ideas in computer science!’ Very few people were doing that at the time because queueing theory was seen as a branch of mathematics,” says the American professor. She wanted to apply the theory to computer jobs. “Much of queueing theory was developed for things like customers waiting in line or manufacturing processes. Computer systems require different models and different algorithms, so I had to prove new theorems. After all, computer jobs behave differently from people in a queue.”

Harchol-Balter published her findings in operations research journals and presented them at conferences. That was what first brought her to the Netherlands. “At the INFORMS Applied Probability Society, it seemed like everyone was always talking about queueing results from Dutch researchers. So, starting from the early 2000s, I made a point of traveling to the Netherlands every year or two to give a talk about whatever I was working on to get the Dutch perspective.”

Portrait of Mor Harchol-Balter

What does the Van Wijngaarden Award mean to you?

“It’s a real honour. The fact that people here thought of me and noticed my work means a lot to me, particularly from a place where there are so many excellent queueing theorists.”

How widely is queueing theory used in computer science today?

“In 2013 I wrote Performance Modeling of Computer Systems: Queueing Theory in Action. My goal in writing the book was to introduce computer scientists to queueing theory. I wanted to show how one part of it in particular, scheduling theory, can help us make efficient use of limited computing resources and still meet our latency goals. By latency, I mean the time it takes to get a result after you submit a job. Back then, I think a lot of computer scientists were surprised that queueing theory had anything to offer them. Now, when I visit companies, I see a lot more people with a copy of my book. I’m still not sure they’ve actually read it, though.”

What rule for scheduling computer jobs sounds sensible but often turns out to be a bad idea?

“First come, first served. People like to be served in the order they arrived. I got here before you, so I want to go first. But computer jobs don’t have feelings. One of the things we know from queueing theory is that it often makes sense to run the short jobs first.

“ In some research I’ve been doing recently I set out to prove that when you have several servers, you should always work on the short jobs first. It turned out I was wrong. I found that, if you want to minimise the latency tail, i.e., the chance that a job takes an exceptionally long time to finish, you’re better off reserving one server for the biggest jobs. That goes against even a queueing theorist’s intuition.”

How is AI changing things for data centres, and how can queueing theory help?

“The advent of AI workloads makes queueing theory even more useful. There’s much more variation now in the size of computer jobs. I like to think of jobs as mice and elephants. In a study I did at Google, only one per cent of the jobs were elephants, but they accounted for 99 per cent of the resources used. These elephants are the huge machine learning jobs.

“The first thing you have to do is protect the mice. If a mouse gets stuck behind an elephant, that little job takes far too long to finish. One thing you can do is set aside processing power and memory for the mice.

“What makes it tricky is that a job needs processing power, memory and bandwidth all at once, sometimes from several servers simultaneously. I like to think of it as packing a suitcase. If you put your mug in first, then your laptop, you might find there’s no room left for your handbag. Maybe you should have put the handbag in first and fitted the rest around it. And some jobs need more memory as they run. It’s like the things in your suitcase are growing.”

How are companies putting those ideas into practice?

“Google adopted my idea of dedicating separate servers for short jobs and long jobs. Another example from my research is my AutoScale algorithm for saving energy by turning off servers when they’re idle. You turn the light off when you leave a room. So why leave a server on when it’s sitting there doing nothing? Companies worry about turning servers off because it can take five minutes to start up again, and a job might have a half-second latency requirement. I used queueing theory to show that if you have enough servers, you hardly notice the start-up time. Once I’d put that idea into practice, Facebook, now Meta, adopted it.”

Do you think about your research when you’re standing in a queue yourself?

“All the time! Supermarkets in the US often have express checkouts for people with fewer than 15 items and regular lines for people with over 15 items. That makes sense if all you want is a loaf of bread. But how did they work out how many express checkouts they need? I also like to take my husband along. We each get in a different line. Whoever gets to the front first, signals to the other one to join them. This is related to a concept called ‘redundancy’ in computer systems.”

You go to quite a bit of trouble to make your lectures accessible and entertaining.

“I like to take a complicated mathematical idea and relate it to something students know. They’re much more likely to remember it that way. I try to do the same in my books. I tell stories and talk about things from everyday life. Otherwise, it’s hard to get a feel for what’s going on. It’s too much math.

“I love teaching. I started tutoring in sixth grade, when I was about eleven. By the time I was in high school, I was doing it five days a week. Every day I’d take the school bus home with a different student. I’d stay for a couple of hours, have dinner with the family, and then they’d drive me home. It was a way of helping out financially at home, and I really enjoyed it. I knew from an early age that I’d end up being a professor of some sort.”

What are you bringing to your talk this afternoon?

“Mice, elephants, suitcases, toys and chocolates. Even people who know the math inside out find it easier to picture what’s going on that way. And I’ll bring out a very large pair of scissors – if I remembered to pack them. Listening to difficult math gets tiring. A little comedy in the middle gives your brain a chance to rest.”

Header photo at top of page: From left to right: Lynda Hardman, awardees Carola-Bibiane Schönlieb and Mor Harchol-Balter and CWI director Vanessa Evers during the Van Wijngaarden Awards event.

Photos: Rebekka Mell