Skip to content

feature: HASURA_REPLICAS runs more than one Hasura - #706

Merged
lukepolo merged 1 commit into
mainfrom
feature/hasura-replicas
Oct 31, 2026
Merged

lukepolo merged 1 commit into
mainfrom
feature/hasura-replicas

Conversation

@lukepolo

Copy link
Copy Markdown
Contributor

HASURA_REPLICAS in .5stack-env.config (default 1) sets how many Hasuras serve the api. write_overlays adds a kustomize replicas entry for the deployment, and rejects anything but a whole number. A preferred pod anti-affinity puts replicas on separate nodes where several are labelled 5stack-hasura=true; with one replica it changes nothing.

Why: in the api's load lab one Hasura (-N4) is busy from about 3,000 users. At 3k, a second replica took subscription first data from 3.6 s to 1.4 s (median) and queries from 598 to 233 ms. The cost is Postgres memory: each replica keeps its own pool (pool_settings.max_connections: 16 in the api's metadata) plus a few connections of its own, about 1.5 GB more at that load.

Don't set it above 1 until api#929 is in the api image: it makes the Hasura pods' init containers take turns running migrations instead of running them at once.

@lukepolo
lukepolo merged commit 1b5c519 into main Oct 31, 2026
5 checks passed
@lukepolo
lukepolo deleted the feature/hasura-replicas branch October 31, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant