Patch - Avoid extra system traps

Tomash Brechko tomash.brechko at
Thu Dec 20 12:58:55 UTC 2007

On Thu, Dec 20, 2007 at 12:16:15 +0100, Trond Norbye wrote:
> 2.  The previous implementation of try_read_network will try to read  
> from the network until it read returns with an error code.  The new  
> implementation will stop reading if read returns less bytes than we  
> had room for in our buffer.  I assume that the OS will return all of  
> the available data instead of forcing the program to issue multiple  
> read operations. If the OS for some odd reason decide to return less  
> than the data that is available, this socket will be signaled the next  
> time we poll libevent for a new event.

This would work only if libevent uses only level-triggered signalling,
and never edge-triggered (see man epoll(2) on Linux for the definition
of the two).  I didn't check it, but I think this holds true, because
select(2) and poll(2) support level-triggering only, and libevent may
use either call.

So, why not to apply the same for send calls too?

   Tomash Brechko

More information about the memcached mailing list