MINOR: session: Add the idle duration field into the session

The idle duration between two streams is added to the session structure. It
is not necessarily pertinent on all protocols. In fact, it is only defined
for H1 connections. It is the duration between two H1 transactions. But the
.get_cs_info() callback function on the multiplexers only exists because
this duration is missing at the session level. So it is a simplification
opportunity for a really low cost.

To reduce the cost, a hole in the session structure is filled by moving
.srv_list field at the end of the structure.
This commit is contained in:
Christopher Faulet 2020-09-30 10:28:02 +02:00
parent 268c92e2f8
commit d517396f8e
2 changed files with 3 additions and 1 deletions

View File

@ -54,9 +54,10 @@ struct session {
struct vars vars; /* list of variables for the session scope. */
struct task *task; /* handshake timeout processing */
long t_handshake; /* handshake duration, -1 = not completed */
long t_idle; /* idle duration, -1 if never occurs */
int idle_conns; /* Number of connections we're currently responsible for that we are not using */
struct list srv_list; /* List of servers and the connections the session is currently responsible for */
unsigned int flags; /* session flags, SESS_FL_* */
struct list srv_list; /* List of servers and the connections the session is currently responsible for */
};
struct sess_srv_list {

View File

@ -50,6 +50,7 @@ struct session *session_new(struct proxy *fe, struct listener *li, enum obj_type
vars_init(&sess->vars, SCOPE_SESS);
sess->task = NULL;
sess->t_handshake = -1; /* handshake not done yet */
sess->t_idle = -1;
_HA_ATOMIC_ADD(&totalconn, 1);
_HA_ATOMIC_ADD(&jobs, 1);
LIST_INIT(&sess->srv_list);