⚡️ TL;DR
If you deploy both on the same servlet container (e.g. Tomcat) and hit the same business code, peak throughput and latency are practically identical.
The real differences are in:
Startup time
Memory footprint
Configuration overhead/flexibility
So choose:
• “Bare” Servlet/Jakarta EE → when you need the smallest footprint, ultra-fast startup, and you’re OK writing boilerplate.
• Spring Boot → when developer productivity, rich ecosystem, and operational features outweigh a few MB of RAM and a few hundred ms at boot.
─────────────────────────────────────────
What exactly are we comparing?
Spring Boot is NOT an alternative servlet engine; it’s a framework that auto-configures one (Tomcat, Jetty, Undertow) plus a large set of Spring libraries. So performance comparisons boil down to:
• Plain servlet app on Tomcat vs.
• Spring MVC app on Tomcat (inside Spring Boot executable JAR/WAR)
Why so close? After the first few filter/dispatcher layers, both hit the same business code, same GC, same JIT. The extra method calls in Spring’s DispatcherServlet add micro-overhead that is usually lost in network IO and DB calls.
Startup & footprint
| Metric | Plain Servlet | Spring Boot (MVC) |
|--------|---------------|-------------------|
| Startup time (cold, default settings) | ~0.4 s | 1.2–2.0 s |
| RSS memory after boot (no caches, JDK 17) | 40–60 MB | 90–140 MB |
Why higher? Classpath scanning, condition evaluation, and ~250 Spring beans. You can trim that (see tips below).
Concurrency model
• Classic servlet API (blocking I/O) – both cases when you use Spring MVC.
• Want higher concurrency with fewer threads? Use Spring Boot + WebFlux (reactive & non-blocking) on Netty. That really changes the performance story (higher throughput under high latency back-end calls), but it’s a different programming model than plain servlets.
Tuning Spring Boot if you care about performance
code
# application.properties
spring.main.lazy-initialization=true # create beans on first use
spring.mvc.async.request-timeout=5s # protect against slow back-ends
spring.datasource.hikari.maximum-pool-size=20 # DB tuning example
management.endpoints.web.exposure.exclude=* # disable if not needed
Gradle/Maven:
xml
<!-- Remove starters you don’t use -->
<dependencyManagement>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-tomcat</artifactId></exclusion>
</exclusions>
</dependency>
</dependencyManagement>
Other ideas
• Switch embedded Tomcat → Undertow (lighter, async).
• Enable class-data-sharing (CDS) and -XX:+UseContainerSupport.
• Build native image with GraalVM + Spring AOT: <100 ms startup, 40–60 MB RSS.
When plain servlets win
• Ultra-low memory devices (IoT, function-as-a-service with 128 MB limits).
• Legacy application servers where introducing Spring jars is forbidden.
• Highly specialized apps where you control every filter/servlet and want zero unused code.
When Spring Boot wins
• You need Actuator, metrics, health checks, tracing, security, etc., out of the box.
• Fast prototyping / frequent requirement changes – auto-wires new libs in minutes.
• Team skills align with Spring ecosystem (most of today’s Java developers).
🚀 Rule of thumb
You’ll spend far more CPU waiting for DB/network than in Spring’s dispatching logic. Choose the stack that increases dev speed and keep an eye on JVM/GC tuning, SQL, and caching—those deliver orders-of-magnitude gains versus framework micro-optimizations.
Need a concrete recommendation for your project? Feel free to share traffic patterns, memory limits, startup SLA, and we can do a more tailored checklist.