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

First use of HttpClient.Builder.build() is slow

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • 11.0.14-oracle, 17.0.2
    • core-libs
    • x86_64
    • linux_oracle_7

      On an OEL7 system with Intel(R) Xeon(R) Platinum 8167M CPU @ 2.00GHz CPUs, this test code:

      long start = System.currentTimeMillis();
      HttpClient.Builder bldr = HttpClient.newBuilder();
      HttpClient client = bldr.build();
      long time = System.currentTimeMillis() - start;
      System.out.printf("Client built in %d%n", time);

      shows that the build() call takes over 300ms. This is a significant overhead if used in a command line tool where a single client is used.

      Tested with JDK 17.0.2 and 11.0.14.

            michaelm Michael McMahon
            revans Richard Evans
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: