High memory consumption when proxying to a Comet server

Rogério Schneider stockrt at gmail.com
Thu Apr 15 11:42:57 MSD 2010


> It's size of single proxy buffer used for passing data with
> proxy_buffering off.  It will be allocated once during request
> start.  And by allocating bigger buffer you reduce number of
> chunked encoding markers needed to pass big responses...
...
> Not exactly.  It allocates 2 buffer structures (52 bytes each on
> i386) and 18 bytes to hold chunk-size and initial CRLF (final CRLF
> uses static string).  This gives something about 122 bytes per
> chunk, i.e. about 30 chunks per 4k malloc'ed from system (+-
> alignment and allocation overheads).
...
> ...
>   1 2010/04/12 00:06:04 [debug] 32748#0: *55 malloc: 096E9878:4096
>  31 2010/04/12 00:06:04 [debug] 32748#0: *55 recv: fd:16 1024 of 1024
>   1 2010/04/12 00:06:04 [debug] 32748#0: *55 malloc: 096F5160:4096
>  30 2010/04/12 00:06:04 [debug] 32748#0: *55 recv: fd:16 1024 of 1024
>   1 2010/04/12 00:06:04 [debug] 32748#0: *55 malloc: 096F6168:4096
> ...

Is there some chance in free()ing this allocations after the chunk is
sent, but before the connection is finished? Since it is a long
lasting connection, I need to free some space at regular interval, so
I do not run out of memory.

Many thanks for all the explanations.

Sincerely,
-- 
Rogério Schneider
http://stockrt.github.com



More information about the nginx mailing list