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

Perf: add another background thread to submit the task #4

Open
spacewander opened this issue Aug 4, 2022 · 0 comments
Open

Perf: add another background thread to submit the task #4

spacewander opened this issue Aug 4, 2022 · 0 comments

Comments

@spacewander
Copy link
Contributor

Currently, we submit the task to the grpc-engine in the request directly. When the runnable threads in the engine are exhausted, the request will be blocked until the task is submitted. Although this rarely happens since:

  1. the gRPC call is IO-bound
  2. the GOMAXPROCS are counted per worker so it is much higher than the actual number of processors
  3. Go's scheduler is fantastic

To eliminate this potential risk, we can add another background thread to act as the consumer part in the producer-consumer pattern. The request can communicate with the thread via ngx_thread_cond_signal / ngx_thread_cond_wait.

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

No branches or pull requests

1 participant