Date: Sat, 10 Jan 1998 21:15:52 -0700 (MST) From: Marc Slemko <marcs@znep.com> To: hackers@FreeBSD.ORG Subject: why 100 byte TCP segments? Message-ID: <Pine.BSF.3.95.980110210531.3955C-100000@alive.znep.com>
next in thread | raw e-mail | index | archive | help
Note the below tcpdump: 21:05:47.748479 valis.worldgate.com.1034 > testbed.worldgate.com.http: S 761734757:761734757(0) win 16384 <mss 1460> (DF) 21:05:47.748749 testbed.worldgate.com.http > valis.worldgate.com.1034: S 1887037484:1887037484(0) ack 761734758 win 17520 <mss 1460> (DF) 21:05:47.749793 valis.worldgate.com.1034 > testbed.worldgate.com.http: . ack 1 win 17520 (DF) 21:05:47.749809 valis.worldgate.com.1034 > testbed.worldgate.com.http: P 1:101(100) ack 1 win 17520 (DF) 21:05:47.749823 valis.worldgate.com.1034 > testbed.worldgate.com.http: FP 101:139(38) ack 1 win 17520 (DF) 21:05:47.749837 testbed.worldgate.com.http > valis.worldgate.com.1034: . ack 140 win 17482 (DF) 21:05:47.752540 testbed.worldgate.com.http > valis.worldgate.com.1034: F 1:1(0) ack 140 win 17520 (DF) 21:05:47.766014 valis.worldgate.com.1034 > testbed.worldgate.com.http: . ack 2 win 17520 (DF) valis is a FreeBSD 2.2 box. The same thing happens on boxes from 2.1.5 to 2.2.5. Don't have a -current box to try it... The connection was generated by the below program. Note that it is a single write() or send() call that generates the data, yet it is split into two packets. While it isn't a big deal here, I noticed this when I was using a simple web benchmark program (ZeusBench) that doesn't disable the Nagle algorithm. In that example, the server was delaying its ack (standard 200ms) and the client wasn't sending the second part of the request (due to Nagle) so you could only get 5 reqs/sec on a persistent connection, ie. multiple sequential requests on one TCP connection. Disabling Nagle fixed this of course. Why is this happening? Is it just a coincidence that 100 bytes is the size of the data area in the first mbuf in a chain? Has it been fixed in -current or should I dig deeper... #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> int main () { int s; struct sockaddr_in servaddr; struct hostent *he; char request[2048]; char *file = "/index.html"; char *machine = "testbed.worldgate.com"; int keepalive = 1; sprintf(request, "GET %s HTTP/1.0\r\nUser-Agent: ZeusBench/1.0 with a longer name\r\n" "%sHost: %s\r\nAccept: */*\r\n\r\n", file, keepalive?"Connection: Keep-Alive\r\n":"", machine ); s = socket(AF_INET, SOCK_STREAM, 0); if (s < 0) { perror("socket"); exit(1); } bzero(&servaddr, sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_port = htons(80); he = gethostbyname(machine); servaddr.sin_addr.s_addr = ((unsigned long *)(he->h_addr_list[0]))[0]; if (connect(s, (struct sockaddr *) &servaddr, sizeof(servaddr))) { perror("connect"); exit(1); } /* both ways do the same thing */ #ifdef 1 write(s, request, strlen(request)); #else send(s, request, strlen(request), 0); #endif }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.980110210531.3955C-100000>