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

Add process-level parallelism to uvicorn.run #103

Merged
merged 2 commits into from
Oct 4, 2024
Merged

Conversation

gordonhart
Copy link
Member

Enable multiple worker processes when running the app in normal mode (not --dev) and add test verifying that database reads and writes behave as expected under these conditions.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.92%. Comparing base (a3b7745) to head (f7a4c54).

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk     #103   +/-   ##
=======================================
  Coverage   96.92%   96.92%           
=======================================
  Files          34       34           
  Lines        1465     1465           
=======================================
  Hits         1420     1420           
  Misses         45       45           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gordonhart gordonhart marked this pull request as ready for review October 4, 2024 14:31
@@ -53,3 +53,37 @@ def write() -> None:

with get_database_connection(database_file) as conn:
assert conn.cursor().execute("SELECT COUNT(*) FROM test").fetchone() == (1 + n_writers,)


def multiproc_read_write(database_file: Path, n_readers: int) -> list[list[tuple[str]]]:

Choose a reason for hiding this comment

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

side note: EFS seems to be build around NFS, and there's mention of intricacies in NFS file locking from faq. I have not looked further yet.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good flag, I'll see if this causes any issues. This PR doesn't fix the underlying slowness problem on Cloud, just mitigates it — still some digging to do to find the culprit for the slowdown.

@gordonhart gordonhart merged commit 539c485 into trunk Oct 4, 2024
11 checks passed
@gordonhart gordonhart deleted the gh/slow-loading branch October 4, 2024 14:34
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.

3 participants