Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Event Polling Interval #10061

Open
raphaeltm opened this issue Dec 19, 2023 · 5 comments
Open

Configure Event Polling Interval #10061

raphaeltm opened this issue Dec 19, 2023 · 5 comments

Comments

@raphaeltm
Copy link

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.

@raphaeltm raphaeltm added the k/enhancement New feature or improve an existing feature label Dec 19, 2023
@raphaeltm
Copy link
Author

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.

@ecthiender
Copy link
Member

@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 ecthiender added k/question v2 and removed k/enhancement New feature or improve an existing feature labels Dec 20, 2023
@raphaeltm
Copy link
Author

@ecthiender amazing, thanks! I don't know why I had so much trouble finding that. It's quite clear.

@manasag manasag closed this as completed Dec 21, 2023
@raphaeltm
Copy link
Author

@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):

CleanShot 2024-01-15 at 10 41 17@2x

@ecthiender
Copy link
Member

ecthiender commented Jan 17, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants