Spring Boot 4 Performance in Practice
Twenty-eight chapters of profiling and tuning a Spring Boot 4 application until it runs 50 times faster. Covers every layer from JVM heap sizing and GC tuning to HikariCP, database query optimization, Kafka throughput, and capacity planning math. Uses real tools: JFR, async-profiler, k6, Gatling, and EXPLAIN ANALYZE.
What you'll learn
Using Java Flight Recorder and async-profiler to find what is actually slow
Load testing with k6 and Gatling to measure real throughput under pressure
Tuning G1 and ZGC garbage collectors with real pause budgets
Virtual threads in Spring Boot 4: the honest use case and the traps
HikariCP pool sizing and connection lifecycle
Caffeine and Redis caching strategies compared under load
Reading EXPLAIN ANALYZE for Hibernate-generated queries
Kafka producer and consumer tuning for high throughput
Little's Law and capacity planning from first principles
Table of Contents
Measurement
- 01 Latency is a cliff, not a gradient
- 02 Micrometer timers and histograms in Spring Boot 4
- 03 Java Flight Recorder in anger
- 04 async-profiler and reading flame graphs correctly
- 05 Load testing with k6
- 06 Load testing with Gatling
JVM
- 07 Garbage collectors in Java 21: G1 vs ZGC
- 08 Heap sizing, region sizing, and pause budgets
- 09 JIT, tiered compilation, and warmup in long-running services
- 10 Native memory, direct buffers, and off-heap caches
Concurrency and I/O
- 11 Virtual threads in Spring Boot 4: when they win and when they don't
- 12 Thread pools: Tomcat, @Async, Scheduler
- 13 HikariCP and the pool-sizing formula
- 14 Reactive with WebFlux: an honest benchmark
Caching and Serialization
- 15 Caching with Caffeine
- 16 Caching with Redis
- 17 HTTP/2, keep-alive, and response compression
- 18 Serialization on the hot path
Database
- 19 Reading EXPLAIN ANALYZE for Spring Boot queries
- 20 Hibernate performance patterns
- 21 Indexing strategies for CinéTrack queries
- 22 PostgreSQL tuning for read-heavy Spring Boot apps
Kafka and Scale
- 23 Kafka producer throughput tuning
- 24 Kafka consumer concurrency and backpressure
- 25 Queueing theory: Little's Law and the utilization-latency curve
- 26 Capacity planning and cost per request
- 27 GraalVM native image: honest trade-offs
- 28 CinéTrack at 50x: the final benchmark and retrospective