Re: Debugging 502 errors

From: Willy Tarreau <w#1wt.eu>
Date: Wed, 25 Nov 2009 06:22:12 +0100


On Mon, Nov 23, 2009 at 11:53:48AM +0100, Nerilaunt Nerilaunt wrote:
> Well, it seems to be a problem with Prestahop's very big headers.
>
> I update include/common/defaults.h and set BUFSIZE 32768 instead of 16384
>
> Seems to work.
>
> Is it safe ?

Yes it is. And with version 1.4, you will be able to specify that in the global section instead of recompiling.

You can also reduce the MAXREWRITE parameter which defaults to half of the BUFSIZE. It's used to reserve some space in the request and response for header rewriting, but you generally don't need it to be that large. It made sense in the early days when default buffer size was 4 kB. I'm used to build with BUFSIZE=8030 and MAXREWRITE=1030. You don't have to change the source for that, you can pass that in the makefile. For instance :

  $ make TARGET=linux26 SMALL_OPTS="-DBUFSIZE=16384 -DMAXREWRITE=1024 -DSYSTEM_MAXCONN=40000"

This will allow requests/responses up to 15 kB (16 buf - 1 rewrite).

Be very careful with applications requiring large headers, as there are many clients/servers/proxies which will not accept them. Haproxy by default supports 8kB total headers. Apache supports 101 lines of 8 kB each (100 headers + the request or response line). Many network products which have to analyse HTTP start to feel bad above 4 kB. So as a rule of thumb, you should consider that when you have to tweak haproxy's settings, you're taking risks to push the issue one step further.

Regards,
Willy Received on 2009/11/25 06:22

This archive was generated by hypermail 2.2.0 : 2009/11/25 06:30 CET