Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6973660

HttpURLConnection with keepAlive has slow turnaround

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • 7
    • core-libs
    • generic
    • generic

      When the number of host connections is at maximum then the turnaround between connections (the time it takes from the end of one connection to getInputStream() returning on a subsequent connection is high. We observed 200-300ms on windows against a server on the same host. If lots of small fast connections are being used then this turnaround is a major cost. We would also like the ability to query the number of existing connections to a host, the number of idle connections to the host and whether the connection limit for the host has been reached.
      This behaviour occurs when using a local connection pool of http 1.1 keepalive connections. The problem refers to an unexpectedly high latency establishing a connection in a specific case. The case in question is when the local connection pool for a host has reached the maximum number of connections (usually 5). In this case the time between the completion of one request and the initiation of the next request increases unexpectedly. Testing methodology is; set up a servlet that provides two services. One service slowly returns a 1MB response very slowly, 1 byte every 100ms ("slow"). The second service provides 1k of data as quickly as possible ("icon") Start a thread which repeatedly calls the "icon" service. Start additional threads which call the "slow" service". If the total number of threads reaches the host connection limit a slowdown will be observed for the "icon" thread and it will experience much higher latency latency between requests. The inter-request latency for the "icon" thread will jump from 15-40ms to 200-300ms when the local connection pool limit is reached.

            chegar Chris Hegarty
            mduigou Mike Duigou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: