# Native OpenJDK slower than on linux?



## emko (Apr 3, 2017)

Hello,

I have a Java (Spring)-powered website which I'd like to host on a FreeBSD virtual server.

On my development machine the JRE (Oracle JRE 8.121) and the Spring container (embedded Tomcat) starts in 7s mean time. Good.

On Ubuntu Server 16.06 with OpenJDK 8.121 it starts in 10s mean time. Good for virtual server with one Xeon E5 core and 1GB RAM.

The same server with FreeBSD starts this site in 17s mean time with OpenJDK installed by pkg (it's version 8.111 I believe). When I installed newer version (8.121?) from the ports its start up time was around 16s. And the performance of the application was 30-50% worse. When I installed the Oracle version 8.121 from ports (running through the Linux compat layer) it had the same performance as on Linux.

Am I possibly missing something or is it "normal" that OpenJDK performs worse on FreeBSD than on Linux, please?


----------



## Remington (Apr 3, 2017)

I run Tomee and Resin with OpenJDK 8.121.13.  Tomee takes about 3 to 4 seconds to startup.  Resin takes 7 seconds.  The only difference is that I build OpenJDK from source using ports-mgmt/poudriere.

Are your FreeBSD and packages up-to-date?


----------



## emko (Apr 6, 2017)

Yes, they are up-to-date. I built a physical machine to test it. Startup on FreeBSD was 3s slower (7 vs 10) and run-time performance difference was negligible. So probably it's about the virtualization.

Thank you.


----------



## chunlinyao (Dec 29, 2018)

I build a large project by ant, with native openjdk8u192, build time is 3m11s, with adoptopenjdk8u192 under linux emulator, build time is 2m40s. Don't known the reason.


----------



## the_snark (Jan 10, 2019)

It could be that the systems calls used in OpenJDK are optimized for how Linux works rather than FreeBSD. The slowdown _might be_(among a host of potential other reasons) due to how OpenJDK was ported to FreeBSD.


----------

