graphql-engine
graphql-engine copied to clipboard
Configure Event Polling Interval
Is your proposal related to a problem?
For context, we're using Hasura Cloud with a Vercel Postgres instance. As I understand it Hasura's eventing system uses a poller. That means it needs to be continuously connected to the database. That isn't ideal in a serverless environment, where the pricing is based on very granular compute time. In our case, we only use eventing for a scheduled process which uses a fan-out architecture. It doesn't really matter if events run hours after the actual operation in our case. It's a small side project, which is starting to cost more than some of our small production applications because of this combination we're testing out.
Describe the solution you'd like
I would like to be able to configure the polling interval. In our case, maybe every hour. I would also like to be able to better understand and configure how many events would be processed at a time when the poller runs.
Describe alternatives you've considered
Using a different database provider. That would be fair, but this setup is quite nice if we can make it work.
We could also just run a cron ourselves or using a different queueing mechanism, but then we would lose some of Hasura's benefits.
I would also like to clarify something: if we don't have any events in Hasura, does the poller turn off, and will our database usage drop down? My assumption is yes. But I don't know if Hasura does other things that might be problematic and keep the database awake in a serverless database environment.
@raphaeltm you can configure the event polling interval by setting HASURA_GRAPHQL_EVENTS_FETCH_INTERVAL
env var.
More details - https://hasura.io/docs/latest/event-triggers/observability-and-performance/#performance-tuning
if we don't have any events in Hasura, does the poller turn off
Yes. If there are no events, then the event poller is not started.
@ecthiender amazing, thanks! I don't know why I had so much trouble finding that. It's quite clear.
@raphaeltm you can configure the event polling interval by setting
HASURA_GRAPHQL_EVENTS_FETCH_INTERVAL
env var.More details - https://hasura.io/docs/latest/event-triggers/observability-and-performance/#performance-tuning
if we don't have any events in Hasura, does the poller turn off
Yes. If there are no events, then the event poller is not started.
@ecthiender FYI, I tried to configure this in Hasura Cloud and it won't let me. The value shows up in red and the "add" button is disabled as you can see in the following screenshot (I don't know if this comment should be in another location):
@raphaeltm ah! Support for this env var is missing on the cloud dashboard. Let me get back to you on this.
But you should be able to use it in your local dev or self-hosted instances, till we add support for this on the cloud dashboard. I'll keep you posted on it.