http://qs321.pair.com?node_id=692427


in reply to 4k read buffer is too small

You might want to look at your NFS client to see if it can be of any help. Readahead could help here a great deal without changing Perl; look at the rsize NFS option, and any other options you have in your NFS client. You will need to test by running tcpdump or looking at your NFS stats, since Perl will still be doing 4K reads, but the OS will be doing larger reads behind the scenes.

If you're only reading the file from beginning to end, another useful trick is to write a small program to read files in whatever blocksize you need (for example with sysread) and write them to standard output; then you can run that program and pipe its output to your actual program, which can read from the pipe in 4KB blocks without affecting how the NFS server is accessed. If you need to seek around this won't work, but sometimes it can be helpful.