...wait...
All checks were successful
beefhavers/queue-theory/pipeline/head This commit looks good

This commit is contained in:
adam 2025-04-16 22:33:18 -04:00
parent b7f5bc53be
commit 6f0b6786aa
3 changed files with 8 additions and 71 deletions

View File

@ -20,10 +20,6 @@ Even though the line for the dryer is shorter, you still have to go wait in line
[next line: slower] [next line: slower]
The point of this metaphor is that the other, shorter line is an illusion. All of the laundry has to go through "the laundry room" as a whole. The point of this metaphor is that the other, shorter line is an illusion. All of the laundry has to go through "the laundry room" as a whole.
## disney proved it
[//TODO: I think? maybe it was another amusement park? someone with a roller coaster, I'm pretty sure. or maybe, whoever came up with M/M/c did, and roller coaster operators went "oh neat."]
## how we do it ## how we do it
Since the world is hellbent on doing everything the most wrong way possible, here's what we do instead. Since the world is hellbent on doing everything the most wrong way possible, here's what we do instead.
@ -82,4 +78,11 @@ soon we have 2 lines of 10.
Every single delay in each line is compounded through the entire line - line 1, guy drops his credit card before handing it over? add a second to the wait time for everyone behind him. Another guy needs to count out coins? add 3 minutes for everyone behind him. Register 2 falls off the internet and has to reconnect? add 5 minutes for everyone in line 2. Every single delay in each line is compounded through the entire line - line 1, guy drops his credit card before handing it over? add a second to the wait time for everyone behind him. Another guy needs to count out coins? add 3 minutes for everyone behind him. Register 2 falls off the internet and has to reconnect? add 5 minutes for everyone in line 2.
[simulate M/M/1 x2] [simulate M/M/1 x2]
[//TODO: grok the math, prove it out] ## MATH
so far, my source has been "trust me bro".
[LRR dech tech for phyrexia all will be one] It's time... for.. MATH
...actually I think this whole video is invalid. the math implies that an m/m/c queue is equivalent to c m/m/1 queue's. I think.
https://rossetti.github.io/RossettiArenaBook/app-qts1sb2.html

View File

@ -1,3 +0,0 @@
'MURICA
"it takes 2 hours to do a load of laundry, washes and dries it for you. Now, I have a washer, and a dryer. takes 1 hour to wash 1 hour to dry. Which one of these is faster at doing laundry?"
Markovian<br />Markovian<br />c servers

View File

@ -1,63 +0,0 @@
They say brits love to queue. out here in
we are very, very bad at it. There's a complete branch of mathematics dedicated to studying queue theory, though I imagine niether you nor I have a math degree. But we don't need one to do it right.
I'm stealing this metaphor from Casey Muratori.
Casey goes on to explain that you can gain performance by overlapping work within a pipeline.
Now. Imagine you are the laundry.
Your goal is to get through the wash, ideally as quickly as possible. So you wait in line for the washing machine, and then wait in line for the dryer.
Even though the line for the dryer is shorter, you still have to go wait in line for the wash first.
The point of this metaphor is that the other, shorter line is an illusion. All of the laundry has to go through "the laundry room" as a whole.
Since the world is hellbent on doing everything the most wrong way possible, here's what we do instead.
on airlines, you pay more to sit earlier. which is silly to me, you still have to wait for the cheap seats to board before the plane takes off. The only difference is that now your whole boarding process is slower, and you've burned more money to have to leave the airport bar earlier.
In a grocery store, what arises naturally is 1 line per register. This allows you to try and change lines if you think it'll get you up to the register faster.
If you're the gambling type.
There's a better way. Let us assume the following:
* no customer is entitled to get through the line faster than any other.
* every server is equivalent.
There's a better way to do this: It's called an M/M/c queue. You arrive, whatever server is available handles you, and you're gone. This does mean that instead of looking at 2 lines, you look at 1 line that has twice as many people in it. But it also means that a line twice as long moves *at least* twice as fast.
Which is why bank tellers tell you to wait in line for them to be ready.
Even better than that, suppose you have more tellers than registers. If you're at a bar and most people have a tab running, you can have a server sign in, find your tab, add your drink to it, and then sign out, freeing up that register while they pour the beer. This way with 3 staff and 2 machines,
the math is calculated with 3 "service nodes" instead of 2.
Additionally, having more people than machines rotating around provides a signal that we're doing it the efficient way.
Let's imagine an average bar in a cursed city.
...maybe a mediocre bar.
Let's imagine 20 people want beer, there are 2 registers, and 3 bartenders.
First, let's do it right.
20 people start filling out the singular beer line.
a bartender summons the customer at the front of the line to the register. He takes the customer's order. Keys it in. Goes to start filling beer. Once the order is taken, the register is free for another bartender while the glass is being poured, so the customer shifts out of the way while waiting. repeat, 20 times.
Now, let's see what results when people think they're smart.
the first person to have to wait in line picks a register. possibly at random, possibly through some assumption about which would be faster.
The second person sees a register has 1 person in line, another register has 0, so he gets in line for register 2.
soon we have 2 lines of 10.
Every single delay in each line is compounded through the entire line - line 1, guy drops his credit card before handing it over? add a second to the wait time for everyone behind him. Another guy needs to count out coins? add 3 minutes for everyone behind him. Register 2 falls off the internet and has to reconnect? add 5 minutes for everyone in line 2.