Region Routing
Introduction
With region routing, you can define the deployment configuration of your data connector for different regions.
For data connectors that connect to a data source, e.g. PostgreSQL, it is recommended to deploy the connector in a region closest to the data source to ensure efficient communication between the connector and the data source.
For other data connectors, e.g. Typescript, it is recommended to deploy the connector in a region closest to the consumers of the API to ensure efficient communication between the connector and the Hasura engine.
If you have a distributed data source, with multi-region routing, you can ensure that data is fetched from the data source closest to the user, thus minimizing latency for the request, improving the performance of your application, and providing a better user experience.
See the list of supported regions below.
Single-Region Routing
You can modify the Connector
object as per the highlighted values in the example below to force the deployment of your
data connector to a specific region. If the region is not specified, the connector will be deployed randomly to one of
the supported regions.
kind: Connector
version: v2
definition:
name: my_connector
subgraph: my_subgraph
source: hasura/connector_name:<version>
context: .
regionConfiguration:
- region: <region from the list below>
mode: ReadWrite
envMapping:
<CONNECTOR_ENV_VAR>: # e.g. CONNECTION_URI
fromEnv: <CONNECTOR_ENV_VAR> # e.g. Env Var set as DB read write URL
Multi-Region Routing
You can modify the Connector
object as per the highlighted values in the example below to define the deployment
configuration of your connector across multiple regions.
Multi-region routing is currently supported only for the PostgreSQL connector.
Support for other data connectors will be added soon.
kind: Connector
version: v2
definition:
name: my_connector
subgraph: my_subgraph
source: hasura/connector_name:<version>
context: .
regionConfiguration:
- region: <region1: region from the list below>
mode: ReadWrite
envMapping:
<CONNECTOR_ENV_VAR>: # e.g. CONNECTION_URI
fromEnv: <CONNECTOR_ENV_VAR_REGION_1> # e.g. Env Var set as DB read write replica URL in region1
- region: <region2: region from the list below>
mode: ReadOnly
envMapping:
<CONNECTOR_ENV_VAR>: # e.g. CONNECTION_URI
fromEnv: <CONNECTOR_ENV_VAR_REGION_2> # e.g. Env Var set as DB read only replica URL in region2
- region: <region3: region from the list below>
mode: ReadOnly
envMapping:
<CONNECTOR_ENV_VAR>: # e.g. CONNECTION_URI
fromEnv: <CONNECTOR_ENV_VAR_REGION_3> # e.g. Env Var set as DB read only replica URL in region3
Supported regions
Currently, Hasura DDN supports the following regions in GCP for multi-region routing:
gcp-asia-south1
gcp-asia-southeast1
gcp-australia-southeast1
gcp-europe-west1
gcp-southamerica-east1
gcp-us-east4
gcp-us-west2