Chuyển đến nội dung

Bài 11 · M/M/1 Queues

M/M/1 Performance Measures

Derive L, Lq, W and Wq for the M/M/1 queue from its steady state, verify them with Little's law and put them in a reusable calculator.

With the steady-state distribution Pn = (1 - ρ) ρ^n in hand, the performance measures follow by simple sums and Little's law. These four formulas are worth memorizing, because they are the baseline against which every other queueing model is compared.

Deriving L

The mean number in the system is

L = Σ n Pn = (1 - ρ) Σ n ρ^n

For |ρ| < 1 the sum Σ n ρ^n equals ρ / (1 - ρ)², so

L = ρ / (1 - ρ)

You can also see this as the mean of a geometric distribution that starts at zero: (1-ρ) is the success probability, so the mean number of "failures" is ρ/(1-ρ).

The other three by Little's law

  • Queue length. The number in the queue is N - 1 when N ≥ 1, and 0 otherwise. So Lq = L - ρ = ρ² / (1 - ρ).
  • Time in system. Little's law L = λW gives W = L/λ = 1 / (μ - λ).
  • Time in queue. Wq = W - 1/μ = ρ / (μ - λ), which equals Lq/λ.
Measure Formula
L ρ / (1 - ρ)
Lq ρ² / (1 - ρ)
W 1 / (μ - λ)
Wq ρ / (μ - λ)

Take a help desk that gets 8 requests per hour and resolves 10 per hour. Then ρ = 0.8, L = 4, Lq = 3.2, W = 1/(10 - 8) = 0.5 hours (30 minutes) and Wq = 0.8/2 = 0.4 hours (24 minutes). Notice that 24 of the 30 minutes are spent waiting. Only 6 minutes are service.

A symbolic check

A computer algebra system can confirm the sum for us. Here we use SymPy to compute Σ n (1-ρ) ρ^n for the concrete value ρ = 4/5, then get Lq as L - ρ.

Python Check L with SymPy

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A reusable calculator

The function below returns all measures for an M/M/1 queue and checks that they satisfy Little's law and the identity L = Lq + ρ. Use the same time unit for λ and μ.

Python M/M/1 calculator

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

How the measures scale

Compare the formulas at different utilizations. With μ = 1 per minute, each measure is a function of ρ alone. They all blow up like 1/(1-ρ). For example L at ρ = 0.5, 0.9, 0.99 is 1, 9, 99.

Python The 1/(1-rho) blow-up

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A useful rule: halving the slack 1 - ρ doubles the queue. Going from 90% to 95% busy halves the slack from 0.10 to 0.05, so the waits double.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. An M/M/1 queue has lambda = 3 and mu = 4 per minute. What is L?

    rho = 0.75 and L = rho / (1 - rho) = 0.75 / 0.25 = 3.
  2. 2. With lambda = 3 and mu = 4 per minute, what is W?

    W = 1 / (mu - lambda) = 1 / 1 = 1 minute.
  3. 3. What is Lq for the same queue?

    Lq = L - rho = 3 - 0.75 = 2.25, or rho^2/(1-rho) = 0.5625/0.25 = 2.25.
  4. 4. If rho goes from 0.9 to 0.95, L changes from 9 to ...

    L = 0.95 / 0.05 = 19, which is more than double.

Summary

  • L = ρ/(1-ρ), Lq = ρ²/(1-ρ), W = 1/(μ-λ), Wq = ρ/(μ-λ).
  • They are linked by Little's law and by L = Lq + ρ, W = Wq + 1/μ.
  • All blow up like 1/(1-ρ) as utilization approaches 1.
  • Always check units and that λ < μ.

Next: The Waiting-Time Distribution

Theo dõi tiến độ của bạn

Tạo tài khoản miễn phí để đánh dấu bài đã học và tiếp tục từ chỗ bạn dừng lại trên mọi thiết bị.