Re: [PATCH] [MINOR] Add a name to stats page
On Thu, Oct 22, 2009 at 10:49:59PM +0200, Krzysztof Piotr Oledzki wrote: From ad5198f6e8c143b0f070d98d64b507d343d697fa Mon Sep 17 00:00:00 2001 From: Krzysztof Piotr Oledzki o...@ans.pl Date: Thu, 22 Oct 2009 22:48:09 +0200 Subject: [MINOR] Add a name to stats page If you have a lot of proxies/servers in your stats page it is not easy to locate the one you are interested in. You can of couse use search function from you favorite web browser but browsers often lost their focus when reloading stats. This patch adds a name html tags for proxies, frontends, servers and backends. You can use it to access a specific place, for example: Simple and efficient, I like the idea. I'm merging the patch. We can even improve it by adding a link on each front/back name that references itself, so that users don't have to manually add the #proxy/Frontend on the URL. Thanks, Willy
[PATCH 1/2] [MINOR] add additional a hrefs to stats page
From e0d3f887ccd891548364c629e7a2db278e35082a Mon Sep 17 00:00:00 2001 From: Krzysztof Piotr Oledzki o...@ans.pl Date: Sat, 24 Oct 2009 14:24:30 +0200 Subject: [MINOR] add additional a hrefs to stats page This patch adds a href html links for proxies, frontends, servers and backends. Once located, can be clicked. Users no longer have to manually add #anchor to stat's url. --- src/dumpstats.c | 29 + 1 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/dumpstats.c b/src/dumpstats.c index 70b96b5..1f0ae90 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -989,6 +989,13 @@ int stats_dump_http(struct session *s, struct buffer *rep, struct uri_auth *uri) .backup6 {background: #e0e0e0;}\n .rls {letter-spacing: 0.2em; margin-right: 1px;}\n /* right letter spacing (used for grouping digits) */ \n +a.px:link {color: #40; text-decoration: none;} +a.px:visited {color: #40; text-decoration: none;} +a.px:hover {color: #ff; text-decoration: none;} +a.lfsb:link {color: #00; text-decoration: none;} +a.lfsb:visited {color: #00; text-decoration: none;} +a.lfsb:hover {color: #505050; text-decoration: none;} +\n table.tbl { border-collapse: collapse; border-style: none;}\n table.tbl td { text-align: right; border-width: 1px 1px 1px 1px; border-style: solid solid solid solid; padding: 2px 3px; border-color: gray; white-space: nowrap;}\n table.tbl td.ac { text-align: center;}\n @@ -1224,7 +1231,9 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri) chunk_printf(msg, table class=\tbl\ width=\100%%\\n tr class=\titre\ -th class=\pxname\ width=\10%%\a name=\%s\%s/a/th +th class=\pxname\ width=\10%%\ +a name=\%s\/a +a class=px href=\#%s\%s/a/th th class=\%s\ width=\90%%\%s/th /tr\n /table\n @@ -1247,7 +1256,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri) thBck/ththChk/ththDwn/ththDwntme/th thThrtle/th\n /tr, -px-id, px-id, +px-id, px-id, px-id, px-desc ? desc : empty, px-desc ? px-desc : ); if (buffer_feed_chunk(rep, msg) = 0) @@ -1265,7 +1274,8 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri) chunk_printf(msg, /* name, queue */ tr class=\frontend\td class=ac -a name=\%s/Frontend\Frontend/a/tdtd colspan=3/td +a name=\%s/Frontend\/a +a class=lfsb href=\#%s/Frontend\Frontend/a/tdtd colspan=3/td /* sessions rate : current, max, limit */ td%s/tdtd%s/tdtd%s/td /* sessions : current, max, limit, total, lbtot */ @@ -1274,7 +1284,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri) /* bytes : in, out */ td%s/tdtd%s/td , -px-id, +px-id, px-id, U2H0(read_freq_ctr(px-fe_sess_per_sec)), U2H1(px-counters.fe_sps_max), LIM2A2(px-fe_sps_lim, -), U2H3(px-feconn), U2H4(px-counters.feconn_max), U2H5(px-maxconn), @@ -1491,7 +1501,9 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri) ino check/i }; chunk_printf(msg, /* name */ -tr class=\%s%d\td class=aca name=\%s/%s\%s/a/td +tr class=\%s%d\td class=ac +a name=\%s/%s\/a +a class=lfsb href=\#%s/%s\%s/a/td
[PATCH 2/2] [MINOR] Collect provide http response codes for frontends, fix backends
From d529a265e60ea3366452329e2f462a0bd02d8e58 Mon Sep 17 00:00:00 2001 From: Krzysztof Piotr Oledzki o...@ans.pl Date: Sat, 24 Oct 2009 15:36:15 +0200 Subject: [MINOR] Collect provide http response codes for frontends, fix backends This patch extends and corrects the functionality introduced by Collect provide http response codes received from servers: - responses are now also accounted for frontends - backend's and frontend's counters are incremented based on responses sent to client, not received from servers --- src/dumpstats.c | 47 ++- src/proto_http.c |1 - src/session.c| 15 +++ 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/src/dumpstats.c b/src/dumpstats.c index 1f0ae90..866f499 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -1278,16 +1278,33 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri) a class=lfsb href=\#%s/Frontend\Frontend/a/tdtd colspan=3/td /* sessions rate : current, max, limit */ td%s/tdtd%s/tdtd%s/td -/* sessions : current, max, limit, total, lbtot */ +/* sessions: current, max, limit */ td%s/tdtd%s/tdtd%s/td -td%s/tdtd/td -/* bytes : in, out */ -td%s/tdtd%s/td +td , px-id, px-id, U2H0(read_freq_ctr(px-fe_sess_per_sec)), U2H1(px-counters.fe_sps_max), LIM2A2(px-fe_sps_lim, -), -U2H3(px-feconn), U2H4(px-counters.feconn_max), U2H5(px-maxconn), +U2H3(px-feconn), U2H4(px-counters.feconn_max), U2H5(px-maxconn)); + + /* http response (via td title): 1xx, 2xx, 3xx, 4xx, 5xx, other */ + if (px-mode == PR_MODE_HTTP) { + int i; + + chunk_printf(msg, title=\rsp codes:); + + for (i = 1; i 6; i++) + chunk_printf(msg, %dxx=%lld,, i, px-counters.p.http.rsp[i]); + + chunk_printf(msg, other=%lld\, px-counters.p.http.rsp[0]); + } + + chunk_printf(msg, +/* sessions: total, lbtot */ +%s/tdtd/td +/* bytes : in, out */ +td%s/tdtd%s/td +, U2H6(px-counters.cum_feconn), U2H7(px-counters.bytes_in), U2H8(px-counters.bytes_out)); chunk_printf(msg, @@ -1329,10 +1346,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri) /* rate, rate_lim, rate_max */ %u,%u,%u, /* check_status, check_code, check_duration */ -,,, -/* http response: 1xx, 2xx, 3xx, 4xx, 5xx, other */ -,, -\n, + px-id, px-feconn, px-counters.feconn_max, px-maxconn, px-counters.cum_feconn, px-counters.bytes_in, px-counters.bytes_out, @@ -1343,6 +1357,21 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri) relative_pid, px-uuid, STATS_TYPE_FE, read_freq_ctr(px-fe_sess_per_sec), px-fe_sps_lim, px-counters.fe_sps_max); + + /* http response: 1xx, 2xx, 3xx, 4xx, 5xx, other */ + if (px-mode == PR_MODE_HTTP) { + int i; + + for (i=1; i6; i++) + chunk_printf(msg, %lld,, px-counters.p.http.rsp[i]); + + chunk_printf(msg, %lld,, px-counters.p.http.rsp[0]); + } else { + chunk_printf(msg, ,,); + } + + /* finish with EOL */ +
MySQL + Haproxy Question
Hey Guys, I was wondering if there was a way to have Haproxy handle mysql requests. I know that I can use the TCP option instead of HTTP and it will work, but I was wondering if anyone has a way to make haproxy send all requests for Select statements to a set of servers and all Insert, Updates, and Deletes to a master MySQL server. I was just thinking about it and was wondering if this was possible and if anyone has done it. If you have would you be willing to share how your setup is. Thanks Joe -- This message has been scanned for viruses by Colocube's AV Scanner
Re: MySQL + Haproxy Question
Hi On Sat, 24 Oct 2009 16:01:26 -0400, Joseph Hardeman jharde...@colocube.com wrote: Hey Guys, I was wondering if there was a way to have Haproxy handle mysql requests. I know that I can use the TCP option instead of HTTP and it will work, but I was wondering if anyone has a way to make haproxy send all requests for Select statements to a set of servers and all Insert, Updates, and Deletes to a master MySQL server. I was just thinking about it and was wondering if this was possible and if anyone has done it. If you have would you be willing to share how your setup is. U can't do that, u either have to use something like http://forge.mysql.com/wiki/MySQL_Proxy_RW_Splitting or (better) rewrite ur app to split write and read requests Regards Mariusz -- Mariusz Gronczewski (XANi) xani...@gmail.com GnuPG: 0xEA8ACE64 http://devrandom.pl signature.asc Description: PGP signature
Re: MySQL + Haproxy Question
Hi Mariusz Thats actually what I thought, but I wanted to ask to be sure. *S* I am going to look into that solution again, the last time I tried it, many months ago now, I couldn't get it to work right and I would have to replace all of the libmysql* so files on my web servers. Thanks for the reply. Joe XANi wrote: Hi On Sat, 24 Oct 2009 16:01:26 -0400, Joseph Hardeman jharde...@colocube.com wrote: Hey Guys, I was wondering if there was a way to have Haproxy handle mysql requests. I know that I can use the TCP option instead of HTTP and it will work, but I was wondering if anyone has a way to make haproxy send all requests for Select statements to a set of servers and all Insert, Updates, and Deletes to a master MySQL server. I was just thinking about it and was wondering if this was possible and if anyone has done it. If you have would you be willing to share how your setup is. U can't do that, u either have to use something like http://forge.mysql.com/wiki/MySQL_Proxy_RW_Splitting or (better) rewrite ur app to split write and read requests Regards Mariusz -- This message has been scanned for viruses by Colocube's AV Scanner
Re: MySQL + Haproxy Question
On Sat, 24 Oct 2009, Joseph Hardeman wrote: Hey Guys, Hi, I was wondering if there was a way to have Haproxy handle mysql requests. I know that I can use the TCP option instead of HTTP and it will work, but I was wondering if anyone has a way to make haproxy send all requests for Select statements to a set of servers and all Insert, Updates, and Deletes to a master MySQL server. I was just thinking about it and was wondering if this was possible and if anyone has done it. If you have would you be willing to share how your setup is. Currently, there is no MySQL support in HAProxy. However, you should try MySQL_Proxy: http://forge.mysql.com/wiki/MySQL_Proxy Best regards, Krzysztof Olędzki