Replies: 4 comments
-
Hasura docs suggest to use session mode? https://www.digitalocean.com/docs/databases/postgresql/how-to/manage-connection-pools/ |
Beta Was this translation helpful? Give feedback.
-
Thanks. That's helpful, as we were not using session. We are using the gatsby-source-graphql and they have a batch option. So I'm assuming we should set the batch size to a really high level, to group all the queries together? The idea being that if you have 1,000 posts, maybe you group 50 at a time for a batch? Wondering what others are doing. |
Beta Was this translation helpful? Give feedback.
-
I think using a reasonable setting for connection pool size in Hasura (HASURA_GRAPHQL_PG_CONNECTIONS env variable) should avoid the problem of exceeding the connection limit on the DB. |
Beta Was this translation helpful? Give feedback.
-
Aside from HASURA_GRAPHQL_PG_CONNECTIONS on the Gatsby side there may ned to be some tuning of GATSBY_EXPERIMENTAL_QUERY_CONCURRENCY and maxBatchSize - there's some more info under the "Performance tuning" section of the Gatsby docs: https://www.gatsbyjs.com/plugins/gatsby-source-graphql/#performance-tuning |
Beta Was this translation helpful? Give feedback.
-
We are using Hasura as the backend for creating a Gatsby website. The database is hosted at Digital Ocean with their managed databases. Gatsby is a static site generator, and the issue is that for Gatsby to build a site, they have to run "Page" queries on each build to get the post information from the database to create the static pages. We have a few thousand posts, so whenever Gatsby tries to rebuild the site, they execute over 1,000 queries against the database very rapidly. This causes the database connection to eventually fail, as we run over the connection limit (actually we tested the set up on a website with around 50 queries and the same connection issue occurs). Does anyone have any idea how to get this type of set up to work without running up against connection limits? I know this is not really an issue for Hasura per se, as it is not the database host, but I'm wondering if anyone has run across this issue, and how did they solve it. Is there some way for Hasura to "throttle" the queries it is getting from Gatsby and slow them down against the managed database (not sure I'm using the right terms)?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions