[web-devel] Content-Length on sendFile

Gregory Collins greg at gregorycollins.net
Wed Jun 15 14:52:03 CEST 2011


On Wed, Jun 15, 2011 at 9:16 AM, Kazu Yamamoto <kazu at iij.ad.jp> wrote:
>> wouldn't the overhead of reading from the drive dominate the
>> overhead of copying the contents from userspace to kernel space?
>
> Probably yes at the first time.
> But I'm not sure after the file is cached.

If the file is in buffer cache, sendfile should be faster, it's zero-copy.

Re: sendfile, we solve this issue by making it impossible to issue a
sendfile() without sending either a file length or a byte range. Our
file serving code only calls stat() once, of course -- I agree with
Kazu, more than once I would probably consider a bug.

G
-- 
Gregory Collins <greg at gregorycollins.net>



More information about the web-devel mailing list