Hi Stefan,
On Wed, Aug 11, 2010 at 11:31:35AM +0100, Stefan Cocora wrote:
> Hello all,
>
> I'm faced with a couple of things that I want to change in haproxy
> 1.4.8.
> First I'll start with what I want to achieve by recompiling
> haproxy: I want to increase the sending buffer to 32kb and the logging
> size to 32kb as well.
Since 1.4 you don't need to recompile at all for this. You can simply
assign "tune.bufsize" and "tune.maxrewrite" in the global sections.
Example :
global
tune.bufsize 32768
tune.maxrewrite 1024
> I have to deal with huge GET requests , that is
> the reason behind this change , so I want to send and also be able to
> log those big requests. The default for these two values is: for the
> sending buffer is 8kb and the logging buffer is at 1kb.
>
> In order to achieve these 2 things this is what I changed at
> compile time:
>
> 1. for the buffer size : (in include/common/defaults.h) define
> BUFSIZE 65536 , taking into consideration that
> MAXREWRITE is defined as BUFSIZE/2 I figure that the value above
> will change the buffer size to 32kb. I am aware that there is a
> config file parameter type of increasing the buffer size as well
> but since I was recompiling I thought of changing in the buffer
> size in the source code as well.
Ah you've found it too ;-) Well, I would really suggest not changing
your default settings in the code when it's possible to have them in
the config, because one day you may migrate your config somewhere else,
or someone else might rebuild a new version to fix a bug and forget
about your change.
> 2. for the increased logging buffer this is what I've changed
> 1. in include/common/defaults.h
> 1. define REQURI_LEN 32768
> 2. in include/types/log.h
> 1. define MAX_SYSLOG_LEN 32768
>
> (kudos to vr and flashn for helping me figure out what defines to
> change in the source code)
Huh!! Not only this will increase memory usage, but it will probably not
work with many syslog servers.
> However even after recompiling with these changes in place the
> proxy still has the sending buffer set to 8kb and the logging buffer set
> to 1kb.
> Which other defines would I need to change ?
you changed the right one but I suspect that your distro's build script
sets -DBUFSIZE on the make command line. Concerning the MAX_SYSLOG_LEN,
since it's unconditionnally defined, I think it's even simpler : your
change took effect but the syslog server's buffer is also limited to
1024, as required by RFC 3164. Note that the more recent RFC5426
recommends that receivers must be able to receive at least 480 bytes and
should be able to receive up to 2048, and that too large messages may
be truncated or discarded.
So in fact, by increasing the message length beyond your whole syslog
chain's max length, you risk losing logs instead of having truncated
ones. Also, messages larger than your network's MTU will cause
fragmentation, increasing the risk of losses (since losing at least
one fragment is enough to lose the whole packet).
I'm still wondering how it's possible to have anything useful in more than
1 kB of HTTP logs, considering that the request is in the last field. Even
if you get extremely large GET requests, all the useful information is still
present, so I remain doubtful :-/
Regards,
Willy