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

17 July, 2019

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: https://github.com/hasura/graphql-engine/blob/master/architecture/live-queries.md

search icon

About Hasura

Hasura allows you to mobilize & federate your organisation’s data by building a powerful, secure & flexible GraphQL API, that can query data in your databases, HTTP services, serverless functions as well as third party APIs.
Like what you read? Join our team! We’re hiring

Tanmai Gopal

Tanmai Gopal

Tanmai is the co-founder of hasura.io. He is passionate about making it easier to build things.

Read More