[PATCH] CLEANUP/MINOR LIM2A function comment fix

2018-10-24 Thread John Cherouvim

Hello

I changed "the HTML representation" to "the ASCII representation" in the 
documentation for LIM2A to make it consistent with what it actually 
does. I think the fact that it returns ASCII is encoded in the function 
name (similarly as it's done in U2A vs U2H) so maybe this was a copy 
paste problem.


thanks


>From cfa30687f9179e7e35989d2ec51e6181e642b0a6 Mon Sep 17 00:00:00 2001
From: Ioannis Cherouvim <743305+cherou...@users.noreply.github.com>
Date: Wed, 24 Oct 2018 10:05:19 +0300
Subject: [PATCH] function comment fix

---
 include/common/standard.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/common/standard.h b/include/common/standard.h
index 3e13f30..3f8d2d0 100644
--- a/include/common/standard.h
+++ b/include/common/standard.h
@@ -195,7 +195,7 @@ static inline const char *U2H(unsigned long long n)
return ret;
 }
 
-/* returns a locally allocated string containing the HTML representation of
+/* returns a locally allocated string containing the ASCII representation of
  * the number 'n' in decimal. Up to NB_ITOA_STR calls may be used in the same
  * function call (eg: printf), shared with the other similar functions making
  * use of itoa_str[].
-- 
2.6.1.windows.1



[PATCH] CLEANUP/MINOR removal of unused function U2A

2018-10-23 Thread John Cherouvim

Hello

I'm removing an unused function.
stats.c is only using U2H and LIM2A. U2A was not being referenced from 
anywhere.


thanks




From 692996c782d14240c563c319010ad89939400157 Mon Sep 17 00:00:00 2001
From: Ioannis Cherouvim <743305+cherou...@users.noreply.github.com>
Date: Tue, 23 Oct 2018 10:55:56 +0300
Subject: [PATCH] CLEANUP/MINOR removal of unused function U2A

---
include/common/standard.h | 13 -
1 file changed, 13 deletions(-)

diff --git a/include/common/standard.h b/include/common/standard.h
index 3e13f30..c88e139 100644
--- a/include/common/standard.h
+++ b/include/common/standard.h
@@ -169,19 +169,6 @@ char *utoa_pad(unsigned int n, char *dst, size_t size);
 */
extern const char *limit_r(unsigned long n, char *buffer, int size, 
const char *alt);


