Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Feb 1998 21:13:57 -0500 (EST)
From:      Alex Boisvert <alex@gel.usherb.ca>
To:        Iyer Mahadevan <iyer@internetdevices.com>
Cc:        java@FreeBSD.ORG, saurabh@internetdevices.com, freebsd-java@FreeBSD.ORG, java-port@FreeBSD.ORG
Subject:   Re: Socket IO problems using Java Sockets on FreeBSD
Message-ID:  <Pine.BSF.3.95q.980223210235.3627A-100000@teel.info-noire.com>
In-Reply-To: <34F1F777.BEC2F180@internetdevices.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 23 Feb 1998, Iyer Mahadevan wrote:
> I noticed some serious performance problems with Java Socket I/O.
> 

You problem is due to a "feature" in the kernel...  There's an algorithm
in the kernel (Nagle's algorithm) which buffers outgoing data up to 200
miliseconds before sending a packet.  The reason for this is to reduce the
number of packets sent (little fragments of data).

There are two ways to deal with this problem.  First, you can use a
BufferedOutputStream on your Socket and make sure that you call flush()
after a request to the server to make sure that your data is sent right
away (not after an idle network period of 200 ms)

The second alternative (which I have never tried), is to use the
TCP_NODELAY option of sockets which completely disables the
fragmentation-reduction algorithm.  Have a look at the SocketOptions class
in java.net.*   This is a new feature implemented in JDK 1.1.x.

I don't know why Nagle's algorithm is the default...  This may be
platform-specific.  Anyway, this shows up on Windows NT as well.

Regards,
Alex Boisvert



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95q.980223210235.3627A-100000>