210 likes | 311 Views
CSC407: Software Architecture Winter 2007 Performance (II). Greg Wilson gvwilson@cs.utoronto.ca. Model Revisited. Service Rate μ. FCFS. Arrival Rate λ. Parameters: Service Order (FCFS) Average Arrival Rate ( λ ) Service Requirement (S) Mean Service Time (E[S])
E N D
CSC407: Software ArchitectureWinter 2007Performance (II) Greg Wilson gvwilson@cs.utoronto.ca
Model Revisited Service Rate μ FCFS Arrival Rate λ • Parameters: • Service Order (FCFS) • Average Arrival Rate (λ) • Service Requirement (S) • Mean Service Time (E[S]) • Average Service Rate (μ = 1/E[S]) • For single server model, we require λ≤μ Queue Server
Performance Metrics Busy Period: B Server Busy Ns Nq Jobs Completed: C λ μ Total Time: T Tw Ts • Response Time, Time in System (Ts) • Waiting Time (Tw) • Number of jobs in System (Ns) • Number of jobs in Queue (Nq) • Utilization (Ui): Ui = Bi/Ti • Throughput (Xi): Xi = Ci/Ti = μi Ui • Utilization Law:Ui = Xi. E[S]
Exponential Distribution • Let q(t) be the probability that nothing happens in time interval t • If x represents the waiting time to the first event, then by definition P{x>t} = q(t) • If the system is memoryless, then: q(t1)q(t2) = q(t1 + t2) • Only solution is q(t) = e-λt • So Fx(t) = P{x≤t} = 1-q(t) = 1-e-λt
Another View • Let s and t be time intervals ≥ 0 • Probability of something happening is independent of whatever has (or hasn’t) happened before) • Note: mean and standard deviation are both 1/λ • λ is often called the rate
How Many? • If interarrival times are exponentially distributed, then P{k events in [0,t]} = λte-λt/k! • A Poisson distribution with parameter λ • So: if the arrival and service times are both memoryless, what is the system’s performance? • I.e., if jobs arrive independently, and the times required to process jobs are independent, how quickly can we do them? • And how long will the queue get?
M/M/1 Queue 0 1 1 2 3 4 5 6 λ λ λ λ λ λ • Memoryless property: If the last job arrived t0 time ago, no job will arrive for time t with the probability P0(t) = e-λt. • For small Δt, • P0(Δt) = 1 - λ Δt • P1(Δt) = λ Δt • Pk(Δt) = 0 for k > 1 • The arrival process can be viewed as an infinite state machine where each state is the number of jobs in the queue
…M/M/1 Queue • Service time also follows exponential distribution. • So the departure process can be viewed as: 0 1 1 2 3 4 5 6 μ μ μ μ μ μ
…M/M/1 Queue μ μ μ μ μ μ 1 2 λ 0 1 3 4 5 6 λ λ λ λ λ • The M/M/1 queue can be viewed as: • The “M” means “Markovian” • Or “memoryless” • The “1” means “a single server” • So what’s the probabiliyt of being in state N?
Markov Models • A way to translate transition probabilities into occupation times • Among other things 0.4 0.6 A B 0.2 0.1 0.8 0.3 0.2 C D 0.2 0.7 0.5
…Markov Models • Under-determined • But PA + PB + PC + PD = 1.0
Using the Model • Data center has M machines • fail per hour • Takes h hours to repair, so = 1/h • How often are all machines running? • How often are fewer than half machines running? • Often written into Service Level Agreements (SLAs) • If halving the failure rate costs $F/machine, and halving the repair time costs $R, which is the better investment?
Generalized Birth-Death Models • A restricted class of Markov models 1 2 3 0 0 1 2 3 … 1 2 3 0
M/M/1 System: Steady State μ μ μ μ μ μ 1 2 λ 0 1 3 4 5 6 λ λ λ λ λ
Utilization: U = 1 – π0 = = λ/μ Conventional to use for utilization instead of U Number of customers in whole system: …M/M/1 System – Performance Measures
Mean Response Time: Little’s Law: E[Ns] = λ E[Ts] …M/M/1 System – Performance Measures • Remember: μ≥λ • Hm… what if μ = λ ?
Mean Wait Time in queue (Tw = TQ): Number of jobs waiting in queue Nw: Using Little’s Law: E[Nw] = E[Tw] = 2 / (1 - ) …M/M/1 System – Performance Measures
Example • File server: 30 requests/sec, 15 msec/request • What is the average response time? • What would it be if the arrival rate doubled? • Assume requests are independent (must verify) • Utilization = E[S] = 0.45 • So average response time is E[S]/(1 - ) = 0.027 sec • At 60 requests/sec, response time is 0.15 sec • Doubling request rate increased response time by 5.6!