java socket vs tcp stack parameters in XP

A

antoine

Hello,

I'm running a java application on my XP Pro box that should send
messages to a server.

I use a regular java socket, and all is fine on this side. all messages
are sent and received with no problem.

however, when I analyze the traffic with a sniffer, I can see that, for
example, when sending 3 messages in a row (writing 3 the 3 messages on
the socket, but with very little interval time < 1ms), then:
- the FIRST message is sent immediatly on the wire
- the SECOND and THIRD messages are sent TOGETHER, but roughly 100ms
AFTER the first one.

it looks like the box is waiting for some kind of TCP ACK or heartbeat
before sending the second and third messages.

I've looked into ways of improving this, and read a few things about
TCP/IP stack tuning on solaris (tcp_naglim_def), but have found very
little info about XP tcp stack tuning apart from modifying the window
size.

would anybody know of a good reference to find a solution to this
problem ?
would you know which tcp parameters are tunable on XP, and how ?
what are tcp_deferred_ack_interval ? tcp_nodelay ?
any help would be greatly appreciated...

thanks !

Antoine.
 
S

Sudsy

I use a regular java socket, and all is fine on this side. all messages
are sent and received with no problem.

however, when I analyze the traffic with a sniffer, I can see that, for
example, when sending 3 messages in a row (writing 3 the 3 messages on
the socket, but with very little interval time < 1ms), then:
- the FIRST message is sent immediatly on the wire
- the SECOND and THIRD messages are sent TOGETHER, but roughly 100ms
AFTER the first one.

it looks like the box is waiting for some kind of TCP ACK or heartbeat
before sending the second and third messages.
<snip>

Too bad about your platform. I did a "man setsockopt" which led me to
"man 8 tcp" which led me to RFC1122. Pay particular attention to section
4.2.3.4 which discusses Nagle's algorithm...
 
E

Esmond Pitt

antoine said:
it looks like the box is waiting for some kind of TCP ACK or heartbeat
before sending the second and third messages.

Not quite, it is coalescing packets up to a timeout when there is an
outstanding ACK. This is the Nagle algorithm, and it is an important
TCP/IP optimization. You can turn it off if you want but your throughput
will drop significantly if your writes are small.
 
A

antoine

messages are small, but client & server are on the same LAN, so I
believe throughput should not be an issue...

do you know how to turn the nagle algorithm off on XP ?
or better yet, do you know how I could modify the timeout ? simply
setting it to a lower value should be sufficient, no ?
 
S

Sudsy

messages are small, but client & server are on the same LAN, so I
believe throughput should not be an issue...

do you know how to turn the nagle algorithm off on XP ?
or better yet, do you know how I could modify the timeout ? simply
setting it to a lower value should be sufficient, no ?

Again, with the information you've been provided to date you should
have been able to find the answer in your system documentation.
Look for a socket option usually named TCP_NODELAY.
This is something you should have been able to discover on your own.
Are you not familiar with the term RTFM? Did you not perform your
own search on the archives? Should we have provided the precise
search terms?
Sheesh!
 
E

Esmond Pitt

antoine said:
messages are small, but client & server are on the same LAN, so I
believe throughput should not be an issue...

do you know how to turn the nagle algorithm off on XP ?
or better yet, do you know how I could modify the timeout ? simply
setting it to a lower value should be sufficient, no ?

Socket.setTcpNoDelay(). Setting it to TRUE *disables* Nagle's algorithm.
Use with great care.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top