Skip to content

Patrick Uhlmann

Hello World Throughput with Spring Boot

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.

Experiment

I started the application with its embedded webserver (tomcat) like this:

./mvnw spring-boot:run

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 SourceHey WorkersRequests/secAverage duration
same machine as spring boot5010'2130.005s
other host11'5020.0007s
other host5014'3000.0035s
other host10014'4470.0069s
other host20013'6870.0146s
other host30013'6810.0219

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.

Conclusion

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.