From your quoted text:

"...unless the data is already in the read-ahead buffer."
So what's happening here is you perl script is faster that the NFS fill ( not suprising ) and so is emptying out the buffer on each read. Subsequent reads are issued before the read-ahead has time to fill the buffer. At least in a perfect world this what 'may' be happening, unless your NFS client is broken somehow. Try putting a sleep in your script and look at iostat to see if the NFS read sizes increases. I had actually though earlier of putting sleep in the code to ease the burden on the network but dismissed it as not addressing the NFS driver buffering issue, but from the text provided it seems that your driver implementation over-responds to multiple requests and so might respond to a slowing of the request rate.

I don't recall if you've stated anywhere whether your script reads the file sequentially. If so have you tried somethine like:

cat "filename" > script
In order to buffer the reads. ( You may need an enhanced version of cat to avoid memory thrashing with this method.)

Should you still decide to pursue modification of perl it would seem that this is the kind of thing for which IO layers was implemented. One would make a copy of the appropriate layer, change the name, then modify the buffer size. Switching to a larger read buffer would then simply require a use statement in your code.


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

In reply to Re^5: 4k read buffer is too small by starbolin
in thread 4k read buffer is too small by voeckler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.