dcsimg
A new local port is used for each HTTP request. Does this block more sockets on the server?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Evert_Hoff
Posted On:   Tuesday, June 4, 2002 05:03 AM

I am writing a monitoring program. It downloads the same file from a web server at regular intervals. As the tcpdump below shows, the same local port is not reused - about every second it starts using a different local port. If have found this with the client running on both Windows 2000 and Linux, and with both the java.net.* libraries and with the Jakarta HttpClient.  Is this bad? Does it mean that with each new port used on the client, a new socket on the server becomes blocked by my monitoring program? I don't want my monitoring program to take away too much system resources on the server from productive requests. Here is the tcpdump with the    More>>

I am writing a monitoring program. It downloads the same file from a web
server at regular intervals. As the tcpdump below shows, the same local port
is not reused - about every second it starts using a different local port.
If have found this with the client running on both Windows 2000 and Linux,
and with both the java.net.* libraries and with the Jakarta HttpClient. 




Is this bad? Does it mean that with each new port used on the client, a new
socket on the server becomes blocked by my monitoring program? I don't want
my monitoring program to take away too much system resources on the server
from productive requests.



			Here is the tcpdump with the test repeated every 10 seconds:
			

12:47:44.814288 192.168.0.2.38897 > 192.168.0.1.webcache: S 827482515:827482515(0) win 5840 (DF)
12:47:44.814288 arp reply 192.168.0.2 is-at 0:50:56:fa:70:df
12:47:44.814288 192.168.0.2.38897 > 192.168.0.1.webcache: . ack 3263735413 win 5840 (DF)
12:47:44.854288 192.168.0.2.38897 > 192.168.0.1.webcache: P 0:26(26) ack 1 win 5840 (DF)
12:47:45.094288 192.168.0.2.38897 > 192.168.0.1.webcache: P 26:45(19) ack 1 win 5840 (DF)
12:47:45.284288 192.168.0.2.38897 > 192.168.0.1.webcache: P 45:107(62) ack 1 win 5840 (DF)
12:47:45.304288 192.168.0.2.38897 > 192.168.0.1.webcache: . ack 249 win 6432 (DF)
12:47:45.334288 192.168.0.2.38897 > 192.168.0.1.webcache: . ack 1697 win 8688 (DF)
12:47:45.354288 192.168.0.2.38897 > 192.168.0.1.webcache: . ack 2832 win 11584 (DF)
12:47:45.374288 192.168.0.2.38897 > 192.168.0.1.webcache: F 107:107(0) ack 2832 win 11584 (DF)
12:47:45.414288 192.168.0.2.38897 > 192.168.0.1.webcache: . ack 2833 win 11584 (DF)
12:47:55.394288 192.168.0.2.38898 > 192.168.0.1.webcache: S 837749116:837749116(0) win 5840 (DF)
12:47:55.394288 192.168.0.2.38898 > 192.168.0.1.webcache: . ack 3266255188 win 5840 (DF)
12:47:55.394288 192.168.0.2.38898 > 192.168.0.1.webcache: P 0:26(26) ack 1 win 5840 (DF)
12:47:55.564288 192.168.0.2.38898 > 192.168.0.1.webcache: P 26:107(81) ack 1 win 5840 (DF)
12:47:55.594288 192.168.0.2.38898 > 192.168.0.1.webcache: . ack 249 win 6432 (DF)
12:47:55.624288 192.168.0.2.38898 > 192.168.0.1.webcache: . ack 1697 win 8688 (DF)
12:47:55.654288 192.168.0.2.38898 > 192.168.0.1.webcache: . ack 2832 win 11584 (DF)
12:47:55.654288 192.168.0.2.38898 > 192.168.0.1.webcache: F 107:107(0) ack 2832 win 11584 (DF)
12:47:55.694288 192.168.0.2.38898 > 192.168.0.1.webcache: . ack 2833 win 11584 (DF)
12:48:05.664288 192.168.0.2.38899 > 192.168.0.1.webcache: S 866148638:866148638(0) win 5840 (DF)
12:48:05.664288 192.168.0.2.38899 > 192.168.0.1.webcache: . ack 3268716012 win 5840 (DF)
12:48:05.664288 192.168.0.2.38899 > 192.168.0.1.webcache: P 0:26(26) ack 1 win 5840 (DF)
12:48:05.784288 192.168.0.2.38899 > 192.168.0.1.webcache: P 26:107(81) ack 1 win 5840 (DF)
12:48:05.824288 192.168.0.2.38899 > 192.168.0.1.webcache: . ack 249 win 6432 (DF)
12:48:05.854288 192.168.0.2.38899 > 192.168.0.1.webcache: . ack 1697 win 8688 (DF)
12:48:05.884288 192.168.0.2.38899 > 192.168.0.1.webcache: . ack 2832 win 11584 (DF)
12:48:05.884288 192.168.0.2.38899 > 192.168.0.1.webcache: F 107:107(0) ack 2832 win 11584 (DF)
12:48:05.924288 192.168.0.2.38899 > 192.168.0.1.webcache: . ack 2833 win 11584 (DF)
12:48:15.894288 192.168.0.2.38900 > 192.168.0.1.webcache: S 886005603:886005603(0) win 5840 (DF)
12:48:15.894288 192.168.0.2.38900 > 192.168.0.1.webcache: . ack 3271176624 win 5840 (DF)
12:48:15.894288 192.168.0.2.38900 > 192.168.0.1.webcache: P 0:26(26) ack 1 win 5840 (DF)
12:48:16.024288 192.168.0.2.38900 > 192.168.0.1.webcache: P 26:107(81) ack 1 win 5840 (DF)
12:48:16.054288 192.168.0.2.38900 > 192.168.0.1.webcache: . ack 249 win 6432 (DF)
12:48:16.084288 192.168.0.2.38900 > 192.168.0.1.webcache: . ack 1697 win 8688 (DF)
12:48:16.114288 192.168.0.2.38900 > 192.168.0.1.webcache: . ack 2832 win 11584 (DF)
12:48:16.124288 192.168.0.2.38900 > 192.168.0.1.webcache: F 107:107(0) ack 2832 win 11584 (DF)
12:48:16.164288 192.168.0.2.38900 > 192.168.0.1.webcache: . ack 2833 win 11584 (DF)

   <<Less

Re: A new local port is used for each HTTP request. Does this block more sockets on the server?

Posted By:   Jorgen_Nordqvist  
Posted On:   Tuesday, June 4, 2002 05:34 AM

Although I cannot read the tcpdump above, I dare say that what you describe is standard behaviour by a Web server. The server listens to connections on port 80 and, upon connection, will immediately spawn another thread that handles the connection. The spawned thread will use an anonymous socket, that is, a randomly allocated socket by the O/S. When the request has been serviced the thread is terminated and the socket returned to the pool.

You can read more about this and how HTTP 1.1 Keep-Alive affects your socket connections at this URL

Jorgen

About | Sitemap | Contact