Hi Willy,

On 11-06 07:56 am (Wed), Willy Tarreau wrote:
> Hi Jean,
> 
> On Tue, Nov 05, 2019 at 04:33:00PM +0100, Jean Wasilewski wrote:
> > Hi,
> > 
> > While using the stats socket with the official HAProxy exporter, I
> > noticed that some metrics seem erronous. While querying for a specific
> > frontend, the admin socket reported two differents metrics for the same
> > frontend.
> > 
> > I made this small onliner two retrieve values (with here an example on
> > 2XX calls on our frontend `console-online`):
> > 
> > ```
> > $ while true; do echo "show stat" | socat - /run/haproxy/admin.sock |grep \
> > -E '\#|FRONT' |grep -E '\#|console' |cut -d, -f41 |xargs -L2 echo; sleep \
> > 1; done
> > hrsp_2xx 2141807
> > hrsp_2xx 136536
> > hrsp_2xx 2141819
> > hrsp_2xx 2141828
> > hrsp_2xx 136536
> > hrsp_2xx 2141841
> > hrsp_2xx 2141846
> > hrsp_2xx 136537
> > hrsp_2xx 2141854
> > hrsp_2xx 2141856
> > hrsp_2xx 2141863
> > hrsp_2xx 136537
> > ```
> > 
> > Is this a bug or a misconfiguration?
> 
> It sounds like you're working in multi-process mode (nbproc > 1). If
Indeed, nproc was set to 2.
> so, this is the expected behavior since stats are per process. This
> was one of the drivers for the porting to threads. If for any reason
> you really want to stick to nbproc, then I'd recommend you to use one
> stats socket per process (use the "process" directive on each line)
> and to query both of them individually. But frankly this is painful as
> it may return conflicting server states during some transitions because
> the checks are per-process as well.
> 
> You can replace "nbproc 2" with "nbthread 2" in your config, watch for
> warnings in case you'd already have a few explicit "process" entries,
> or even remove nbproc and nbthread to let haproxy start one thread per
> available core.
Removing nbproc and nbthread did resolve the issue.
> 
> Hoping this helps,
> Willy

Thank you very much!

Jean

Attachment: signature.asc
Description: PGP signature

Reply via email to