Multi-Region Routing
With multi-region routing, you can easily 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.
Multi-region routing is currently supported only for PostgreSQL and PostgreSQL-compatible data sources.
To use multi-region routing in Hasura DDN, you only need a supported data source deployed in (or near) more than one of the supported regions.
Configuration
If you don't have a project setup that lets you query PostgreSQL, please follow
this guide. Once you have a working project, you can modify the
ConnectorManifest
configuration as per the highlighted values in the example below to enable multi-region routing.
kind: ConnectorManifest
version: v1
spec:
supergraphManifests:
- base
definition:
name: mypg
type: cloud
connector:
type: hub
name: hasura/postgres:v0.6.0
deployments:
- context: .
mode: ReadWrite
region: gcp-us-west2
env:
CONNECTION_URI:
valueFrom: CONNECTION_URI_FOR_READ_WRITE_REPLICA
- context: .
mode: ReadOnly
region: gcp-us-east4
env:
CONNECTION_URI:
valueFrom: CONNECTION_URI_FOR_READ_REPLICA_IN_US_EAST4
- context: .
mode: ReadOnly
region: gcp-europe-west1
env:
CONNECTION_URI:
valueFrom: CONNECTION_URI_FOR_READ_REPLICA_IN_EUROPE_WEST1
In the above configuration example, Hasura DDN will route all the write queries (mutations) to the PostgreSQL database
in the gcp-us-west2
region and the read queries (queries and subscriptions) to either gcp-us-east4
or
gcp-europe-west1
based on the geolocation of the client.
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