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

Performance issue seen with HttpURLConnection.setFixedLengthStreamingMode()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • None
    • 7u40
    • core-libs
    • x86_64
    • linux

      FULL PRODUCT VERSION :
      java version "1.7.0_60"
      Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
      Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux localhost 3.11.10-100.fc18.x86_64 #1 SMP Mon Dec 2 20:28:38 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      When the fixedContentLength is set with HttpURLConnection.setFixedLengthStreamingMode(),
      sun.net.www.protocol.http.HttpURLConnection.getOutputStream() is about 6 times slower than the jdk7u25 with fixedLengthStreamingMode is enabled. I checked several jdk7 version , this is introduced since jdk7u40.

      REGRESSION. Last worked in version 7u25

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1 connection.setFixedLengthStreamingMode(length);
      2. connection.getOutputstream()
      3. compare the getOutputStream with jdk7u60 , jdk7u40 and jdk7u25


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      jdk7u60 can get same performance with jdk7u25 to getOutputStream with fixedLengthStreamingMode enabled.
      ACTUAL -
      jdk7u60 is much slower than jdk7u25 to getOutputStream from HttpURLConnection.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
               HttpURLConnection connection = (HttpURLConnection)url.openConnection();
              connection.setRequestMethod("POST");
              connection.setDoInput(true);
              connection.setDoOutput(true);
           
              connection.setFixedLengthStreamingMode(requestBody.length());
              
              connection.setRequestProperty("Content-Type", "text/xml; charset=UTF-8");
              connection.setRequestProperty("Accept", "*/*");

              connection.connect();
              long start = System.currentTimeMillis();
              OutputStream outputStream = connection.getOutputStream();
              long end = System.currentTimeMillis();
      ---------- END SOURCE ----------

            robm Robert Mckenna
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: