United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7068416 Lightweight HTTP Server should support TCP_NODELAY
JDK-7068416 : Lightweight HTTP Server should support TCP_NODELAY

Details
Type:
Enhancement
Submit Date:
2011-07-19
Status:
Closed
Updated Date:
2013-04-20
Project Name:
JDK
Resolved Date:
2012-08-21
Component:
core-libs
OS:
generic
Sub-Component:
java.net
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Backport:

Sub Tasks

Description
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:
  http://download.oracle.com/docs/cd/E19798-01/821-1794/aeoko/index.html

                                    

Comments
EVALUATION

Yes, a property should be added to support TCP_NODELAY.
                                     
2011-07-19
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
                                     
2011-07-21



Hardware and Software, Engineered to Work Together