Haproxy timers – total session duration

haproxyload balancing

I was looking at the Haproxy timers in the haproxy logs to deduce the response time.And for some reason, i don't seem to understand why the haproxy timers don't add up to give me the total session duration time.

For ex:

2017-03-13T18:09:21.000Z 172.16.1.1 Mar 13 18:09:20 localhost haproxy[15178]: 46.111.10.71:50873 [13/Mar/2017:18:09:17.156] frontend-name mybackend-vs-backend/backend-vs-node1 0/0/11/773/3543 200 42682 - - ---- 1050/125/74/35/0 0/0 {website.info} "POST /support/contact.php HTTP/1.0" - -

As far as my understanding from the haproxy documentation goes — Tq + Tw + Tc + Tr = tt. Weirdly, 0+0+11+773 is not equal to 3543 in 0/0/11/773/3543. Where as as per haproxy documentation
http://cbonte.github.io/haproxy-dconv/1.5/configuration.html#8.2.3 it does. What am i missing ?

Thanks!

Best Answer

The calculation of Tq+Tw+Tc+Tr=Tt is only valid when you have logasap configured. The Tt value is in that case prepended by a +, so this is not the case for you. (also it would be pretty useless to use as a session time indication) The session time will be hard to calculate from these logs. Basically the Tt means the total time from the accept to the closing of the connection. If there is a keepalive active, this time could become quite high, even though the session was finished for a while already. If you force the connection to be closed immediately after the session is finished, you could use sessiontime=Tt-Tq-Tw. The Tr is the server processing time, which is part of the sessiontime, and therefor not substracted from the Tt.