I wondered how many request a simple hello world endpoint would be able to serve with Spring Boot out of the box.
By default Spring Boot uses Tomcat and the setting server.tomcat.threads.max defines the number of threads available for concurrent request handling. By default up to 200 threads can handle requests.
I used my playground application for the tests. My hardware: Dell XPS 13 9343 with 8 GiB memory and a core i7-5500U.
I started the application with its embedded webserver (tomcat) like this:
Then I used a simple load test tool hey:
hey -z 1m -c 50 http://localhost:8080
The parameter z indicates that it should generate requests for one minute, the parameter c indicates that it should use 50 concurrent workers.
|Load Source||Hey Workers||Requests/sec||Average duration|
|same machine as spring boot||50||10'213||0.005s|
I guess the request from another host were faster as less CPU switching between hey and the spring boot application had to take place.
It is also interesting to see that the peak throughput was reached with between 50 to 100 workers. More workers did not increase the throughput. When observing the CPU usage at the host running the Spring boot application I observed that it was already fully loading all CPUs with 50 requests. A stronger machine could probably handle more requests.
As long as the request is simple and needs few processing more than 10'000 requests per second can be handled even by weaker machines.