nginx – What does ngx_stat_writing and ngx_stat_reading represent with respect to frontend and backendconnection

  1. Do these represent frontend connections, backend connections or both (when using nginx as load balancer)?

  2. Looking at the code, as soon as we decrement reading, we increment writing

     #if (NGX_STAT_STUB)
     (void) ngx_atomic_fetch_add(ngx_stat_reading, -1);
     r->stat_reading = 0;
     (void) ngx_atomic_fetch_add(ngx_stat_writing, 1);
     r->stat_writing = 1;
     #endif
    

Does it mean that connection in writing state isn’t necessarily writing to client – but we might actually be waiting for the backend connection to write to backend and read from backend?
Bit confused as to how to get the full picture about the reading/writing state for both FE and BE connections when using nginx as reverse proxy.

Read more here: Source link