|
20 | 20 | }, |
21 | 21 | { |
22 | 22 | "cell_type": "code", |
23 | | - "execution_count": 96, |
| 23 | + "execution_count": 19, |
24 | 24 | "id": "3e168d4a", |
25 | 25 | "metadata": {}, |
26 | 26 | "outputs": [], |
|
45 | 45 | }, |
46 | 46 | { |
47 | 47 | "cell_type": "code", |
48 | | - "execution_count": 97, |
| 48 | + "execution_count": 20, |
49 | 49 | "id": "dd39a8e3", |
50 | 50 | "metadata": {}, |
51 | 51 | "outputs": [ |
|
112 | 112 | }, |
113 | 113 | { |
114 | 114 | "cell_type": "code", |
115 | | - "execution_count": 98, |
| 115 | + "execution_count": 21, |
116 | 116 | "id": "d2937e5e", |
117 | 117 | "metadata": {}, |
118 | 118 | "outputs": [], |
|
168 | 168 | " LinkEdge(id=\"lb-srv1\", source=\"lb-1\", target=\"srv-1\", ),\n", |
169 | 169 | " LinkEdge(id=\"lb-srv2\", source=\"lb-1\", target=\"srv-2\", ),\n", |
170 | 170 | " LinkEdge(id=\"lb-srv3\", source=\"lb-1\", target=\"srv-3\", ),\n", |
171 | | - " LinkEdge(id=\"srv1-client\", source=\"srv-1\", target=\"client-1\",),\n", |
172 | | - " LinkEdge(id=\"srv2-client\", source=\"srv-2\", target=\"client-1\",),\n", |
173 | | - " LinkEdge(id=\"srv3-client\", source=\"srv-3\", target=\"client-1\",),\n", |
| 171 | + " LinkEdge(id=\"srv1-client\", source=\"srv-1\", target=\"rqs-1\",),\n", |
| 172 | + " LinkEdge(id=\"srv2-client\", source=\"srv-2\", target=\"rqs-1\",),\n", |
| 173 | + " LinkEdge(id=\"srv3-client\", source=\"srv-3\", target=\"rqs-1\",),\n", |
174 | 174 | " ]\n", |
175 | 175 | "\n", |
176 | 176 | " settings = SimulationSettings(\n", |
|
201 | 201 | }, |
202 | 202 | { |
203 | 203 | "cell_type": "code", |
204 | | - "execution_count": 99, |
| 204 | + "execution_count": 22, |
205 | 205 | "id": "d0634bc8", |
206 | 206 | "metadata": {}, |
207 | 207 | "outputs": [ |
|
285 | 285 | "\n", |
286 | 286 | "---\n", |
287 | 287 | "\n", |
288 | | - "## Observed (from simulation)\n", |
| 288 | + "## Observed (from simulation, FCFS/Erlang-C)\n", |
289 | 289 | "\n", |
290 | | - "After processing metrics:\n", |
| 290 | + "Under FCFS we derive **each KPI directly** from sampled time series or per-request buckets, **not** by deriving one observed KPI from another. This keeps Little’s law checks as **independent validations**, not definitions.\n", |
291 | 291 | "\n", |
292 | | - "1. **Arrival rate**:\n", |
| 292 | + "1. **Arrival rate**\n", |
293 | 293 | "\n", |
294 | 294 | "$$\n", |
295 | | - "\\lambda_{\\text{Observed}} = \\text{mean throughput (client completions)}\n", |
| 295 | + "\\lambda_{\\text{obs}}=\\mathrm{mean}(\\text{Throughput RPS})\n", |
296 | 296 | "$$\n", |
297 | 297 | "\n", |
298 | | - "2. **Service rate**:\n", |
| 298 | + "Mean of the throughput series (client completions per fixed window, typically 1 s).\n", |
| 299 | + "\n", |
| 300 | + "2. **Service rate**\n", |
299 | 301 | "\n", |
300 | 302 | "$$\n", |
301 | | - "\\mu_{\\text{Observed}} = 1 / \\overline{S}, \\quad \\overline{S} = \\text{mean(service\\_time)}\n", |
| 303 | + "\\mu_{\\text{obs}}=\\frac{1}{\\overline{S}},\\quad \n", |
| 304 | + "\\overline{S}=\\mathrm{mean}(\\texttt{SERVICE\\_TIME})\n", |
302 | 305 | "$$\n", |
303 | 306 | "\n", |
304 | | - "3. **End-to-end latency**:\n", |
| 307 | + "Computed from per-request server buckets, aggregated across all servers.\n", |
| 308 | + "\n", |
| 309 | + "3. **End-to-end time**\n", |
305 | 310 | "\n", |
306 | 311 | "$$\n", |
307 | | - "W_{\\text{Observed}} = \\text{mean(client latencies)}\n", |
| 312 | + "W_{\\text{obs}}=\\mathrm{mean}(\\text{client latencies})\n", |
308 | 313 | "$$\n", |
309 | 314 | "\n", |
310 | | - "4. **Waiting time**:\n", |
| 315 | + "From the generator’s request clocks (start/finish per request).\n", |
| 316 | + "\n", |
| 317 | + "4. **Queue waiting time (LB)**\n", |
311 | 318 | "\n", |
312 | 319 | "$$\n", |
313 | | - "W_{q,\\text{Observed}} = \\text{mean(waiting\\_time)} \n", |
| 320 | + "W_{q,\\text{obs}}=\\mathrm{mean}(\\text{LB waiting times})\n", |
314 | 321 | "$$\n", |
315 | 322 | "\n", |
316 | | - "5. **Little’s law check**:\n", |
| 323 | + "Mean of the **load balancer FCFS** waiting time recorded per request (not inferred from queue length).\n", |
| 324 | + "\n", |
| 325 | + "5. **Mean number in system**\n", |
317 | 326 | "\n", |
318 | 327 | "$$\n", |
319 | | - "L_{\\text{Observed}} = \\lambda_{\\text{Observed}} W_{\\text{Observed}}, \\qquad\n", |
320 | | - "L_{q,\\text{Observed}} = \\lambda_{\\text{Observed}} W_{q,\\text{Observed}}\n", |
| 328 | + "L_{\\text{obs}}=\\mathrm{mean}(\\texttt{L\\_SYSTEM})\n", |
321 | 329 | "$$\n", |
322 | 330 | "\n", |
323 | | - "6. **Utilization**:\n", |
| 331 | + "Time average of the sampled series of **concurrent requests in the system** (sampled every $\\Delta t$).\n", |
| 332 | + "*Fallback if the series is unavailable in tests:* $L_{\\text{obs}}=\\lambda_{\\text{obs}} W_{\\text{obs}}$.\n", |
| 333 | + "\n", |
| 334 | + "6. **Mean number in queue (LB)**\n", |
324 | 335 | "\n", |
325 | 336 | "$$\n", |
326 | | - "\\rho_{\\text{Observed}} = \\lambda_{\\text{Observed}}/(c\\,\\mu_{\\text{Observed}})\n", |
| 337 | + "L_{q,\\text{obs}}=\\mathrm{mean}(\\texttt{LQ\\_LB})\n", |
327 | 338 | "$$\n", |
328 | 339 | "\n", |
| 340 | + "Time average of the **LB queue length** series.\n", |
| 341 | + "*Fallback:* $L_{q,\\text{obs}}=\\lambda_{\\text{obs}} W_{q,\\text{obs}}$.\n", |
| 342 | + "\n", |
| 343 | + "7. **Global utilization**\n", |
| 344 | + "\n", |
| 345 | + "$$\n", |
| 346 | + "\\rho_{\\text{obs}}=\\mathrm{mean}(\\texttt{SERVER\\_UTILIZATION})\n", |
| 347 | + "$$\n", |
| 348 | + "\n", |
| 349 | + "Each server samples a 0/1 “busy” indicator; $\\rho_{\\text{obs}}$ is the time average (with 1 core/server it matches the busy fraction).\n", |
| 350 | + "*Fallback:* $\\rho_{\\text{obs}}=\\lambda_{\\text{obs}}/(c\\,\\mu_{\\text{obs}})$.\n", |
| 351 | + "\n", |
| 352 | + "> Because each quantity comes from its own primary measurement (series or buckets), cross-relations like $L=\\lambda W$ and $L_q=\\lambda W_q$ are genuine **consistency checks**, not tautologies.\n", |
| 353 | + "\n", |
| 354 | + "\n", |
329 | 355 | "---\n", |
330 | 356 | "\n", |
331 | 357 | "## Comparison\n", |
|
339 | 365 | }, |
340 | 366 | { |
341 | 367 | "cell_type": "code", |
342 | | - "execution_count": 100, |
| 368 | + "execution_count": 23, |
343 | 369 | "id": "ccd7379b", |
344 | 370 | "metadata": {}, |
345 | 371 | "outputs": [ |
346 | 372 | { |
347 | 373 | "name": "stdout", |
348 | 374 | "output_type": "stream", |
349 | 375 | "text": [ |
350 | | - "=================================================================\n", |
| 376 | + "===================================================================\n", |
351 | 377 | "MMc (FCFS/Erlang-C) — Theory vs Observed\n", |
352 | | - "-----------------------------------------------------------------\n", |
353 | | - "sym metric theory observed abs rel%\n", |
354 | | - "-----------------------------------------------------------------\n", |
355 | | - "λ Arrival rate (1/s) 270.000000 270.258333 0.258333 0.10\n", |
356 | | - "μ Service rate (1/s) 100.000000 100.036707 0.036707 0.04\n", |
357 | | - "rho Utilization 0.900000 0.900531 0.000531 0.06\n", |
358 | | - "L Mean items in sys 10.053549 10.073544 0.019994 0.20\n", |
359 | | - "Lq Mean items in queue 7.353549 7.371934 0.018385 0.25\n", |
360 | | - "W Mean time in sys (s) 0.037235 0.037274 0.000038 0.10\n", |
361 | | - "Wq Mean waiting (s) 0.027235 0.027277 0.000042 0.15\n", |
362 | | - "=================================================================\n" |
| 378 | + "-------------------------------------------------------------------\n", |
| 379 | + "sym metric theory observed abs rel%\n", |
| 380 | + "-------------------------------------------------------------------\n", |
| 381 | + "λ Arrival rate (1/s) 270.000000 269.751667 -0.248333 -0.09\n", |
| 382 | + "μ Service rate (1/s) 100.000000 100.058789 0.058789 0.06\n", |
| 383 | + "rho Utilization 0.900000 0.898517 -0.001483 -0.16\n", |
| 384 | + "L Mean items in sys 10.053549 9.865831 -0.187718 -1.87\n", |
| 385 | + "Lq Mean items in queue 7.353549 7.170280 -0.183269 -2.49\n", |
| 386 | + "W Mean time in sys (s) 0.037235 0.036556 -0.000680 -1.83\n", |
| 387 | + "Wq Mean waiting (s) 0.027235 0.026562 -0.000674 -2.47\n", |
| 388 | + "===================================================================\n" |
363 | 389 | ] |
364 | 390 | } |
365 | 391 | ], |
|
0 commit comments