Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
401 changes: 65 additions & 336 deletions asyncflow_queue_limit/asyncflow_mm1.ipynb

Large diffs are not rendered by default.

96 changes: 61 additions & 35 deletions asyncflow_queue_limit/asyncflow_mmc.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
{
"cell_type": "code",
"execution_count": 96,
"execution_count": 19,
"id": "3e168d4a",
"metadata": {},
"outputs": [],
Expand All @@ -45,7 +45,7 @@
},
{
"cell_type": "code",
"execution_count": 97,
"execution_count": 20,
"id": "dd39a8e3",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -112,7 +112,7 @@
},
{
"cell_type": "code",
"execution_count": 98,
"execution_count": 21,
"id": "d2937e5e",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -168,9 +168,9 @@
" LinkEdge(id=\"lb-srv1\", source=\"lb-1\", target=\"srv-1\", ),\n",
" LinkEdge(id=\"lb-srv2\", source=\"lb-1\", target=\"srv-2\", ),\n",
" LinkEdge(id=\"lb-srv3\", source=\"lb-1\", target=\"srv-3\", ),\n",
" LinkEdge(id=\"srv1-client\", source=\"srv-1\", target=\"client-1\",),\n",
" LinkEdge(id=\"srv2-client\", source=\"srv-2\", target=\"client-1\",),\n",
" LinkEdge(id=\"srv3-client\", source=\"srv-3\", target=\"client-1\",),\n",
" LinkEdge(id=\"srv1-client\", source=\"srv-1\", target=\"rqs-1\",),\n",
" LinkEdge(id=\"srv2-client\", source=\"srv-2\", target=\"rqs-1\",),\n",
" LinkEdge(id=\"srv3-client\", source=\"srv-3\", target=\"rqs-1\",),\n",
" ]\n",
"\n",
" settings = SimulationSettings(\n",
Expand Down Expand Up @@ -201,7 +201,7 @@
},
{
"cell_type": "code",
"execution_count": 99,
"execution_count": 22,
"id": "d0634bc8",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -285,47 +285,73 @@
"\n",
"---\n",
"\n",
"## Observed (from simulation)\n",
"## Observed (from simulation, FCFS/Erlang-C)\n",
"\n",
"After processing metrics:\n",
"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",
"\n",
"1. **Arrival rate**:\n",
"1. **Arrival rate**\n",
"\n",
"$$\n",
"\\lambda_{\\text{Observed}} = \\text{mean throughput (client completions)}\n",
"\\lambda_{\\text{obs}}=\\mathrm{mean}(\\text{Throughput RPS})\n",
"$$\n",
"\n",
"2. **Service rate**:\n",
"Mean of the throughput series (client completions per fixed window, typically 1 s).\n",
"\n",
"2. **Service rate**\n",
"\n",
"$$\n",
"\\mu_{\\text{Observed}} = 1 / \\overline{S}, \\quad \\overline{S} = \\text{mean(service\\_time)}\n",
"\\mu_{\\text{obs}}=\\frac{1}{\\overline{S}},\\quad \n",
"\\overline{S}=\\mathrm{mean}(\\texttt{SERVICE\\_TIME})\n",
"$$\n",
"\n",
"3. **End-to-end latency**:\n",
"Computed from per-request server buckets, aggregated across all servers.\n",
"\n",
"3. **End-to-end time**\n",
"\n",
"$$\n",
"W_{\\text{Observed}} = \\text{mean(client latencies)}\n",
"W_{\\text{obs}}=\\mathrm{mean}(\\text{client latencies})\n",
"$$\n",
"\n",
"4. **Waiting time**:\n",
"From the generator’s request clocks (start/finish per request).\n",
"\n",
"4. **Queue waiting time (LB)**\n",
"\n",
"$$\n",
"W_{q,\\text{Observed}} = \\text{mean(waiting\\_time)} \n",
"W_{q,\\text{obs}}=\\mathrm{mean}(\\text{LB waiting times})\n",
"$$\n",
"\n",
"5. **Little’s law check**:\n",
"Mean of the **load balancer FCFS** waiting time recorded per request (not inferred from queue length).\n",
"\n",
"5. **Mean number in system**\n",
"\n",
"$$\n",
"L_{\\text{Observed}} = \\lambda_{\\text{Observed}} W_{\\text{Observed}}, \\qquad\n",
"L_{q,\\text{Observed}} = \\lambda_{\\text{Observed}} W_{q,\\text{Observed}}\n",
"L_{\\text{obs}}=\\mathrm{mean}(\\texttt{L\\_SYSTEM})\n",
"$$\n",
"\n",
"6. **Utilization**:\n",
"Time average of the sampled series of **concurrent requests in the system** (sampled every $\\Delta t$).\n",
"*Fallback if the series is unavailable in tests:* $L_{\\text{obs}}=\\lambda_{\\text{obs}} W_{\\text{obs}}$.\n",
"\n",
"6. **Mean number in queue (LB)**\n",
"\n",
"$$\n",
"\\rho_{\\text{Observed}} = \\lambda_{\\text{Observed}}/(c\\,\\mu_{\\text{Observed}})\n",
"L_{q,\\text{obs}}=\\mathrm{mean}(\\texttt{LQ\\_LB})\n",
"$$\n",
"\n",
"Time average of the **LB queue length** series.\n",
"*Fallback:* $L_{q,\\text{obs}}=\\lambda_{\\text{obs}} W_{q,\\text{obs}}$.\n",
"\n",
"7. **Global utilization**\n",
"\n",
"$$\n",
"\\rho_{\\text{obs}}=\\mathrm{mean}(\\texttt{SERVER\\_UTILIZATION})\n",
"$$\n",
"\n",
"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",
"*Fallback:* $\\rho_{\\text{obs}}=\\lambda_{\\text{obs}}/(c\\,\\mu_{\\text{obs}})$.\n",
"\n",
"> 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",
"\n",
"\n",
"---\n",
"\n",
"## Comparison\n",
Expand All @@ -339,27 +365,27 @@
},
{
"cell_type": "code",
"execution_count": 100,
"execution_count": 23,
"id": "ccd7379b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"=================================================================\n",
"===================================================================\n",
"MMc (FCFS/Erlang-C) — Theory vs Observed\n",
"-----------------------------------------------------------------\n",
"sym metric theory observed abs rel%\n",
"-----------------------------------------------------------------\n",
"λ Arrival rate (1/s) 270.000000 270.258333 0.258333 0.10\n",
"μ Service rate (1/s) 100.000000 100.036707 0.036707 0.04\n",
"rho Utilization 0.900000 0.900531 0.000531 0.06\n",
"L Mean items in sys 10.053549 10.073544 0.019994 0.20\n",
"Lq Mean items in queue 7.353549 7.371934 0.018385 0.25\n",
"W Mean time in sys (s) 0.037235 0.037274 0.000038 0.10\n",
"Wq Mean waiting (s) 0.027235 0.027277 0.000042 0.15\n",
"=================================================================\n"
"-------------------------------------------------------------------\n",
"sym metric theory observed abs rel%\n",
"-------------------------------------------------------------------\n",
"λ Arrival rate (1/s) 270.000000 269.751667 -0.248333 -0.09\n",
"μ Service rate (1/s) 100.000000 100.058789 0.058789 0.06\n",
"rho Utilization 0.900000 0.898517 -0.001483 -0.16\n",
"L Mean items in sys 10.053549 9.865831 -0.187718 -1.87\n",
"Lq Mean items in queue 7.353549 7.170280 -0.183269 -2.49\n",
"W Mean time in sys (s) 0.037235 0.036556 -0.000680 -1.83\n",
"Wq Mean waiting (s) 0.027235 0.026562 -0.000674 -2.47\n",
"===================================================================\n"
]
}
],
Expand Down
Loading