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

JAX WS builtin Server implementation is very slow on Linux

XMLWordPrintable

    • x86_64
    • linux

      FULL PRODUCT VERSION :
      openjdk version "1.8.0_151"
      OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-1~deb9u1-b12)
      OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux c0ab5270bb70 4.9.49-moby #1 SMP Wed Sep 27 23:17:17 UTC 2017 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      The built-in JAX WS server implementation works 100 times slower on linux machines then on Mac OS X or Windows. JMH test is published here: https://github.com/Andremoniy/linuxjvmjaxwstest

      Basically it does the following:
      1) starts a JAX WS with one SOAP method:
      endpoint = Endpoint.publish("http://localhost:8888/", new FooServiceImpl());
      2) performs client requests to this method:
      String result = state.client.foo(state.foo);

      On Mac OS X with 2 Cores Intel Core i7 it gives:

      # JMH version: 1.19
      # VM version: JDK 1.8.0_151, VM 25.151-b12
      # VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre/bin/java
      ...
      Result "test.openjdk.MyBenchmark.testMethod":
        3077.813 ±(99.9%) 51.818 ops/s [Average]
        (min, avg, max) = (1718.347, 3077.813, 3315.271), stdev = 219.400
        CI (99.9%): [3025.995, 3129.630] (assumes normal distribution)

      # Run complete. Total time: 00:06:49

      Benchmark Mode Cnt Score Error Units
      MyBenchmark.testMethod thrpt 200 3077.813 ± 51.818 ops/s

      The same machine, docker without CPU limitations:

      # JMH version: 1.19
      # VM version: JDK 1.8.0_151, VM 25.151-b12
      # VM invoker: /usr/java/jdk1.8.0_151/jre/bin/java
      ...
      Result "test.openjdk.MyBenchmark.testMethod":
        19.882 ?(99.9%) 0.169 ops/s [Average]
        (min, avg, max) = (10.031, 19.882, 20.104), stdev = 0.715
        CI (99.9%): [19.714, 20.051] (assumes normal distribution)

      # Run complete. Total time: 00:07:01

      Benchmark Mode Cnt Score Error Units
      MyBenchmark.testMethod thrpt 200 19.882 ? 0.169 ops/s

      The situation changes if JAX WS server is started with Jetty (there is no performance issues):
          ContextHandlerCollection contextHandlerCollection = new ContextHandlerCollection();
          server.setHandler(contextHandlerCollection);

          JettyHttpServerProvider.setServer(server);
          HttpContext context = new JettyHttpServerProvider().createHttpServer(new InetSocketAddress(8888), 5).createContext("/");

          Endpoint endpoint = Endpoint.create(new MyBenchmark.FooServiceImpl());
          endpoint.publish(context);

          server.start();

      Please, refer also: https://stackoverflow.com/questions/47645817/jax-ws-server-implementation-performance-issue-for-linux-jvm

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      On linux machine (for instance, docker pull openjdk:8u151)

      git init
      git clone https://github.com/Andremoniy/openjdkjaxwstest
      mvn package
      cd target
      java -jar benchmark.jar

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The performance should be the about 3000-5000 ops/s.
      ACTUAL -
      The performance is about 20 ops/s.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      https://github.com/Andremoniy/linuxjvmjaxwstest
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use Jetty server for publishing WS.

            zli Zheng Jun Li (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: