DEV Community

Hasura for Hasura

Posted on • Originally published at on

How Hasura scales to 1 million active GraphQL subscriptions (live queries)

Hasura is a GraphQL engine on Postgres that provides instant GraphQL APIs with authorization. Hasura allows 'live queries' for clients (over GraphQL subscriptions). For example, a food ordering app can use a live query to show the live-status of an order for a particular user.

We designed hasura to be scalable right out of the gate. We recently tested Hasura's performance to handle a million active live queries. As part of the test setup multiple clients (a web/mobile app) subscribe to data or a live-result with an auth token. The data is in Postgres. 1 million rows are updated in Postgres every second (ensuring a new result pushed per client). Hasura is the GraphQL API provider (with authorization).

The results: At 1 million live queries (and hence 1 million open websocket connections to Hasura), Postgres is under about 28% load with peak number of Postgres connections at around 850.

We've written about the architecture that enables this performance (and some more notes on our benchmarking process and tooling) on our github repo.

Check it out here:

Top comments (0)