Java refresh across Microservices

jdk11 Dec 29, 2021

JDk11 Definition :

JDK11 was officially released with general availability on Sept 2018, by Oracle with Long term support releases every 3 years with host of new features like modularisations , new APIs added , HTTP client libraries , Z Garbage collection , Flight recorder and TLS 1.3 support to name a few along with notable security improvements across board .

JDK11 Purpose of migration :

Currently at halodoc most backend services are written in Java using jdk8 , which is quite outdated in terms of LTS (upto 2026) ,Oracle announced that it would no longer provide any updates for jdk8  and other dependencies used in various services needed to be updated which do not support jkd8 itself  and application would become rigid in terms of using latest versions available in market hence as a step forward to build resilient systems moving out of jdk8 was absolutely necessary.

JDK 11 was the best candidate for upgrade from jdk8 as going above 11 would be far easier and less worrisome as oracle has pitched in LTS for jdk11 as indefinite. Upgrading from jdk 8 -> jdk 17 would potentially result in issues which would be difficult to resolve not knowing what version has broken from LTS supports available between jdk 8 -> 17 such as jdk 11.

JDK11 Stand out features :

Parellel Full GC for 1st Gen:

Initially in jdk 8, Garbage collection used to happen via single threads and even if we enabled more  hardware jdk would still process GC in single threads which would increase CPU time eventually.

jdk 10 onwards parallel garbage collection is made available which garbage collects  much faster and reduces CPU time and application by making use of all the resources made available for this.


We noticed CPU time used for GC collection reduced by 3 times

jdk 8:



Since jdk 9, modularisation has been added as a feature which essentially means that we can add another layer of aggregation above packages called module which has to be uniquely named to group together relatable packages and resources that helps developers to make code more reusable , enable multiple developers to work on different modules and eventually combined  through an interface to create a suite.

However it's important to note that this is not mandatory to use while upgrading to jdk 11 from 8 and can be implemented going forward.

HTTP client:

HTTP client is now standardised to support both 1.1 and 2.0 versions and has native support for websocket.

Fully asynchronous which previously has support for only one thread per request/response.  

send() method waits until response is received until X amount of time

sendAsync() method does not wait for response and a CompletableFeature<HttpResponse> is returned .

Send and receive multiple responses and requests using sendAsync method .

Flight recorder :

Since java 9 , Java Flight recorder has been made available however was not available on the OpenJDK versions but since jdk 11, both Flight recorder and Java mission control are now open source , which enabled developers to debug and troubleshoot issues such as OOM by providing data around GC cycles , memory usage without having to stop or terminate a running JVM by making recording available on demand in dump.jfr format.

This feature not only permits local debugging but also helps debug remote applications on demand and for particular intervals.

Enable JFR:

We can enable JFR on the fly by using jcmd utility which sends requests to an already running JVM:

The above would run JFR for 30 seconds and dump to output file.

The above JFR file can be further analysed using Java Mission Control Client which automatically analyses and produces reports in the following format:

Way forward

With upgrade of jdk11 being done, we now plan to upgrade our other dependencies and have the following roadmap:

ActiveJpa removal :

With the advent of modularisation feature in jdk 9 onwards, Frameworks such as activeJpa needs to be removed as shown in snippet below the way activeJpa renders the tools.jar  is offending because to support Java Modularity feature, Java 9 onwards, tools.jar is not supplied.

Implementation of Micronaut:

Currently java backend @Halodoc used dropwizard extensively, which we plan to implement micronaut which is loaded with features such as dependency injection using annotation processors, uses Aspect oriented programming without reflection resulting in fast startup and reduced memory foot print.

In this blog, we gave an overview of upgrading to jdk11 from older versions such as jdk8 with notable differences in both dev features and future prospects of scale.

Scalability, reliability and maintainability are the three pillars that govern what we build at Halodoc Tech. We are actively looking for data engineers/architects and  if solving hard problems with challenging requirements is your forte, please reach out to us with your resumé at

About Halodoc

Halodoc is the number 1 all around Healthcare application in Indonesia. Our mission is to simplify and bring quality healthcare across Indonesia, from Sabang to Merauke.
We connect 20,000+ doctors with patients in need through our Tele-consultation service. We partner with 1500+ pharmacies in 50 cities to bring medicine to your doorstep. We've also partnered with Indonesia's largest lab provider to provide lab home services, and to top it off we have recently launched a premium appointment service that partners with 500+ hospitals that allows patients to book a doctor appointment inside our application.
We are extremely fortunate to be trusted by our investors, such as the Bill & Melinda Gates foundation, Singtel, UOB Ventures, Allianz, Gojek and many more. We recently closed our Series B round and In total have raised USD$100million for our mission.
Our team work tirelessly to make sure that we create the best healthcare solution personalised for all of our patient's needs, and are continuously on a path to simplify healthcare for Indonesia.

Gaurav Mehta

Backend Engineering