if (conn->idle_time > 0) {
struct server *srv = __objt_server(conn->target);
HA_ATOMIC_SUB(&srv->curr_idle_conns, 1);
+ srv->curr_idle_thr[tid]--;
}
conn_force_unsubscribe(conn);
}
LIST_DEL(&conn->list);
LIST_ADDQ(&srv->idle_orphan_conns[tid], &conn->list);
+ srv->curr_idle_thr[tid]++;
conn->idle_time = now_ms;
if (!(task_in_wq(srv->idle_task[tid])) &&
unsigned int pool_purge_delay; /* Delay before starting to purge the idle conns pool */
unsigned int max_idle_conns; /* Max number of connection allowed in the orphan connections list */
unsigned int curr_idle_conns; /* Current number of orphan idling connections */
+ unsigned int *curr_idle_thr; /* Current number of orphan idling connections per thread */
int max_reuse; /* Max number of requests on a same connection */
struct task **idle_task; /* task responsible for cleaning idle orphan connections */
struct task *warmup; /* the task dedicated to the warmup when slowstart is set */
LIST_DEL(&srv_conn->list);
srv_conn->idle_time = 0;
HA_ATOMIC_SUB(&srv->curr_idle_conns, 1);
+ srv->curr_idle_thr[tid]--;
LIST_ADDQ(&srv->idle_conns[tid], &srv_conn->list);
if (LIST_ISEMPTY(&srv->idle_orphan_conns[tid]))
task_unlink_wq(srv->idle_task[tid]);
newsrv->idle_task[i]->process = srv_cleanup_idle_connections;
newsrv->idle_task[i]->context = newsrv;
}
+ newsrv->curr_idle_thr = calloc(global.nbthread, sizeof(int));
+ if (!newsrv->curr_idle_thr)
+ goto err;
continue;
err:
ha_alert("parsing [%s:%d] : failed to allocate idle connection tasks for server '%s'.\n",
free(s->priv_conns);
free(s->safe_conns);
free(s->idle_orphan_conns);
+ free(s->curr_idle_thr);
if (s->idle_task) {
int i;
{
struct server *srv = context;
struct connection *conn, *conn_back;
- unsigned int to_destroy = srv->curr_idle_conns / 2 + (srv->curr_idle_conns & 1);
+ unsigned int to_destroy = srv->curr_idle_thr[tid] / 2 + (srv->curr_idle_thr[tid] & 1);
unsigned int i = 0;