Spring Boot Web with Tomcat alternatives

Although Tomcat is the most common application server it also tends to add some overhead to a small microservice. Lets have a look at the alternatives.

Tomcat Alternatives

There are at least 2 alternatives for a Spring Boot Web application server: Jetty and Undertow. In this blog I use Undertow because

  • it is leightweight (< 1Mb)
  • it has Servlet 3.1 support
  • it offers Web sockets

Replace Tomcat

In the following example I will show you that only 2 changes are necessary to replace the default Tomcat:

  1. Add the Undertow dependency
  2. Exclude Tomcat from the spring-boot-we

Undertow settings

An additional advantage of using Spring Boot is the configuration by using Spring configuration files. Here is an example application.yml with some server settings:

  port: 8080
    ioThreads: 16
    workerThreads: 150
      enabled: true
    enabled: true
    mimeTypes: text/xml, text/css, text/html, application/json
    minResponseSize: 4096


Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.