FW: [PATCH] Stop packet_recv greediness, stop using event_add_timed

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue May 19 08:41:24 GMT 2009


On Tue, May 19, 2009 at 07:43:35AM +0100, Sam Liddicott wrote:
> /me bangs head on floor.

Sorry for that, but I think my query is still valid. You're
seeing a problem with the policy to read everything in a
greedy way. I *think* this has been added due to performance
reasons. If you would be happy with just reading a packet at
a time with 4 syscalls (epoll -> read 4 bytes -> epoll ->
read rest) this might be slower than the 3 syscalls (epoll
-> ioctl(FIONREAD) -> read everything). So if you can prove
how much the latter scheme gains, I think the discussion
will become much easier. If you get a packet rate loss below
noise, it's done I think. If you get a measurable packet
rate loss, we have to discuss efficiency vs code clarity.

> As for the speed comparison, do you want a comparison of a regular 
> server process doing certain tasks or do you want the timings for a pure 
> read loop reading a few megabytes of samba packets and doing no other 
> processing?

I would prefer a micro-benchmark just doing the packet
feeding into one direction with a VERY simple tbench-style
program. One direction because only this should in theory be
the best case for the greedy read. That benchmark should do
packet parsing just up to a level where you actually dissect
the different netbios session packets, because that is what
the 4 syscall scheme also gives you.

I would suspect if you put the full server behind it, the
loss will be way below the noise.

> Ultimately we suspect that libevent needs reworking so that it can 
> consider the state of all sockets and timers and then deliver them in a 
> global priority order, instead of taking each fd in turn.

Are you sure you want a real priority scheme? I would guess
that assuming epoll does not do randomizing or proper
queueing, what you want is a randomizer over all readable
sockets.

Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090519/719b4f94/attachment.bin


More information about the samba-technical mailing list