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 gunicorn threads #316

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jsangmeister
Copy link
Contributor

With this change, it should be possible to continue to receive action worker updates even when the datastore is currently busy.

  • The writer still runs in a single worker (=process), so the singleton lock principle is kept and locked fields continue to work as intended.
  • This worker now has multiple threads, so even if one is occupied with a long query, the other threads can continue to write action worker updates without the lock or reserve ids.

A possible problem is that multiple "normal" write requests come in after some long-running request, blocking the remaining x threads (4 by default). Possible solutions include increasing the number of threads (but how high?), spawning a seperate container analogous to the backend-manage container which only handles writes without events (will be more work than this, not sure if it's worth it) or maybe adding a timeout to the lock acquirement of the normal write route - if the lock is not available after 1 second or something, simply terminate the request (might need some refinement, as the backend automatically re-tries failed requests, so they will appear again quickly in the datastore; also, it makes the user experience worse, as currently, all requests simply wait until the long-running one is done, while after this solution they will come back as an error to the user, who will have to try again manually).

I think for now this simple solution should suffice, maybe with an increased number of threads, depending on how many threads will be typically used in production.

@jsangmeister jsangmeister added the enhancement General enhancement which is neither bug nor feature label Feb 22, 2024
@jsangmeister jsangmeister added this to the 4.2 milestone Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement General enhancement which is neither bug nor feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants