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

Beaker workspace performance #328

Merged
merged 3 commits into from Jul 5, 2022
Merged

Beaker workspace performance #328

merged 3 commits into from Jul 5, 2022

Conversation

epwalsh
Copy link
Member

@epwalsh epwalsh commented Jun 27, 2022

Fixes #326 (hopefully)

Changes proposed in this pull request:

⚠️ We're assuming requests.Session() is thread safe for this use-case, even though the maintainers of requests don't provide any guarantees of thread safety. That said, following the discussion in psf/requests#2766, it seems the main reason for concern is the lack of thread safety in urllib3.PoolManager (psf/requests#2766 (comment)). The thread-safety issue with the pool manager seems to boil down to this: urllib3/urllib3#1252 (comment). That is, when the number of hosts is greater than the number of pools. But the default number of pools is 10 (https://github.com/psf/requests/blob/main/requests/adapters.py#L66), and in our case there are only two different hosts that we connect to: beaker.org and the Beaker file heap server. So we should be okay 🤷‍♂️

If we do run into issues in the future, we should handle this in beaker-py but using one session per thread. We could implement this using thread-local storage similar to this: https://github.com/customerio/customerio-python/pull/77/files

Before submitting

  • I've read and followed all steps in the Making a pull request
    section of the CONTRIBUTING docs.
  • I've updated or added any relevant docstrings following the syntax described in the
    Writing docstrings section of the CONTRIBUTING docs.
  • If this PR fixes a bug, I've added a test that will fail without my fix.
  • If this PR adds a new feature, I've added tests that sufficiently cover my new functionality.

After submitting

  • All GitHub Actions jobs for my pull request have passed.

@epwalsh epwalsh requested a review from dirkgr June 27, 2022 19:06
@dirkgr dirkgr merged commit a6b0be9 into main Jul 5, 2022
@dirkgr dirkgr deleted the beaker-workspace-perf branch July 5, 2022 21:11
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.

"Too many open files" while using BeakerExecutor
2 participants