Development / Kubernetes / Microservices / Sponsored / Contributed

How Vodafone Greece Built 80 Java Microservices in Quarkus

27 Apr 2021 8:22am, by

Alex Handy
Alex is a technical marketing manager at Red Hat. In his previous life, he cut his teeth covering the launch of the first iMac, before embarking upon a 20-plus year career as a technology journalist.

If you started programming in the past decade, your first programming language probably wasn’t Java – and the likelihood that new developers learn Java as their first language is falling every year. While it remains the third most popular language in the world, the days when Java was the first language of computer science education and boot camps has definitely passed by already.

Programmers today are raised on mobile devices, JavaScript and cloud-based deployments. But what if you were raised on these things, but then tossed back into the Java world? How would you find your way back to reactive, event-driven programming environments and highly scalable containers?

Tossed into Java

When Christos Sotiriou came to Vodafone Greece to become the company’s Backend Chapter Lead running a development team, he’d already had over a decade of experience programming. He’d already worked with C++ and Objective C, then had learned Java while getting his master’s degree. But he’d more recently been developing professionally in JavaScript and for iOS; Vodafone was a Java shop. It’d be hard for that not to feel like a bit of a setback, as Java is not exactly the most modern and dynamic development environment.

Sotiriou really appreciated the hardware constraints of the iPhone, and the immediate feedback and reactivity of JavaScript. Java applications could be a bit less elegant in their usage of RAM and CPU time and when you made a change to an application, that application had to compile before the change could be seen, unlike in JavaScript.

Transitions at Vodafone Greece

When Sotiriou joined Vodafone Greece in 2018, his team consisted of only 2 people. Today it’s nearing 40. With so many people on-boarding to the team, and the impetus to expand the company’s microservices cluster beyond 10 services, Sotiriou had his work cut out for him.

Today, that team hosts 140 microservices on their cluster — showing just how much they’ve accomplished. Here’s how Sotiriou and his team made this leap.

Finding the Right Tools

Sotiriou realized he needed tools and techniques that could do the heavy lifting. One tool Sotiriou chose to help bring that more dynamic Node.js-like development experience to his team was Vert.x, the Eclipse project which enables reactive applications on the JVM. Vert.x also helps to reduce overhead for the Java apps it’s used with, as it provides more efficient execution, allowing for greater cluster density.

Revamping Dev Feedback

Sotiriou also wanted to find a way to make the development process offer more feedback to its developers in a faster loop. His experience with JavaScript gave him an appreciation for being able to see code changes enacted quickly, showing the developer whether what they changed worked or not. Additionally, the event-driven programming model of Node.js enables quick programmatic responses to things that happen in the environment.

“I saw from my previous experience what it means to have a reactive environment, and what it means to have multithreading, and how that impacts an application. It taught me how to use threads. How iOS uses threads plays a role in how you program, and how you perceive that. My Node.js experience taught me why Node changed the industry as we see it today,” said Sotiriou. “With Node.js you can make a reactive app, and one event loop does everything. This came into play. Before that, we had a very different view of how threads operate.

“Having this experience, and having worked both environments, when it came to the point where I had to decide how to use a technology, I chose to invest a bit more time into how things work under the hood, and microservices have something in common with my previous experience. Everything I’ve done to this point was built around working in constrained environments with very little ram and very little CPU.”

Improving Boot Time

There was another problem with all of those Java applications — boot time. Vodafone Greece was run on Kubernetes inside Amazon Web Services. As the system was built on containers, and whenever a new marketing campaign was sent out to customers via SMS, that system had to endure large traffic spikes as users reached out to take advantage of the marketing efforts.

Unfortunately, said Sotiriou, every time a traffic spike occurred, the system would incur a pause as it booted new containerized Java applications to meet demand. The boot time for these containers was prohibitive and could lead to a waste of marketing effort (as users failed to get through to buy a new product in a timely fashion).

To shorten boot time, though, Sotiriou knew that more optimization was necessary. Sotiriou said that his experience with mobile platforms taught him how to optimize applications to perform with smaller memory and CPU footprints. But when it came to Java, much of that work had already been performed by the team. The Java Spring Boot apps had effectively been optimized as much as possible at the JVM and application levels.

Optimizing Java Applications: Evaluating Quarkus

Sotiriou wanted more. In the spring of 2019, he and his team began evaluating Quarkus, the Kubernetes native Java stack. Quarkus is based on Vert.x, and while it was just nearing completion at the time, Sotiriou said that even as an incomplete product in 2019, the team could see the advantages very clearly.

After initial tests indicated that Quarkus would reduce application boot times, reduce CPU and memory usage, and make the entire development process run faster, Sotiriou and his team decided to port their most essential libraries and microservices to this new stack. Then, they would use it to build all of their new microservices. Older, less essential services would no longer be developed and ported forward to Quarkus as needed.

They started with their internal libraries, moving them to Quarkus so that the other applications that depended on them would be easier to port. Eventually, Red Hat’s migration toolkit for applications would add specific guidance for Spring Boot to Quarkus migrations, further easing the transition for Vodafone Greece. They also decided not to use the Quarkus Spring extensions, which make porting SpringBoot applications even easier — Sotiriou wanted these new applications to be pure Quarkus.

How Sotiriou’s Team Uses Quarkus Today

Today, Sotiriou’s team has ported over 10 business-critical SpringBoot microservices to Quarkus. These applications boot faster and require less resources to run, lowering the overall AWS bill for the cluster. The cluster is far healthier overall, as well, as it is no longer experiencing difficulty in handling the sudden traffic spikes driven by the company’s direct marketing campaigns. The team also eliminated about 30% of its Java code, overall, as Quarkus is able to help remove unnecessary and unused code.

The company now has 80 Quarkus microservices running in production with another 50-60 Spring microservices remaining in maintenance mode and awaiting a business motive to update. Vodafone Greece’s success wasn’t just because of Sotiriou’s technology choices — he also cited organizational transitions the company made to encourage collaboration.

“There is also a very human aspect in this. It was a risk, and we knew it was a risk. There was a lot of trust required for the team, and such a big amount of trust percolated into organizing a small team around the infrastructure that would later become the shared libraries or common libraries. When we decided to do the migration, the most important thing was not to break the business continuity. The second most important thing was that if we wanted to be efficient long term, we’d have to invest in development and research. We wouldn’t be able to do that if we didn’t follow a code to invest part of our time into expanding our server infrastructure,” said Sotiriou.

That was extra important for a team that scaled from two to 40 in just under three years. Selecting the right people and building a culture of trust and rapid, dynamic development was also a huge part of the success.

If you’re curious about Vodafone Greece’s migration journey, check out this fireside chat from Quarkus:

Featured image via Pixabay.

A newsletter digest of the week’s most important stories & analyses.