Routing Logic#
Overview#
Starburst Gateway checks incoming requests to see if they’re related to previous ones it handled. If they are, then Starburst Gateway sends them to the same backend that dealt with the earlier requests.
If it is a new request, the Starburst Gateway refers to Routing rules to decide which group of backends, called a ‘Routing Group,’ should handle it. It then picks a backend from that Routing Group to handle the request using either an adaptive or round-robin strategy.
Sticky routing#
A request related to an ongoing process, or to state maintained on a single backend cluster, must be routed to that backend for proper handling. Two mechanisms for identifying related requests are currently implemented. By default, only routing based on query identifier is enabled.
Routing based on query identifier (default)#
When a query is initiated through the Starburst Gateway, the query id will be
extracted from the response and mapped to the backend that provided the
response. Any subsequent request containing that query id will be forwarded
to that backend. For example, to retrieve query results, the trino client
polls a URI of the form
v1/statement/executing/queryid/nonce/counter
. Starburst Gateway will extract
the queryid from this URI.