Routing logic#
Overview#
Starburst Gateway routes requests differently depending on whether they are related to previous requests:
If a request is related to a previous request, the Gateway routes it to the same backend that handled the previous request.
If a request is unrelated to a previous request, the Gateway uses routing rules to select a routing group, then chooses a backend from that group.
Sticky routing#
Requests that are part of ongoing processes or depend on backend-managed state must be routed to the same backend cluster that initiated or maintains that state.
Starburst Gateway uses two methods to identify and route related requests.
Query identifier routing#
The default query routing mechanism is query identifier routing.
With this method, when you submit a query, the Gateway extracts the query ID from your backend’s response. The Gateway then routes all subsequent requests that reference this query ID to the same backend.
For example, when retrieving query results, the client polls URIs like
v1/statement/executing/queryid/nonce/counter
to check if results are
available. Starburst Gateway extracts the query ID from these URIs and routes the
requests accordingly.