The goal of this repository is to provide a reduced number of applications that are able to show Quarkus key points concisely while comparing it to a traditional Spring application:
- spring-rest-api is built with Spring. It provides a REST API and persists data on a PostgreSQL database;
- quarkus-rest-api is built with Quarkus in an imperative way and it's very similar to spring-rest-api. It provides a REST API and persists data on a PostgreSQL database;
- quarkus-reactive-rest-api is built with Quarkus in a reactive way. It provides a REST API, persists data on a PostgreSQL database, generates an OpenAPI specification while providing a representation using Swagger UI and generates metrics on OpenMetrics specification while providing a representation using Prometheus.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Java 11
Maven 3.6.1
Docker 19.03.5
$ docker network create book-store-network
Generate fat .jar:
$ mvn clean package spring-boot:repackage
Build docker compose w/ database and application containers:
$ docker-compose build
Run docker compose w/ database and application containers:
$ docker-compose up
Run with live reload (test and dev purposes):
$ mvn compile quarkus:dev
Generate fat .jar:
$ mvn clean package
Or generate native executable:
$ mvn clean package -Pnative -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-native-image:19.3.1-java11
Build docker compose w/ database, migrations, monitoring and application containers:
$ docker-compose build
Run docker compose w/ database, migrations, monitoring and application containers:
$ docker-compose up
Run Apache Bench stress tests:
$ ab -n 10000 -c 10 http://localhost:8080/api/v1/books
If you don't have Apache Bench, run the following Docker container:
$ docker run --rm jordi/ab -n 10000 -c 10 http://localhost:8080/api/v1/books/
Useful endpoints:
- POST http://localhost:8080/api/v1/books
- GET http://localhost:8080/api/v1/books
- GET http://localhost:8080/api/v1/books/{id}
- PUT http://localhost:8080/api/v1/books/{id}
- DELETE http://localhost:8080/api/v1/books/{id}
- GET http://localhost:8080/health (only on Quarkus applications)
- GET http://localhost:8080/metrics (only on Quarkus applications)
- GET http://localhost:8080/open-api (only on Quarkus applications)
- GET http://localhost:8080/swagger-ui (only on Quarkus applications)
Access Prometheus:
- GET http://localhost:9090 (only on Quarkus applications)