This is a playground for learning kafka in Spring boot Open in gitpod
The gitpod will do this step automatically.
Add hosts manually
echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
The gitpod will do this step automatically.
Install the java manual
sudo apt-get install -y openjdk-11-jre
The gitpod bwill do this step automatically.
Install the Maven manual
sudo apt-get install -y maven
Hey is the tool for the load testing, similar to the ab tool of Apache.
The gitpod will do this step automatically.
Install Hey manually
sudo apt-get install -y hey
Using docker-compose to start the kafak (Zookeper, kafka borker, kafka UI).
docker-compose up -d
To start the spring-boot service: use the mvn
mvn spring-boot:run
To send a single request:
# simulate a 10s duration job
curl -H "Content-Type: application/json" -d '{"duration":10}' http://localhost:8080/mail/job
To send a numbers of the request
hey -n ${total-request} -c ${concurrent} -m POST -d '{"durtion": ${dur_in_second}}' -H "Content-Type: application/json" http://localhost:8080/mail/job
#example to send 1000 request with 10s job
hey -n 1000 -c 100 -m POST -d '{"durtion": 10}' -H "Content-Type: application/json" http://localhost:8080/mail/job
gp url 8080
gp url 8081