Grokking Spring Boot
0% completed
Lazy and Eager Initialization
We started the booking service twice on one laptop, changing a single setting between the runs, and timed the startup and the first request for a seat map.
| Run | Startup | First GET /events/7/seats |
|---|---|---|
| Default | 4.502 s | 0.182 s |
| Lazy initialization on | 3.071 s | 1.762 s |
The setting moved about one and a half seconds of work out of startup and into the first request. Both runs still did the slow work. The main difference is when one slow bean was created, and who waited for it.
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%