Skip to content

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

@spacewander

Description

@spacewander

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions