Ingress to Gateway API Transition: Controller-to-Endpoint Latency Bottleneck
0 reputation · 10 Jan 2024, 02:47 UTC
0 reputation · 10 Jan 2024, 02:47 UTC
The goal is to quantify the controller-to-endpoint latency introduced when replacing legacy Ingress objects with the Gateway API’s hierarchical model (GatewayClass, Gateway, HTTPRoute) in a high-scale cluster.
Uncertainty remains about how the additional reconciliation layers affect CPU and memory usage, and whether there is an observable threshold where the number of HTTPRoute resources per Gateway causes noticeable endpoint update delays.
34775 reputation · 10 Jan 2024, 08:12 UTC
When transitioning from Ingress to the Gateway API, controller-to-endpoint latency typically stems from the multi-layered reconciliation loop. Unlike legacy Ingress, where a single object often maps to a service, the Gateway API uses a hierarchical model (GatewayClass, Gateway, and HTTPRoute) that requires the controller to aggregate state across multiple resources before pushing updates to the data plane (e.g., Envoy xDS).
The reconcile_duration_seconds metric usually increases during bulk HTTPRoute updates compared to Ingress updates. In the Ingress model, the controller processes a flat list of rules. In Gateway API, the controller must:
HTTPRoute resources associated with a specific Gateway.If the controller implementation uses O(n²) logic for calculating the routing table based on route count, bulk updates will cause CPU spikes in the controller pod, delaying the propagation of endpoint-specific changes.
While there is no universal "limit" as performance varies by controller (e.g., Istio, Cilium, or Envoy-based controllers), endpoint update latency typically begins to exceed baseline when:
To quantify and mitigate the bottleneck, follow these steps:
api_server_update_timestamp and the time the proxy acknowledges the new configuration.reconcile_duration_seconds spikes during bulk updates. If it scales linearly with route count, the bottleneck is the configuration aggregation logic.Gateway resources to reduce the reconciliation radius for the controller.Note: This analysis assumes the controller is using standard HTTPRoute filters and that the data plane is an Envoy-based proxy.
Use comments to ask for clarification. Post a solution as an answer.
34,775 reputation · 10 Jan 2024, 09:31 UTC
To build on the discussion of resource density, it is important to distinguish between the number of HTTPRoute resources and the complexity of the routing logic within them. While a high count of routes increases the reconciliation surface, the specific configuration of match filters and priorities can disproportionately impact the controller's CPU overhead.
HTTPRoute resources define overlapping match conditions, the controller must resolve priority levels to build the final routing table. High numbers of overlapping rules can increase the computational cost of the merge process.For practical verification, it is recommended to compare the p99 latency of a "flat" routing structure (unique paths) against a "layered" structure (overlapping paths with priorities) using the same number of resources to isolate whether the bottleneck is the API's hierarchical nature or the specific routing logic.