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

Allow servers to start with no background services #16693

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

cicdw
Copy link
Member

@cicdw cicdw commented Jan 11, 2025

This PR enhances the prefect server start command to allow for:

prefect server start --no-services

Which starts only the webserver and the "services" necessary for event processing (which aren't actual loop services).

I realized that prefect server start creates a single connection pool to the database that is shared across both the webserver and all running loop services; this seems problematic to me in high scale / high traffic situations - those connection pools have fundamentally different properties (timeout configuration, pool configuration, etc.).

The eventual idea is to recommend pairing this new flag with a new CLI command prefect services start that starts only the background loop services. This allows users to easily decouple these two components of the backend, scale them independently, etc. and in the short term will allow us to see if there are differences in connection statistics between services and the webserver through the new PREFECT_SERVER_DATABASE_CONNECTION_APP_NAME setting.

@cicdw cicdw added the enhancement An improvement of an existing feature label Jan 11, 2025
Copy link

codspeed-hq bot commented Jan 11, 2025

CodSpeed Performance Report

Merging #16693 will not alter performance

Comparing no-services (1e35e6e) with main (d069600)

Summary

✅ 2 untouched benchmarks


env = {**os.environ, **server_settings, "PREFECT__SERVER_FINAL": "1"}
if no_services:
env["PREFECT__SERVER_EPHEMERAL"] = "1"
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm realizing that re-using the ephemeral flag means the UI will never be served properly; I'm not opposed to merging this as-is for debugging purposes, but open to push back on that - either way I'll begin thinking about how to refactor this implementation so that the UI is served alongside the webserver

Copy link
Member Author

Choose a reason for hiding this comment

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

yea I should fix this prior to merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant