Mod-Cluster_node_balancer

Version 24

    The page describes the node and balancer part of the CONFIG message.

     

    NODE:

    KeyDescriptionDefaultMax size
    JvmRouteSee CONFIG in Mod-Cluster Management Protocol
    DomainSee CONFIG in Mod-Cluster Management Protocol
    HostSee CONFIG in Mod-Cluster Management Protocol
    PortSee CONFIG in Mod-Cluster Management Protocol
    TypeSee CONFIG in Mod-Cluster Management Protocol
    flushpacketsTell how to flush the packets. On: Send immediately, Auto wait for flushwait time before sending, Off don't flush.Off
    flushwaitTime in milliseconds to wait before flushing.10
    pingTime in seconds to wait for a pong answer to a ping. 0 means we don't try to ping before sending.10
    smaxsoft max inactive connection over that limit after ttl are closed.MPM configuration
    ttlmax time in seconds to life for connection above smax.60
    TimeoutMax time in seconds httpd will wait for the backend connection.0

     

    When a field is not present in the CONFIG message the default value is used in mod_cluster.

     

     

    BALANCER:

    KeyDescriptionDefaultMax size
    BalancerSee CONFIG in Mod-Cluster Management Protocol
    StickySession

    Yes: use JVMRoute to stick a request to a node

    No: ignore JVMRoute

    Yes3
    StickySessionCookieName of the cookie containing the "sessionid"JSESSIONID30
    StickySessionPathName of the parameter containing the "sessionid"jsessionid30
    StickySessionRemove

    Yes: remove the sessionid (cookie or parameter) when the request can't be routed to the right node

    No: send it anyway

    No3
    StickySessionForce

    Yes: Return an error if the request can't be routed according to JVMRoute

    No: Route it to another node

    Yes3
    WaitWorker

    time in seconds to wait for an available worker.

    "0": no wait.

    0
    Maxattemptsnumber of attempts to send the request to the backend server.1

     

    When a field is not present in the CONFIG message the default value is used in mod_cluster.

     

     

    Notes on node in httpd internals:

    The Notes describe how the httpd internal tables are filled with the above node description.

    reslist parameters:

    ParameterDescriptionDefault
    hmaxsize of the connection pool (hard max). Use ap_mpm_query(AP_MPMQ_MAX_THREADS)
    smaxsoft max inactive connection over that limit after ttl are closedhmax
    minmin number of connections to have available. Use 0
    acquiretime in milliseconds to wait for an available connection. Use 0 no wait return error
    ttlmax time in seconds to life for connection above smax60

    Those are parameters to the apr_reslist_create() that handles the pool of connections.

     

     

    keepalive behavior:

    keepalive: We force keepalive on.

     

    Others

    Other field of the proxy_worker structure will be filled with the default values from mod_proxy.

     

    proxy_worker_stat parameters:

    ParameterUpdated by mod_proxy_clusterUpdated by mod_manager
    status
    error_time
    retries
    lbstatus
    lbfactor
    transferred
    read
    elected
    route
    redirect
    busy
    lbset

     

    status is filled by STATUS commands.

     

    route is JVMRoute it is filled by CONFIG commands.

     

    This information is in shared memory and the proxy_worker_stat uses a part of this shared memory:

    proxy_worker_stat structure:

        int             status;
        apr_time_t      error_time; /* time of the last error */
        int             retries;    /* number of retries on this worker */
        int             lbstatus;   /* Current lbstatus */
        int             lbfactor;   /* dynamic lbfactor */
        apr_off_t       transferred;/* Number of bytes transferred to remote */
        apr_off_t       read;       /* Number of bytes read from remote */
        apr_size_t      elected;    /* Number of times the worker was elected */
        char            route[PROXY_WORKER_MAX_ROUTE_SIZ+1];
        char            redirect[PROXY_WORKER_MAX_ROUTE_SIZ+1];
        void            *context;   /* general purpose storage */
        apr_size_t      busy;       /* busyness factor */
        int             lbset;      /* load balancer cluster set */

     

    Notes on balancer in httpd internals:

    The Notes describe how the httpd internal tables are filled with the above balancer description.

     

    The information from the CONFIG message is packed in the shared memory:

     

    StickySessionCookie and StickySessionPath are stored in sticky and separed by a '|'

     

    StickySession, StickySessionRemove and StickySessionForce are stored in sticky_force

     

    The StickySessionForce forces only to the domain (to node belonging to the same domain) when the node corresponding to the sessionid

    belongs to a domain.

     

    max_attempts_set: is set if Maxattemps is in the CONFIG message and its value different from 1.

     

     

    sticky

    sticky_force

    timeout

    max_attempts

    max_attempts_set

     

    That is what is needed to create the balancer to be able to use it.

    proxy_balancer structure extract:

        const char *sticky;          /* sticky session identifier */
        int         sticky_force;    /* Disable failover for sticky sessions */
        apr_interval_time_t timeout; /* Timeout for waiting on free connection */
        int                 max_attempts; /* Number of attempts before failing */
        char                max_attempts_set;