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

Increase live data poll rate to 2 seconds in OSS only #17000

Merged
merged 6 commits into from
Oct 10, 2023

Conversation

salazarm
Copy link
Contributor

@salazarm salazarm commented Oct 4, 2023

Summary & Motivation

Due to our recent changes to how we fetch asset data we can no longer provide a query refresh countdown. This makes the app feel less alive so for OSS only we want to increase the poll rate for data to every 2 seconds. In practice this means assets could be fetched at best every 2 seconds but it could take longer due to the chunking/queueing behavior of AssetLiveDataProvider (which is good).

@schrockn Asked for this specifically.

How I Tested These Changes

Locally I checked the network tab and made sure we were polling every 2 seconds

<CommunityNux />
</App>
</AppProvider>
<LiveDataPollRateContext.Provider value={2000}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept this outside of AppProvider intentionally because we only want to do this in OSS and not Cloud

@github-actions
Copy link

github-actions bot commented Oct 4, 2023

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-7z2zr5ykp-elementl.vercel.app
https://salazarm-live-data-poll-rate-oss.core-storybook.dagster-docs.io

Built with commit 5c4dda6.
This pull request is being automatically deployed with vercel-action

@schrockn
Copy link
Member

schrockn commented Oct 4, 2023

How difficult would this be to make command line option to dagster dev ?

@salazarm
Copy link
Contributor Author

salazarm commented Oct 4, 2023

@schrockn Not very difficult

@schrockn
Copy link
Member

schrockn commented Oct 4, 2023 via email

Copy link
Member

@schrockn schrockn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like @slopp 's eyes on this as well

@slopp
Copy link
Contributor

slopp commented Oct 4, 2023

makes sense to me

in cloud is the idea that deployments happen much less frequently so there isn't a need to poll as frequently?

@schrockn
Copy link
Member

schrockn commented Oct 4, 2023

This isn't about deployments. This is about seeing live updates about the state of assets. E.g, "Materialized at XXX" time.

@slopp
Copy link
Contributor

slopp commented Oct 4, 2023

cool - so why is it 2 secs in OSS and (afaict right now) 2 minutes in cloud?

@schrockn
Copy link
Member

schrockn commented Oct 4, 2023

cool - so why is it 2 secs in OSS and (afaict right now) 2 minutes in cloud?

I believe it is 30 seconds in Cloud and deployed OSS instances. That is a fairly arbitrary limit.

We don't do 2 seconds for production deployments because it could/would get prohibitively expense (both in terms of dollars and in ensuring reasonable database load).

The theory is that when you are doing dagster dev you are far more likely to be working in cases where you are only kicking off ad hoc runs and the local dev deployment has much less state.

Copy link
Collaborator

@bengotow bengotow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code for this looks good to me, but I'm curious why this change feels necessary. If the run log subscriptions are working, the refresh rate should automatically increase (up to SUBSCRIPTION_MAX_POLL_RATE = 2s) achieving this 2s refresh rate when events are coming in for on-screen assets. If this change makes a significant difference, it feels like something in there is probably not working? (If the issue is the app not picking up new runs fast enough, maybe we throw a comment in so we know we can undo this if/when we add a run launch subscription.)

If we're just going to refresh every 2s all the time we should remove the run log subscriptions in OSS entirely -- streaming run log events to every asset page is expensive and if MAX_POLL_RATE and IDLE_POLL_RATE are the same it doesn't do anything.

@schrockn
Copy link
Member

schrockn commented Oct 4, 2023

@bengotow Reason why is that for demos and local dev if you are, for example, kicking off runs with a sensor, the UI isn't updated for 30 seconds and it looks like something is going wrong. This will make it all feel much more realtime and less buggy.

@bengotow
Copy link
Collaborator

bengotow commented Oct 5, 2023

Ahhh yeah the kicking off runs with a sensor makes sense. We badly need a "run launch subscription" for some of the new AMP / sensor use cases.

@bengotow
Copy link
Collaborator

bengotow commented Oct 5, 2023

Would still vote to disable the run log subscriptions in this PR since they now have no impact on the refresh rate.

@salazarm
Copy link
Contributor Author

salazarm commented Oct 9, 2023

Would still vote to disable the run log subscriptions in this PR since they now have no impact on the refresh rate.

They would still have an impact in cloud. Also we're going to make it configurable via the CLI so it should still have an impact if they choose a setting greater than 2 seconds

@salazarm
Copy link
Contributor Author

salazarm commented Oct 9, 2023

@alangenfeld or @gibsondan could I get a review on the python bits adding the CLI argument. Could use feedback on the the argument name / help text

Copy link
Member

@schrockn schrockn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Just make sure note that time is measured in ms in help strings.

python_modules/dagster/dagster/_cli/dev.py Outdated Show resolved Hide resolved
python_modules/dagster-webserver/dagster_webserver/cli.py Outdated Show resolved Hide resolved
@salazarm salazarm merged commit f668316 into master Oct 10, 2023
1 check passed
@salazarm salazarm deleted the salazarm/live-data-poll-rate-oss branch October 10, 2023 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants