MEDIUM: threads/proxy: Add a lock per proxy and atomically update proxy vars

Now, each proxy contains a lock that must be used when necessary to protect
it. Moreover, all proxy's counters are now updated using atomic operations.
This commit is contained in:
Christopher Faulet
2017-06-02 15:33:24 +02:00
committed by Willy Tarreau
parent 8d8aa0d681
commit ff8abcd31d
14 changed files with 133 additions and 130 deletions

View File

@@ -123,7 +123,7 @@ static struct stream *pendconn_get_next_strm(struct server *srv, struct proxy *p
strm->target = &srv->obj_type;
stream_add_srv_conn(strm, srv);
srv->served++;
srv->proxy->served++;
HA_ATOMIC_ADD(&srv->proxy->served, 1);
if (px->lbprm.server_take_conn)
px->lbprm.server_take_conn(srv);
@@ -182,8 +182,7 @@ struct pendconn *pendconn_add(struct stream *strm)
LIST_ADDQ(&strm->be->pendconns, &p->list);
strm->be->nbpend++;
strm->logs.prx_queue_size += strm->be->nbpend;
if (strm->be->nbpend > strm->be->be_counters.nbpend_max)
strm->be->be_counters.nbpend_max = strm->be->nbpend;
HA_ATOMIC_UPDATE_MAX(&strm->be->be_counters.nbpend_max, strm->be->nbpend);
}
strm->be->totpend++;
return p;