Spring Boot Application

infiniSoft Blog > Blog > Solution > Spring Boot Application

Let’s solve task first in Java using Spring Boot framework. We’ll begin with data model class:

public class Name {
    private String firstName;
    private String lastName;

Add business logic:

public class Storage {
    private static final Set<Name> NAME_SET = new HashSet<>();

    public static Set<Name> dispatch(List<Name> names) {
        Set<Name> resp = new HashSet<>();
        Set<Name> temp = new HashSet<>();
        names.forEach(name -> {
            if (NAME_SET.contains(name)) {
            } else {

        return resp;

    public static void remove(List<Name> names) {

    private Storage() {}

Finally, let’s add controller:

public class NameController {
    public Set<Name> namePost(@RequestBody List<Name> names) {
        return Storage.dispatch(names);

    public void nameDelete(@RequestBody List<Name> names) {

Now we’ll build executable JAR file:

./mvnw clean package

If we check size of packaged JAR file we’ll find 17623246 bytes (Spring Boot 2.7.1 and JDK 11.0.4 used.)

Running JAR file allows to test whether application works according to expectations. By default server runs on port 8080. In order to change port we may add --server.port=12345 to command line:

java -jar target/*.jar

Now let’s containerize application. We’ll need to add Dockerfile into project:

FROM openjdk:11-jre
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

Building Docker image from JAR file:

docker build -t infinisoft/dispatcher-java .

Checking image size will show 320MB.

Running container with newly build image:

docker run -p 8080:8080 infinisoft/dispatcher-java

Before load testing application, let’s examine memory used (running docker stats will show 290.7-273.5MiB – size may differ) and then check it manually using Postman.

Repeat query to see that name excluded according to logic of dispatcher:

And now let’s clean up:

Next let’s add JMeter scenario (attached) to populate and clean up dispatcher cache. We’ll run 100 threads in 100 cycles with 1 second ramp-up period.

On completion in 21 second (AMD FX-8320 with 16GB RAM) the docker stats show 439.4-397.1MiB RAM usage (size varies), and Apache JMeter:

Leave a Reply

Your email address will not be published. Required fields are marked *

About This Site

This may be a good place to introduce yourself and your site or include some credits.

Recent Comments


    Find Us

    Mailing Address
    1703 Evans Rd 9108
    San Antonio, TX 78258

    Monday–Friday: 9:00AM–5:00PM
    Saturday & Sunday: 11:00AM–3:00PM