If the file sent with send_file is similar in size to the default buffer size (4096 bytes), does it always make sense to use stream: false? For example, are there proxies or browsers that break badly if the buffer size is non-standard?
Related:
- Does the buffer size refer to the file or the HTTP packet?
- Can you recommend a Firefox extension to inspect HTTP packets at this level?
If you look at the source, rails basically does
And the
buffer_sizeoption controls the value oflen. Very small values oflenare inefficient in terms of IO activity, very large values are wasteful of memory. How this then gets broken up into tcp packets is not under your control. If you were to change the value, increasing it to the size of the file would just be wasteful – I don’t think you’d need anything more than a few hundred k – 128k or 256k would be ample. Optimal buffer sizes will be operating system / hardware dependant.