Advanced load balancing algorithms and connection management strategies for confidential virtual machine clusters
connect_top_n
). this ensures that traffic is routed to peers that are known to be alive and responsive, minimizing latency and avoiding stale or unreachable instances.
the algorithm for sorting and selecting the top N instances is implemented as follows (main_service.rs:329-334):
See implementation in gateway/src/main_service.rs (permalink):
connect_top_n
is set to 0, the system also defaults to random selection. for localhost development, a special case routes traffic directly to 127.0.0.1
.
for implementation details, see select_top_n_hosts
.
main_service.rs
(permalink). this mechanism ensures that applications or operators can always target a particular CVM when needed, without interference from the load balancer.
connect_top_n
is set to 0), the gateway switches to a fallback strategy.
See fallback implementation in gateway/src/main_service.rs (permalink):
[core.recycle]
section. for example: