|more useful options|
4k read buffer is too smallby voeckler (Sexton)
|on Jun 16, 2008 at 19:02 UTC||Need Help??|
voeckler has asked for the
wisdom of the Perl Monks concerning the following question:
I am looking for a way to increase the 4k size that strace shows read() will do at system level. Yes, I've read Re^3: Perl Read-Ahead I/O Buffering and I kindly disagree that 4k is enough for everybody. After all, in C you can use setvbuf to set your buffer sizes, and in C++ you can use a complex streambuf statement to increase the buffer size. Occasionally you have situations where a larger buffer makes sense.
Since PerlIO's setvbuf has been disabled, I wonder, how do I set a larger read buffer size in Perl, so that the read()s as seen by strace are using more than 4k? Even if it is not making my Perl programs run faster, it would make the NFS server experience less load, and thus frustrate the admins less, who will have to deal with annoyed users.
I've trolled the web for some time, and couldn't really find an applicable solution how to increase Perl's read buffers sizes. I've written a FullyBuffered module using sysreads within an object, by-passing regular PerlIO, but it feels slow, and does not integrate nicely with PerlIO handles, e.g. occasionally, I do need the utf8-layer. I'd be loathe having to recompile my Perl to make the default read buffer size larger, though I would be willing to do, with good instructions, if that is what it takes.
I'd really appreciate some insight into increasing the read buffer size.