-/* returns a locally allocated string containing the ASCII 
representation of
- * the number 'n' in decimal. Up to NB_ITOA_STR calls may be used in 
the same
- * function call (eg: printf), shared with the other similar functions 
making

- * use of itoa_str[].
- */
-static inline const char *U2A(unsigned long n)
-{
-const char *ret = ultoa_r(n, itoa_str[itoa_idx], sizeof(itoa_str[0]));
-if (++itoa_idx >= NB_ITOA_STR)
-itoa_idx = 0;
-return ret;
-}
-
/* returns a locally allocated string containing the HTML representation of
 * the number 'n' in decimal. Up to NB_ITOA_STR calls may be used in 
the same
 * function call (eg: printf), shared with the other similar functions 
making

--
2.6.1.windows.1





subscribe

2018-10-23 Thread John Cherouvim






Re: stats page: inconsistent numbers spacing (thousands)

2018-03-12 Thread John Cherouvim

Hello Willy

I understand the need for spacing. My message was only regarding the 
inconsistent usage of it (e.g "2" vs "2 000"). Anyway, it's not 
important, just something I found out and thought it was worth mentioning.


Thanks for answering this and, in general, for your great software.
John



Willy Tarreau wrote:

Hello John,

On Fri, Mar 02, 2018 at 01:04:11PM +0200, John Cherouvim wrote:
  

Hello

My stats page (haproxy version: 1.8.4-1ppa1~xenial) shows some values as
"2" and others as "2 000" (note the thousands spacing). The CSV in
question shows the numbers without spaces:


backend_varnish,varnish,0,0,0,0,2,0,0,0,,0,,0,0,0,0,no 
check,1,1,0,,,92203,,,1,3,1,,0,,2,0,,00,0,0,0,0,0,0,0,-1,,,0,0,0,0,,http
backend_varnish,BACKEND,0,0,0,0,2000,0,0,0,0,0,,0,0,0,0,UP,1,1,0,,0,92203,0,,1,3,0,,0,,1,0,,00,0,0,0,0,00,0,0,0,0,0,0,-1,,,0,0,0,0,,http
  

Also, in the errors section it shows "25 131" (has space) in Errors > Conns
but "213832" (no space) in Warnings > Retr.

Is this an HTML templating bug of the stats page? Or is there a reason for
this kind of presentation?



It should not be a bug, the spacing is intentional to make large numbers more
readable. It's really important when you are looking at a large page with tens
of servers showing very large numbers. To give you an idea, a server delivering
10 Gbps of traffic will emit half a petabyte per week, and these numbers are
too large to remain readable. I tried to use larger units but that makes them
not move anymore (eg: for servers remaining up for a very long time), so in the
end, visually splitting the numbers seems like the best solution. It's possible
that it's not applied to every single number, as some such as connection errors
or retries are hardly supposed to be large. The way the spacing is done ensures
that you can still select the number and copy-paste it anywhere without copying
the spaces (eg for calculations). Ideally we should have small spaces on every
possibly large number.

Hoping this helps,
Willy

  





stats page: inconsistent numbers spacing (thousands)

2018-03-02 Thread John Cherouvim

Hello

My stats page (haproxy version: 1.8.4-1ppa1~xenial) shows some values as 
"2" and others as "2 000" (note the thousands spacing). The CSV in 
question shows the numbers without spaces:

backend_varnish,varnish,0,0,0,0,2,0,0,0,,0,,0,0,0,0,no 
check,1,1,0,,,92203,,,1,3,1,,0,,2,0,,00,0,0,0,0,0,0,0,-1,,,0,0,0,0,,http
backend_varnish,BACKEND,0,0,0,0,2000,0,0,0,0,0,,0,0,0,0,UP,1,1,0,,0,92203,0,,1,3,0,,0,,1,0,,00,0,0,0,0,00,0,0,0,0,0,0,-1,,,0,0,0,0,,http


Also, in the errors section it shows "25 131" (has space) in Errors > 
Conns but "213832" (no space) in Warnings > Retr.


Is this an HTML templating bug of the stats page? Or is there a reason 
for this kind of presentation?



thanks




subscribe

2018-03-02 Thread John Cherouvim





trying to undestand (via netstat) how many connections haproxy opens to backends

2018-02-06 Thread John Cherouvim
I'm trying to understand the output of netstat when haproxy is handling 
requests waiting for the backend to finish processing. My setup is a VM 
with LAN IP 192.168.10.50 hosting one haproxy and one apache httpd instance:
- apache httpd is listening on 127.0.0.1:12345 (not accessible from 
outside) serving a page which needs 10 seconds to render.
- haproxy 1.8 which listens with "bind :::80 v4v6" with a backend 
"server apache_backend 127.0.0.1:12345"



The relevant part of netstat output when the 2 services are running is 
naturally the following:

tcp6 :::80:::*   LISTEN  14973/haproxy off
tcp  127.0.0.1:12345  0.0.0.0:*  LISTEN  15020/apache2 off

I then execute "curl http://192.168.10.50/ &" 3 times from a different 
host. I validate in the haproxy stats page that there are 3 concurrent 
processings taking place both on the haproxy frontend section and on the 
haproxy backend section (Cur: 3, Max 3).


The following groups of connections appear on netstat:

1)
tcp6 192.168.10.50:80 192.168.10.1:62942 ESTABLISHED 14973/haproxy off
tcp6 192.168.10.50:80 192.168.10.1:62941 ESTABLISHED 14973/haproxy off
tcp6 192.168.10.50:80 192.168.10.1:62940 ESTABLISHED 14973/haproxy off

2)
tcp  127.0.0.1:35154  127.0.0.1:12345ESTABLISHED 14973/haproxy off
tcp  127.0.0.1:35156  127.0.0.1:12345ESTABLISHED 14973/haproxy off
tcp  127.0.0.1:35158  127.0.0.1:12345ESTABLISHED 14973/haproxy off

3)
tcp 127.0.0.1:12345 127.0.0.1:35154 ESTABLISHED 15023/apache2 keepalive
tcp 127.0.0.1:12345 127.0.0.1:35156 ESTABLISHED 15090/apache2 keepalive
tcp 127.0.0.1:12345 127.0.0.1:35158 ESTABLISHED 15099/apache2 keepalive

I understand that connections in group #1 are the ones originating from 
outside the VM, initiated by the 3 parallel curl commands, which end up 
on the ipv6 endpoint of haproxy, managed by its front end component. I 
suppose that the haproxy backend component must then start 3 connections 
to send the requests to apache. Are these connections shown in group #2 
or #3? And if that is either group #2 or #3, what is the other group 
supposed to be doing?


Thanks



301 redirects are logged as 503

2018-02-05 Thread John Cherouvim
The 301 (or 302) redirects I've configured in /etc/haproxy/haproxy.cfg 
result in log entries which do not show 301 but 503:
127.0.0.1 - - [05/Feb/2018:12:15:09 +0200] "HEAD /latest-news 
HTTP/1.1" 503 1486 "" "curl/7.47.0" 103/-1 -


This makes logs analysis harder for me. Do you know whether this is a 
configuration issue or problem in the specific haproxy version I use?



My log related config in /etc/haproxy/haproxy.cfg is:

global
log 127.0.0.1 local0 notice
...
frontend frontend_for_all_sites
# log related
capture request header Referer len 256
capture request header User-Agent len 256
capture request header X-Forwarded-For len 32
log-format %{+Q}o\ %{-Q}ci\ -\ -\ [%Tl]\ %r\ %ST\ %B\ 
%[capture.req.hdr(0)]\ %[capture.req.hdr(1)]\ %U/%Tr\ 
%{-Q}[capture.req.hdr(2)]

log 127.0.0.1 local2
   
# redirect
http-request redirect code 301 location /news if { path_reg 
^/latest-news$ }



My /etc/rsyslog.d/49-haproxy.conf which writes the haproxy related logs 
to files:

$template RawMessage,"%msg:2:$%\n"
$RepeatedMsgReduction off

$FileOwner syslog
$FileGroup adm

$ModLoad imudp
$UDPServerAddress 127.0.0.1
$UDPServerRun 514
local0.* /var/log/haproxy/haproxy.log
local1.* /var/log/haproxy/haproxy-stats.log;RawMessage
local2.* /var/log/haproxy/site.log;RawMessage



Software versions used:

$ haproxy -v
HA-Proxy version 1.6.13-1ppa1~xenial 2017/06/19
Copyright 2000-2017 Willy Tarreau 

$ cat /etc/issue
Ubuntu 16.04.2 LTS \n \l







Re: explanation of "Backend Limit" I see in the stats page

2017-06-27 Thread John Cherouvim

Thanks a lot for the explanation.


Here the numbers are almost the same as your "s" server because it is the only 
server configured in the backend. If there was many, the backend numbers will be around 
the sum of the server numbers (for each column).
  
Although this is a small detail, is there an explanation for the fact 
that they are not always exactly equal? Is it the case that they'll 
eventually be exactly equal but maybe due to implementation reasons on 
how these counters are held in memory there is a slight difference?


thanks




Moemen MHEDHBI wrote:

Hi John,


On 26/06/2017 13:45, John Cherouvim wrote:
  

Hello

I have this configuration for a backend containing a server:


backend static_backend
option forwardfor
server s localhost:80 maxconn 900
  

On the stats page though I see a "Backend" row which shows almost the
same numbers for my "s" server. What does this represent?



The Backend row shows the stats for the whole backend. Here the numbers
are almost the same as your "s" server because it is the only server
configured in the backend. If there was many, the backend numbers will
be around the sum of the server numbers (for each column).


  

That "Backend" row shows a limit of 200 (marked with red in the photo
http://i.imgur.com/YWNsStZ.png ). What exactly is that limit and how
can I change it?

thanks





The Session Limit in the backend row refers to the fullconn parameter of
that backend.
The fullconn is about setting dynamic maxconn on backend servers. You
can read more about it in the docs
http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#4-fullconn

You need to consider the "fullconn" parameter if you have set up
"minconn" in server lines (to use dynamic maxconn), otherwise you can
ignore it.

Regards,
  





explanation of "Backend Limit" I see in the stats page

2017-06-26 Thread John Cherouvim

Hello

I have this configuration for a backend containing a server:

backend static_backend
option forwardfor
server s localhost:80 maxconn 900


On the stats page though I see a "Backend" row which shows almost the 
same numbers for my "s" server. What does this represent?
That "Backend" row shows a limit of 200 (marked with red in the photo 
http://i.imgur.com/YWNsStZ.png ). What exactly is that limit and how can 
I change it?


thanks