Re: [PATCH] tcp: splice as many packets as possible at once

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Eric Dumazet <dada1@...>
Cc: David Miller <davem@...>, <ben@...>, <jarkao2@...>, <mingo@...>, <linux-kernel@...>, <netdev@...>, <jens.axboe@...>
Date: Friday, January 9, 2009 - 3:42 am

On Fri, Jan 09, 2009 at 08:28:09AM +0100, Eric Dumazet wrote:

Yes it will, precisely because during the time you spend processing flow #1,
you're still receiving data for flow #2. I really invite you to try. That's
what I've been observing for years of userland coding of proxies.

> I tried my test program with a Gb link, one flow, and got splice() calls returns 23000 bytes

I also observe 23000 bytes on average on gigabit, which is very good
(only about 5000 calls per second). And the CPU usage is lower than
with recv/send, and I'd like to be able to run some profiling because
I observed very different performance patterns depending on the network
cards used. Generally, almost all the time is spent in softirqs.

It's easy to make poll wait a little bit more : call it later and do
your work before calling it. Also, epoll_wait() lets you ask it to
return just a few amount of FDs. This really improves data gathering.
I generally observe best performance between 30-200 FDs per call, even
with 10000 concurrent connections. During the time I process the first
200 FDs, data is accumulating in the other's buffers.

> If the application uses setsockopt(sock, SOL_SOCKET, SO_RCVLOWAT, [32768], 4), it

Yes, I agree about that. But my comment was about not making this
behaviour mandatory for splice(). Letting the application choose is
the way to go, of course.

> (Next blocking point is the fixed limit of 16 pages per pipe, but

Yes but that's not always easy to guess how many data you can feed
into the pipe. It seems that depending on how the segments are
gathered, you can store between 16 segments and 64 kB. I have
observed some cases in blocking mode where I could not push more
than a few kbytes with a small MSS, indicating to me that all those
segments were each on a distinct page. I don't know precisely how
that's handled internally.

> >> About tcp_recvmsg(), we might also remove the "!timeo" test as well,

OK, I initially understood that you suggested we could simply remove
it like I did for splice.

> Lets focus on functional changes, not on implementation details :)

Agreed :-)

Willy

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] tcp: splice as many packets as possible at once, Willy Tarreau, (Thu Jan 8, 1:30 pm)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Fri Jan 9, 6:42 pm)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Sun Jan 11, 8:58 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Sun Jan 11, 9:35 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Sun Jan 11, 12:05 pm)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Tue Jan 13, 8:13 pm)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Tue Jan 13, 8:22 pm)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 4:53 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Tue Jan 20, 4:37 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Fri Jan 16, 2:51 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Tue Jan 20, 8:11 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Tue Jan 20, 10:06 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Mon Jan 19, 4:40 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Mon Jan 26, 3:59 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 5:54 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 8:15 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 8:06 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 5:42 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 6:47 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 7:40 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 7:45 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Fri Jan 9, 7:01 pm)
Re: [PATCH] tcp: splice as many packets as possible at once, Willy Tarreau, (Fri Jan 9, 3:42 am)
[PATCH] tcp: splice as many packets as possible at once, Willy Tarreau, (Thu Jan 8, 4:16 pm)