Skip to content

Conversation

risicle
Copy link
Member

@risicle risicle commented Feb 15, 2025

Because eventlet's GreenPool discards GreenThreads after they have performed a task, to reduce wasteful continual re-creation of thread-local resources this class will maintain a pool of thread contexts suitable for reuse with new GreenThreads. In theory at least this means we will never have more thread contexts than the maximum number of concurrent GreenThreads handling connections we've ever had.

See https://greenlet.readthedocs.io/en/latest/api.html#greenlet.greenlet.gr_context for documentation on gr_context.

@risicle risicle force-pushed the ris-gunicorn-context-recycling-eventlet-worker branch 6 times, most recently from e912c17 to afcb8a3 Compare February 17, 2025 17:37
@risicle risicle marked this pull request as ready for review February 17, 2025 17:42
@risicle risicle marked this pull request as draft February 17, 2025 17:44
@risicle risicle marked this pull request as ready for review February 17, 2025 17:45
@risicle risicle requested a review from leohemsted February 17, 2025 17:45
risicle added 3 commits March 1, 2025 18:03
as long as __init__.py doesn't perform any imports, this still
allows us to import the defaults module without any unintended
imports while also providing a place to put gunicorn-related
stuff that has broader import needs
@risicle risicle force-pushed the ris-gunicorn-context-recycling-eventlet-worker branch from afcb8a3 to 2176c52 Compare March 1, 2025 18:07
@risicle risicle merged commit d7a1a53 into main Mar 4, 2025
2 checks passed
@risicle risicle deleted the ris-gunicorn-context-recycling-eventlet-worker branch March 4, 2025 16:00
@risicle
Copy link
Member Author

risicle commented Mar 4, 2025

(of course, this doesn't actually set anything to use it yet, that will require further discussion..)

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.

2 participants