Using sendfile for reducing CPU utilization

Richard Sharpe rsharpe at ns.aus.com
Fri Jul 19 14:21:02 GMT 2002


On Fri, 19 Jul 2002, Lev Iserovich wrote:

> Wait, I thought that under linux, if you enable kernel oplocks, you 
> _can't_ change the file while its being sent, right?

Well, at least you will get a signal from the kernel under Linux to say 
that someone tried to change the file in an incompatible, and their 
request will not proceed until you manage to issue the oplock break and 
get a response. However, it would be nice for this to work in 
the absence of oplocks, at least for read.

An earlier observation that Jeremy made was that you can only safely do 
this with oplocked files (Level 2 or Exc), and I agree that this makes 
things cleaner.

> Can you post a copy of your patch?

Well, I have to clean it up. It is based on Anton's patch from a while 
ago, and it is specific to FreeBSD's sendfile function, which is not like 
the Linux/Solaris implementation.

> We're experimenting with sendfile here as well, but we're using a very 
> old patch, posted around Feb. or so. Its pretty hacky.
> We do see a drop of about 20-30% CPU utilization, and increase of about 
> 5-10MB/s (thats megabytes!) in bandwidth with sendfile, so having it 
> officially in 2.2.6 would be really good for high-bandwidth fileserver 
> boxes like ours.

And ours :-)

> (And is there a recvfile?? Never heard of that. Maybe BSD only?)

FreeBSD only implements the send from file to socket in sendfile, but adds 
the header. So, I have to add recvfile to do the other direction.

Regards
-----
Richard Sharpe, rsharpe at ns.aus.com, rsharpe at samba.org, 
sharpe at ethereal.com





More information about the samba-technical mailing list