cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl with sendfile

From: Jamie Lokier <jamie_at_shareable.org>
Date: Mon, 10 Mar 2008 19:12:46 +0000

Brian McQueen wrote:
> Does libcurl use linux's high performance sendfile routine when
> appropriate? I don't see it as fitting into the write callback
> scheme. The write callback scheme seems to use memory buffers in user
> space for handling the writes, but sendfile skips user space and sends
> directly from one fd to another fd.

Sendfile is most useful for servers, as they typically handle a much
higher sending load than clients. It's quite unusual to have a
machine with hundreds of simultaneous client uploads, whereas
thousands simultanous downloads from a server is not uncommon.
Sendfile saves memory as well as copying time in this scenario,
because all the simultaneous downloads share page cache memory and TCP
socket buffers.

Since curl isn't a server, you'd only use sendfile when uploading
files to one. Would it really make a noticable difference to any
client application to do this?

-- Jamie
Received on 2008-03-10