Hi.

Am 14-09-2015 12:17, schrieb Willy Tarreau:
Hi Philipp,


[snipped]

What I'd like to have instead would be a per-proxy shared memory segment
for stats in addition to the per-process one, that is updated using
atomic operations each time other stats are updated. The max are a bit
tricky as you need to use a compare-and-swap operation but that's no big
deal. Please note that before doing this, it would be wise to move all
existing stats to a few dedicated structures so that in each proxy, server,
listener and so on we could simply have something like this :

    struct proxy_stats *local;
    struct proxy_stats *global;

As you guessed it local would be allocated in per process while global
would be shared between all of them.

Another benefit would be that we could improve the current sample fetch
functions which already look at some stats and use the global ones. That's even more important for maxconn where it would *open* the possibility to monitor the global connection count and not just the per-process one (but
there are other things to do prior to this being possible, such as
inter-process calls). However without inter-process calls we could decide
that we can slightly overbook the queue by up to one connection max per
process and that could be reasonably acceptable while waiting for a longterm
multi-threaded approach though.

I follow for some time uwsgi

https://uwsgi-docs.readthedocs.org/

Now I have implemented uwsgi now for some cgi's, yes there are such thinga still out ;-)

I like the stats solution, which is similar as you suggest, as far as I have understood you solution properly.

https://uwsgi-docs.readthedocs.org/en/latest/StatsServer.html

As far as I have understood there solution they use a registry pattern similar as already exist in haproxy.

https://github.com/unbit/uwsgi/search?utf8=%E2%9C%93&q=uwsgi_register_stats_pusher
http://git.haproxy.org/?p=haproxy.git;a=blob;f=src/proto_http.c;h=eb3582bd77be9fb96a0babb0e5390c276c77e50e;hb=HEAD#l13043

How about to 'just' add a stats_register to the modules.

For example in proto_http
http://git.haproxy.org/?p=haproxy.git;a=blob;f=src/proto_http.c;h=eb3582bd77be9fb96a0babb0e5390c276c77e50e;hb=HEAD#l13066

########
13066 static void __http_protocol_init(void)
13067 {
13068         acl_register_keywords(&acl_kws);
13069         sample_register_fetches(&sample_fetch_keywords);
13070         sample_register_convs(&sample_conv_kws);

              stats_register_global_and_or_local($global|$proxy,...);

13071         http_req_keywords_register(&http_req_actions);
13072         http_res_keywords_register(&http_res_actions);
13073 }
########

From my point of view the benefit is that the stats server is in haproxy and the data could be stored in efficient way.

Maybe there is a standalone instance with 'mode stats' like the other modes.

http://cbonte.github.io/haproxy-dconv/configuration-1.6.html#4-mode

Best regads
Aleks

Reply via email to