0

using haproxy HTTP logs with http-server-close of keep-alives the time counters in the logs (TR, Tt...) are based on the beginning of the TCP connection. Which means only the first request, with cookie status *NI (--NI) has timers corresponding to the time the HTTP request took.

The following ones will be from the beginning of the TCP connection (idles times + preceding request times).

Is there a way to bypass this haproxy behaviour without turning keepalive or http-server-close off, or am I forced to change this configuration, or to add a proxy in front of haproxy..?


In the end is there a way to get the total response time for an HTTP request, and not the time since the beginning of the TCP ?

NanoPish
  • 63
  • 6

2 Answers2

0
time curl -v http://www.google.com http://www.google.com 

this will use keep alives, and not open a new TCP connection for ever request (as long as your web server support keepalives).

Maybe this will give you a start.

Curl has quite good options for tracing connect times too.

https://stackoverflow.com/questions/18215389/how-do-i-measure-request-and-response-times-at-once-using-curl

So this might give you exactly what you want.

Good Luck!

The Unix Janitor
  • 2,388
  • 14
  • 13
  • the thing is I want to have the total response time for each request made to my haproxy, from my haproxy POV, not from one client. in order to obtain the total average response-time. the issue is the response time timer in haproxy count from the opening of the tcp, not the beginning of the http request, even in http-log mode. – NanoPish Jul 14 '20 at 19:11
  • I'm not sure i totally understand, you said 'for each request made to my haproxy, from my haproxy POV,' so you have two HA-PROXYS? maybe a digram could make clearer what exactly you are trying to measure, the end points, and what's inbetwen. – The Unix Janitor Jul 14 '20 at 19:36
  • No there is only one haproxy, my bad. What I wanted to mean is I want the response-time from the server (my haproxy) point of view, not from a curl client side. – NanoPish Jul 15 '20 at 08:25
0

After refining what you meant, i believe you want to find out exactly what ha-proxy is actually doing, rather than generating benchmarking test from a client using curl and ab (apache bench).

Ha proxy comes with on stats page, which can give you lots of parameters. This might just have what you need.

https://www.haproxy.com/blog/exploring-the-haproxy-stats-page/

You can retrieve the stats that haproxy is generating. You should be interested in

Response time   

The server response time in milliseconds, averaged over the last 1024 successful connections.

Good Luck!

The Unix Janitor
  • 2,388
  • 14
  • 13