You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Scott Gifford <sg...@suspectclass.com> on 2012/07/19 16:43:09 UTC

Re: mod_perl Filters: Selecting the most appropriate buffer size

On Tue, Jul 10, 2012 at 7:16 AM, Rommel Sharma <rs...@sapient.com>wrote:

>  Hi All,****
>
> ** **
>
> I am going through the documentation on mod_perl filters at the link below:
> ****
>
> ** **
>
> http://perl.apache.org/docs/2.0/user/handlers/filters.html****
>
> ** **
>
> ** **
>
> Examples set a buffer size to process the content held in the buffer like:
> ****
>
> ** **
>
> use constant BUFF_LEN => 1024;****
>
> ** **
>
> What is the best approach to reach most optimum buffer size? Is there a
> best practices like guideline here?
>

Not sure about mod_perl specifics, but the tradeoff with buffer sizes is
generally that larger buffers give better overall throughput, at the cost
of more memory and latency.  On a disk, using a number that is a multiple
of the filesystem block size will usually give the best performance.  With
data coming from the network or a script, I don't think it will matter
much.  You can certainly try different values and measure the results, but
anything 1K or more will probably be OK.

Hope this helps,

------Scott.

RE: mod_perl Filters: Selecting the most appropriate buffer size

Posted by Rommel Sharma <rs...@sapient.com>.
Scott,

Many thanks for the inputs. This definitely helps. Will be testing out the performance with different buffer size 1K and higher.

Rommel.

From: Scott Gifford [mailto:sgifford@suspectclass.com]
Sent: Thursday, July 19, 2012 8:13 PM
To: Rommel Sharma
Cc: mod_perl list
Subject: Re: mod_perl Filters: Selecting the most appropriate buffer size

On Tue, Jul 10, 2012 at 7:16 AM, Rommel Sharma <rs...@sapient.com>> wrote:
Hi All,

I am going through the documentation on mod_perl filters at the link below:

http://perl.apache.org/docs/2.0/user/handlers/filters.html


Examples set a buffer size to process the content held in the buffer like:

use constant BUFF_LEN => 1024;

What is the best approach to reach most optimum buffer size? Is there a best practices like guideline here?

Not sure about mod_perl specifics, but the tradeoff with buffer sizes is generally that larger buffers give better overall throughput, at the cost of more memory and latency.  On a disk, using a number that is a multiple of the filesystem block size will usually give the best performance.  With data coming from the network or a script, I don't think it will matter much.  You can certainly try different values and measure the results, but anything 1K or more will probably be OK.

Hope this helps,

------Scott.