Re: PROBLEM: select() on TCP socket sleeps for 1 tick even if data

Michael Lindner (mikel@att.net)
Sat, 20 Jan 2001 20:22:24 -0500


Chris Wedgwood wrote:
>
> On Sat, Jan 20, 2001 at 07:35:12PM -0500, Dan Maas wrote:
>
> Bingo! With this fix, 2.2.18 performance becomes almost identical to 2.4.0
> performance. I assume 2.4.0 disables Nagle by default on local
> connections...
>
> 2.4.x has a smarter nagle algorithm.

Thanks again for all the help, guys...

Haven't installed 2.4 yet, but I tried the setsockoption route.
Performance is better, but the two processes together never total more
than 50% of the CPU (i.e. the thing is still schedule-bound, not compute
bound, as it is on other platforms), and throughput is only up to 800
sends/sec. Better than the 100/sec. I was getting, but still a far cry
from the identical box running Windows, where performance is 8K/sec.

...and I still don't understand why the identical program, but using one
socket instead of 2 sockets, IS CPU bound, and gets on the order of
10K/sec. on the same HW. Diffs to produce 10K/sec. 1 socket version from
my previous sample follow...

--
Mike Lindner

diff sockperf.c sockperf1.c 163c163 < if (pings++ < 1000) {

---
>                               if (pings++ < 10000) {
177c177
<       fprintf(stderr, "elapsed time for 1000 pingpongs is %g\n",
now.tv_sec - then.tv_sec + (now.tv_usec - then.tv_usec) / 1000000.0);
---
>       fprintf(stderr, "elapsed time for 10000 pingpongs is %g\n", now.tv_sec - then.tv_sec + (now.tv_usec - then.tv_usec) / 1000000.0);
205c205
<                       int     s = connectsock(argv[1], argv[3],
"tcp");
---
>                       int     s = r;
214c214
<                       int     r = accept(f, (struct sockaddr *) &fsin,
&alen);
---
>                       int     r = s;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/