From: Christopher Faulet Date: Wed, 24 Jan 2018 14:49:45 +0000 (+0100) Subject: MINOR: spoe: Remove check on min_applets number when a SPOE context is queued X-Git-Tag: v1.9-dev1~462 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=420977903b28e3395cbe9dfabfaf8a8b72aeb4e7;p=thirdparty%2Fhaproxy.git MINOR: spoe: Remove check on min_applets number when a SPOE context is queued The calculation of a minimal number of active applets was really empirical and finally useless. On heavy load, there are always many active applets (most of time, more than the minimal required) and when the load is low, there is no reason to keep unused applets opened. Because of this change, the flag SPOE_APPCTX_FL_PERSIST is now unused. So it has been removed. --- diff --git a/include/types/spoe.h b/include/types/spoe.h index 2632601a75..3e819448c5 100644 --- a/include/types/spoe.h +++ b/include/types/spoe.h @@ -58,7 +58,6 @@ #define SPOE_APPCTX_FL_PIPELINING 0x00000001 /* Set if pipelining is supported */ #define SPOE_APPCTX_FL_ASYNC 0x00000002 /* Set if asynchronus frames is supported */ #define SPOE_APPCTX_FL_FRAGMENTATION 0x00000004 /* Set if fragmentation is supported */ -#define SPOE_APPCTX_FL_PERSIST 0x00000008 /* Set if the applet is persistent */ #define SPOE_APPCTX_ERR_NONE 0x00000000 /* no error yet, leave it to zero */ #define SPOE_APPCTX_ERR_TOUT 0x00000001 /* SPOE applet timeout */ @@ -249,7 +248,6 @@ struct spoe_agent { unsigned int cps_max; /* Maximum # of connections per second */ unsigned int eps_max; /* Maximum # of errors per second */ unsigned int max_frame_size; /* Maximum frame size for this agent, before any negotiation */ - unsigned int min_applets; /* Minimum # applets alive at a time */ unsigned int max_fpa; /* Maximum # of frames handled per applet at once */ struct list events[SPOE_EV_EVENTS]; /* List of SPOE messages that will be sent diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 15317d1b87..0c221f3f1d 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -268,25 +268,6 @@ generate_pseudo_uuid() return uuid; } -/* Returns the minimum number of appets alive at a time. This function is used - * to know if more applets should be created for an engine. */ -static inline unsigned int -min_applets_act(struct spoe_agent *agent) -{ - unsigned int nbsrv; - - /* TODO: Add a config parameter to customize this value. Always 0 for - * now */ - if (agent->min_applets) - return agent->min_applets; - - /* Get the number of active servers for the backend */ - nbsrv = (agent->b.be->srv_act - ? agent->b.be->srv_act - : agent->b.be->srv_bck); - return 2*nbsrv; -} - /******************************************************************** * Functions that encode/decode SPOE frames ********************************************************************/ @@ -1703,7 +1684,7 @@ spoe_handle_processing_appctx(struct appctx *appctx) appctx->st0 = SPOE_APPCTX_ST_IDLE; agent->rt[tid].applets_idle++; } - if (fpa || (SPOE_APPCTX(appctx)->flags & SPOE_APPCTX_FL_PERSIST)) { + if (fpa) { HA_SPIN_LOCK(SPOE_APPLET_LOCK, &agent->rt[tid].lock); LIST_DEL(&SPOE_APPCTX(appctx)->list); LIST_ADD(&agent->rt[tid].applets, &SPOE_APPCTX(appctx)->list); @@ -2008,13 +1989,9 @@ spoe_queue_context(struct spoe_context *ctx) struct spoe_agent *agent = conf->agent; struct appctx *appctx; struct spoe_appctx *spoe_appctx; - unsigned int min_applets; - - min_applets = min_applets_act(agent); /* Check if we need to create a new SPOE applet or not. */ - if (agent->rt[tid].applets_act >= min_applets && - agent->rt[tid].applets_idle && + if (agent->rt[tid].applets_idle && agent->rt[tid].sending_rate) goto end; @@ -2057,8 +2034,6 @@ spoe_queue_context(struct spoe_context *ctx) goto end; } - if (agent->rt[tid].applets_act <= min_applets) - SPOE_APPCTX(appctx)->flags |= SPOE_APPCTX_FL_PERSIST; /* Increase the per-process number of cumulated connections */ if (agent->cps_max > 0) @@ -3196,7 +3171,6 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) curagent->cps_max = 0; curagent->eps_max = 0; curagent->max_frame_size = MAX_FRAME_SIZE; - curagent->min_applets = 0; curagent->max_fpa = 100; for (i = 0; i < SPOE_EV_EVENTS; ++i)