Hail to the New King… or Not?

Is there a new leader in a Java town?

Tomek Zaremba
Sep 1, 2020 · 9 min read
Image for post
Image for post

Where each journey begins

New cool kids on the block

Benchmark

Application features

@RestController
@RequiredArgsConstructor
public class ExampleController {

private final ExampleService service;

@GetMapping(path = "/api/hello")
public Message hello() {
return service.blockingHello();
}

@GetMapping(path = "/api/cities")
public Cities cityByCountryCode(@RequestParam("country_code") final String countryCode) {
return service.findCitiesByCountryCode(countryCode);
}
}
@Service
@RequiredArgsConstructor
public class ExampleService {

private final CityRepository repository;

@SneakyThrows
public Message blockingHello() {
Thread.sleep(100);
return new Message("Hello!");
}

public Cities findCitiesByCountryCode(final String countryCode) {
var cities = repository.findAllByCountryCode(countryCode).stream()
.map(City::from)
.collect(Collectors.toList());
return new Cities(cities);
}
}

Competitors

Benchmark scenario

class QuarkusVsSpringBootBenchmark extends Simulation {

private val warmupStrategy = List(
constantUsersPerSec(1) during (3 minute)
)

private val constantUsersStrategy = List(
constantUsersPerSec(5) during (10 minutes)
)

private val spikeStrategy = List(
rampUsersPerSec(0) to 8 during (20 minutes)
)

private val loadStrategies = Map(
"WARMUP" -> warmupStrategy,
"CONSTANT" -> constantUsersStrategy,
"SPIKE" -> spikeStrategy
)

// rest of the setup ommitted
...

val scn: ScenarioBuilder = scenario("Benchmark")
.repeat(scenarioRepeatCount) {
exec(http("/hello")
.get("/hello"))
.pause(3)
.exec(http("/cities")
.get("/cities?country_code=NLD"))
.pause(2)
}

setUp(scn.inject(loadStrategies.getOrElse(strategyName, warmupStrategy)).protocols(httpProtocol))
}
#!/bin/bash

// variables setup ommitted
...

echo "Running warmup..."
export BENCHMARK_STRATEGY_NAME=SINGLE
./bin/gatling.sh -rd "warmup ${image_tag}"

echo "Running test 1/2..."
export BENCHMARK_STRATEGY_NAME=CONSTANT
./bin/gatling.sh -rd "test 1/2 ${image_tag}"

echo "Running test 2/2..."
export BENCHMARK_STRATEGY_NAME=SPIKE
./bin/gatling.sh -rd "test 2/2 ${image_tag}"

Show time

Round #1

Image for post
Image for post
Round #1 summary

Round #2

Image for post
Image for post
Round #2 summary

Round #3

Image for post
Image for post
Round #3 summary

Round #4

Image for post
Image for post
Round #4 summary

So now what?

But is it a silver bullet?

The Startup

Medium's largest active publication, followed by +755K people. Follow to join our community.

Tomek Zaremba

Written by

Full time dad, in free time Java Developer

The Startup

Medium's largest active publication, followed by +755K people. Follow to join our community.

Tomek Zaremba

Written by

Full time dad, in free time Java Developer

The Startup

Medium's largest active publication, followed by +755K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store