Skip to content
Advertisement

JAX WS Server implementation performance issue for Linux JVM?

I’ve faced with a very weird problem. The built-in JAX WS server implementation works 100 times slower on linux machines then on Mac OS X or Windows.

I’ve created and shared a JMH test: https://github.com/Andremoniy/linuxjvmjaxwstest

Basically it does the following:

  • starts a JAX WS with one SOAP method:

    endpoint = Endpoint.publish(“http://localhost:8888/“, new FooServiceImpl());

  • 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 me:

# 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

I’ve tried docker openjdk:8u151 as well as OracleJava. I’ve also tried to run it on VirtualBox Ubuntu 16.04, on AWS EC2 Ubuntu instance – on linux machines it is always around ~20 ops/s.

But when I change server implementation to Jetty:

    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();

the difference between performance on linux and other OS’s disappears. That means that there is some bug in builtin HTTP Server implementation for JRE/OpenJDK for Linux. Or am I missing something?

Advertisement

Answer

This was admitted as a bug by the Java Developer Support team:

https://bugs.openjdk.java.net/browse/JDK-8193236

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement