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 <rsharma51@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.