You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by TO...@aol.com on 2001/08/17 23:14:41 UTC

Killer malloc() in apr_sendv()

In a message dated 01-08-17 16:02:41 EDT, you write:

> > I know the conventional wisdom is that SSI is slow because of
>  > the malloc calls in bucket creation, but the problem might
>  > be elsewhere.  I've tried adding in a free list of recycled
>  > buckets, to reduce the calls to malloc, but it didn't seem to
>  > affect performance measurably.
>  
>  I've replaced the malloc/frees in the bucket code on Windows with a power 
of 
> 2 allocator
>  and it makes a BIG difference in performance. I expect the same on every 
OS 
> with the
>  exception of Linux.

You might want to add the same 'power of 2' stuff to a call 
that is absolutely killing the windows version.

apr_sendv() in /srclib/apr/network_io/win32/sendrecv.c
is using a malloc()/free() combo for only 8 bytes!
It's using WSASend() and can 'scatter gather' but so far
I've never seen more than 2 separate buffers to 'gather'
on any particular call to apr_sendv().

There is a comment there about 'putting it on the stack' but
you'd be better off doing this sooner than later because
the malloc()/free() for only 8 bytes is killing you on every
transmit.

Yours...
Kevin Kiley

Re: Killer malloc() in apr_sendv()

Posted by Bill Stoddard <bi...@wstoddard.com>.
> In a message dated 01-08-17 16:02:41 EDT, you write:
> 
> > > I know the conventional wisdom is that SSI is slow because of
> >  > the malloc calls in bucket creation, but the problem might
> >  > be elsewhere.  I've tried adding in a free list of recycled
> >  > buckets, to reduce the calls to malloc, but it didn't seem to
> >  > affect performance measurably.
> >  
> >  I've replaced the malloc/frees in the bucket code on Windows with a power 
> of 
> > 2 allocator
> >  and it makes a BIG difference in performance. I expect the same on every 
> OS 
> > with the
> >  exception of Linux.
> 
> You might want to add the same 'power of 2' stuff to a call 
> that is absolutely killing the windows version.
> 
> apr_sendv() in /srclib/apr/network_io/win32/sendrecv.c
> is using a malloc()/free() combo for only 8 bytes!
> It's using WSASend() and can 'scatter gather' but so far
> I've never seen more than 2 separate buffers to 'gather'
> on any particular call to apr_sendv().
> 
> There is a comment there about 'putting it on the stack' but
> you'd be better off doing this sooner than later because
> the malloc()/free() for only 8 bytes is killing you on every
> transmit.
> 

I'll do it this weekend. 
Thanks,

Bill