This repo contains two projects:
test-api- simple Spring Boot servlet based app to act as a "Downstream API"test-client- Spring Boot servlet based app with multiple Http Client configurations to consume 'test-api'
The below diagram depicts the setup (Running Prometheus is optional)
- Clone this repo
- Start
test-apiin one terminal windowcd test api ./gradlew bootRun - Start
test-clientin another terminal windowcd test-client ./gradlew bootRun - (Optional) Start Prometheus, see below for more info
- Run a test, samples below (the later 2 require autocannon)
- Single Request:
curl localhost:8081/rc/test/0 - Parallel Requests:
./parallel.sh 2- send two parallel requests - Load test:
./load-test.sh
- Single Request:
- Download Prometheus for your OS.
- Update
prometheus.yml- adding a snippet in thescrape_configsto scrape from the Prometheus Actuator in the config file:scrape_configs: - job_name: 'spring boot scrape' metrics_path: '/actuator/prometheus' scrape_interval: 5s static_configs: - targets: ['localhost:8081']
- Start prometheus
- Load Console: http://localhost:9090/targets - make sure you see 'spring boot scrape'
- Check out the Prometheus page for some queries
