Is Java Really Faster Than Go?

Is Java Really Faster Than Go?

Is Java Really Faster Than Go? Earlier I blogged that Go is better than Java. I wanted to start from some earlier work, to prove to my colleagues that Go is as fast as Java and quick to start up. Speed is critical for serverless since the process can be stopped.

Learning about performance differences between microservices written in Java and Go will help you plan the language you choose when building your own services.

Researching Earlier Java/Go Benchmarks

Earlier I  blogged that Go is better than Java, but it lacked evidence and datapoints. I wanted to start from some earlier work, to prove to my colleagues that Go is as fast as Java and quick to start up. Speed is critical for serverless since the process can be stopped when not in use and started again from cold to serve a request!

So after searching  https://dzone.com/ for “Java Go” comparisons I was surprised to find a benchmark article by Ivan Nikitsenka (original author) at the top of results:

Which concluded that Java can serve twice as many simultaneous users  as the Go application.

WHAT?

Is that true?! Can Java’s lazily just-in-time compiler be faster than a Go static binary?! Can I reproduce his results!?

Reproducing the Results

To the original author’s credit, he publishes the source of his Java and  Golang application as well as  how he tested with Jmeter, his results AND how to run it all on a neutral playing ground of  AWS via Cloudformation!

I ran it locally on my T14s Thinkpad and indeed the Go application was erroring compared to the “springboot” Java app. Despite the bank-go image weighing in at 10.2MB compared to the 991MB image size of bank-java and consuming a lot less resources whilst running:

Java running with docker statsGo running with docker stats

java tutorial golang go postgres

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).

Going Beyond Java 8: Local Variable Type Inference (var) - DZone Java

In this article, we will talk about the most important new feature introduced with Java 10, officially called local variable type inference. An extremely important function in java. You will regret skipping this article.

Go vs Java: Is Golang Better Than Java? | A Detailed Comparison

Comparing Google's Go vs Java | Learn the differences and similarities between these programming languages. Which is better in 2020? Go vs Java comparison

Go Tutorial (Golang) - Looping Constructs in Golang | Golang For Loop

In this video we will see the Looping Constructs in Golang. Golang For Loop. Go is an open source programming language which was originally developed by Google. In this Go Tutorial we will Learn Go from the Basics with Code Examples. Go is a statically-typed language.

Java Tutorial for Beginners | Java Tutorial | Java Programming | Core Java Tutorial | Learn Java

This "Java Tutorial for Beginners" Full course will help you master all the major concepts in java such as Arrays, Polymorphism, Abstraction, Inheritance, and Collections.