]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: spoe: Remove check on min_applets number when a SPOE context is queued
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 24 Jan 2018 14:49:45 +0000 (15:49 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 2 Feb 2018 15:00:32 +0000 (16:00 +0100)
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.

include/types/spoe.h
src/flt_spoe.c

index 2632601a7589c38f38a869a9290407160bdd7f1a..3e819448c547050b386872fd126e35bb4b0d6bc7 100644 (file)
@@ -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
index 15317d1b87b7e1dd6b4344358b7f273c7c6b47c2..0c221f3f1ddd7f371a4349bdf9e19ce8372a97e8 100644 (file)
@@ -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)