FCFS load balancer (central queue) with Erlang-C validation, proper Wq measurement, and metrics plumbing #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What we changed
Rewrote LB FCFS to a token-based FIFO:
LoadBalancerRuntime._free_edges
:simpy.Store
holding one token per free LB→server edge.get()
s one token (blocking if none), then forwards the request to that edge.notify_server_free → lb.mark_free(edge_id)
to return the token when they finish.LoadBalancerRuntime.on_edge_added(edge_id)
so EventInjection can re-enable edges cleanly (push a token when a server comes back)._lb_waiting_time
and exposes them vialb_waiting_times
LOAD_BALANCER
entry.yield env.timeout(0)
) to preserve causal order of timestamps.SimulationRunner.run()
now passes the LB runtime intoResultsAnalyzer
(lb=self._lb_runtime
).ResultsAnalyzer
exposesget_lb_waiting_times()
and uses LB reference safely.MMc analyzer:
EventInjectionRuntime
re-adds edges (server up) and callslb_on_edge_added(edge_id)
(wired from the runner) so the token is immediately available again.OrderedDict
; any stale tokens are discarded by the LB loop.New FCFS tests covering the token FIFO:
Adjusted annotations (mypy) and lints (no blind
except
).