This example implements a simple weather REST service using Spring Boot (JAR).
$ mvn package
$ java -jar target/spring-weather-jar-1.0.0.jar
$ mvn spring-boot:run
$ docker build -t spring-weather-jar:1.0.0 .
$ docker run -it --rm --cpus 2 --memory 512m -p 8080:8080 -p 9090:9090 spring-weather-jar:1.0.0
$ curl -X GET http://localhost:8080/api/weather\?city\=Rosenheim
{"city":"Rosenheim","weather":"Sunshine"}
$ curl -X GET http://localhost:8080/
$ curl -X GET http://localhost:8080/metrics
$ curl -X GET http://localhost:8080/health
Assuming you have started InfluxDB and Grafana using Docker Compose from the root of this repository, you can now start the K6 load test for the weather service.
$ k6 run -u 50 -d 60s src/test/k6/spring-weather.js -o influxdb=http://localhost:8086/k6
$ k6 run -u 100 -d 120s src/test/k6/spring-weather.js -o influxdb=http://localhost:8086/k6
$ k6 run -u 0 -s 10s:100 -s 100s -s 10s:0 src/test/k6/spring-weather.js -o influxdb=http://localhost:8086/k6