JDK-7068416 : Lightweight HTTP Server should support TCP_NODELAY
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-07-19
  • Updated: 2017-05-19
  • Resolved: 2012-08-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
6u30Fixed 7u2Fixed 8 b01Fixed
It has been noticed that there is a perceived delay in response from the Lightweight HTTP Server implementation that ships with the JDK, compared to other production HTTP Servers. The cause for this delay has been identified as the Nagle algorithm buffering the response data until there is sufficient data ( not always the case especially for headers ), or a timeout occurs that triggers the data to be sent.

This CR is requesting that a property be provided to allow applications to effectively set the TCP_NODELAY socket option on sockets being used by the server, i.e. disable Nagle. This is similar to what other production HTTP servers provide. For example, see:

EVALUATION A new property, sun.net.httpserver.nodelay, was added to control the TCP_NODELAY socket-level option. All socket connections accepted by the server will disable the Nagle algorithm with this option set. It can be enabled as follows: java -Dsun.net.httpserver.nodelay=true .... JDK8 changeset: Changeset: 70ec3aa8e99a Author: chegar Date: 2011-07-21 17:28 +0100 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/70ec3aa8e99a 7068416: Lightweight HTTP Server should support TCP_NODELAY Reviewed-by: alanb, michaelm ! src/share/classes/sun/net/httpserver/ServerConfig.java ! src/share/classes/sun/net/httpserver/ServerImpl.java ! test/com/sun/net/httpserver/Test1.java

EVALUATION Yes, a property should be added to support TCP_NODELAY.