Hello,
Willy, thanks for you email. I will try to fight with the opts and
memory? I hope it helps also for "low memory". We have 4GB on our 2
nodes servers.

On Tue, Nov 16, 2010 at 11:59 AM, Willy Tarreau <[email protected]> wrote:
> Hello,
>
> On Wed, Nov 10, 2010 at 04:09:56PM +0100, Miko?aj Radzewicz wrote:
>> Hello,
>> I have a problem with haproxy and low memory usage. We have small 2
>> nodes GFS cluster. On both nodes we installed haproxy, apache, php,
>> proftpd. The thing is when the number of request is higher,  process
>> are being killed. It seems that the server become run out of low
>> memory and oom-killer starts to kill processes to free a bit of it.
>
> That can indeed happen on servers with too low memory.
>
>> The problem arise when we use haproxy.... When we do not use the proxy
>> it is OK. Is it possible to do sth with it? Maybe we have to compile
>> haproxy with non-defaults opts? The some things happen on the other
>> server with only lighttpd installed... I would rather not to install
>> 64bit OS.
>
> I tend to build it with -DBUFSIZE=8030 -DMAXREWRITE=1030. That divides
> by almost two the memory usage. On average you should consider about
> 17 kB per connection (2*8kB for buffers, 1kB for session). You must
> also consider the kernel's socket buffers, which tend to be a lot higher
> by default :
>
> $ cat /proc/sys/net/ipv4/tcp_rmem
> 4096    87380  4194304
> $ cat /proc/sys/net/ipv4/tcp_wmem
> 4096    16384  4194304
>
> The middle number is the default buffer size for read and writes for each
> socket. The leftmost is the minimum size (in case of memory shortage).
> This means that by default, one connection will consume 2*(87380+16384)=
> approx 200 kB of RAM in the system, but when memory starts to become scarce,
> the system will still use 2*(4096+4096) = 16 kB. That's why I think that the
> values above are reasonable : 17 kB for haproxy, 16 kB for the system. We're
> at 33 kB total per connection. 1000 connections will require 33 MB of RAM.
>
> In my experience, with the OOM killer and server components which need
> reliable operation, you should always set overcommit_memory to 2 and
> overcommit_ratio to a value that suits your usage (40-70% depending on
> the system and memory size). It will cause a malloc() to fail when there
> is no RAM, instead of pretending the memory is allocated and crashing
> the process when it tries to use it.
>
> Doing so, you'll notice that your system allocates more memory than it
> really needs, but overall on servers the difference is low and it ensures
> very reliable operations (you don't need to run firefox or any such thing
> in such an environment).
>
> How much RAM do you have on your system ?
>
> Regards,
> Willy
>
>



-- 
Pozdrawiam,
Mikołaj

Reply via email to