On Wed, 20 Feb 2002, Graham Leggett wrote:

> Igor Sysoev wrote:
> 
> > 1.3.23 mod_proxy calls ap_proxy_send_fb() and than closes backend.
> > But ap_proxy_send_fb() flushes output to client so it can hang
> > for a long time.
> 
> I have come up with a patch to solve this problem - in theory anyway.
> 
> Can you test it and get back to me with whether it makes a difference or
> not...?
> 
> The patch is being posted separately.

+    /* allocate a buffer to store the bytes in */
+    /* make sure it is at least IOBUFSIZE, as recv_buffer_size may be zero for
system default */
+    buf_size = MAX(recv_buffer_size, IOBUFSIZE);
+    buf = ap_palloc(r->pool, buf_size);

There is one drawback in this code. ap_palloc() is not good for
big allocations (I think > 16K) because it stores data and meta-data
together. I had found this when try to allocate memory from pool
for zlib in mod_deflate. zlib needs about 390K - 2*128K + 2*64K + 6K.
After this change Apache had grown up about 2M after about hour
with 50 requests/s. I'm not sure that this growing could continue but
I did not want additional 2M on each Apache.

I use malloc for big allocations, store addresses in array
allocated from pool and set cleanup for this array.
In cleanup I free addresses if they is not free already.
 
Igor Sysoev

Reply via email to