Hi Benoit,
On Tue, Nov 06, 2012 at 03:16:27PM +0100, Benoit GEORGELIN (web4all) wrote:
> Hi everybody ,
>
> I try to figured out and understand more the information in haproxy web
> interface regarding :
>
> Current conns
> Queue
> Session Rate
> Sessions
>
> Because I have a problem on my infrastructure since 2 days.
> my Current conns jump from about 600 to 1800 in few second and I don't know
> if this is a consequence of a workload on the backends who goes dead or if
> it's because of the 1800 currents connections
> Are the current connection growing even if there is not any backend ? Or
> there is no relation about crash from backends ?
Concurrent connections generally are the result of a server slowing down.
Since you generally can't control the visitors request rate, if your servers
take twice as much time as usual, you'll see twice as many connections as
usual.
However, when a server is detected as down, its active connections are
completed (unless you used some of the special "observe/on-error" settings),
and pending connections are redistributed to other servers. If none remains,
they're dropped (precisely an error is returned and the connection is closed).
So normally if a server is completely dead you should see very few conns.
It is perfectly possible that your server went ill because of the load. You
will find this in the logs. Check for logs lines with flags "sH" which mean
"server timeout while waiting for response headers". And check the numbers
that follow, they indicate the number of concurrent connections when that
request was logged. The number of conns is for the process/frontend/backend/
server/#retries. You'll see at what point the server started to fail
requests. Then you can put a limit slightly below that point in the
configuration using the "maxconn" setting on "server" lines. You may have
to tweak this a bit before finding the optimal value. Don't go to low,
it's a bit addictive, as many servers tend to work much faster with
lower values but as a result will accept less long requests at a time too.
> Can someone explain this information:
> Current conns
=> number of TCP connections from clients to the element showing this
value (eg: frontend, backend, server)
> Queue
=> number of requests pending in the queue (backend, server). Only
happens when "maxconn" is set on server lines.
> Session Rate
=> number of new connections per second
> Sessions
=> total number of elapsed connections from the start of the process.
> I did not find in the documentation what that mean
>
> For exemple, 1 current connection mean 1 sessions a least right ?
> 1 current connection is from client to haproxy and the sessions is from
> haproxy to backend servers so 1 current connexion can have more than 1
> sessions ?
It's almost that. A connection is just what you see when doing "netstat",
basically a TCP connection which is established and accepted by haproxy.
It becomes a session when it passes minimal validation tests (eg: anti
DDoS rules) and is fully allocated and initialized (buffers, ...). A
session carries up to two connections, one to the client and one to the
server, and links them together. Over a session, any number of HTTP
requests may flow.
If you're interested, take a look at the "entities" files in doc/internal,
there are some drawings (not very detailed, just a bit high-level).
Regards,
Willy