Presentation: Servlet vs Reactive Stacks In 5 Use Cases

Track: Java - Propelling the Ecosystem Forward

Location: Broadway Ballroom South Center, 6th fl.

Duration: 11:50am - 12:40pm

Day of week: Monday

Level: Intermediate

Persona: Architect, Developer, JVM, General Software

What You’ll Learn

  • Hear how Spring 5 integrates reactive programming.
  • Learn approaches to developing web applications that leverage Spring MVC and Spring WebFlux.
  • Understand how reactive use cases evolve the servlet model of programming.


In the past year, Netflix shared a story about upgrading their main gateway serving 83 million users from Servlet-stack Zuul 1 to an async and non-blocking Netty-based Zuul 2. The results were interesting and nuanced with some major benefits as well as some trade-offs.

Can mere mortal web applications make this journey and moreover should they? The best way to explore the answer is through a specific use case. In this talk, we'll take 5 common use cases in web application development and explore the impact of building on Servlet and Reactive web application stacks.

For reactive programming, we'll use RxJava and Reactor. For the web stack, we'll pit Spring MVC vs Spring WebFlux (new in Spring 5) allowing us to move easily between the Servlet and Reactive worlds and drawing a meaningful, apples-to-apples comparison. Spring knowledge is not required and not assumed for this session.


Note: This is a portion of a full podcast with Rossen Stoyanchev. You can read the full show notes  and listen to the podcast on You can also subscribe to all future podcasts by following us on our RSS feeds on InfoQ, SoundCloud, or on iTunes.


QCon: What’s the motivation for your talk?

​Rossen: Last year at QCon New York I presented "Intro to Reactive Programming" based on my own experience with building a reactive web framework for Spring Framework 5.​ This year my goal is to use sample code with HTTP endpoints to compare the execution models of a distributed application running on the Servlet API + Servlet container stack to that of an application running on a Reactive Streams + Netty stack. Thanks to the reactive support in Spring Framework 5 we can take a Spring MVC annotated endpoint (with a flexible method signature) and in many cases run the same as a Spring WebFlux (the Spring 5 reactive web framework name) endpoint and then reason about the differences. Note however that this isn't about Spring nor is knowledge of Spring required. It is about understanding the impact of non-blocking and reactive on Java web applications.

To make matters more interesting Servlet vs Reactive is not as black or white as it might sound. Servlet has a non-blocking API which can be bridged to Reactive Streams so you can be fully reactive on Tomcat or Jetty. Furthermore in Spring 5, the Servlet-based Spring MVC provides first-class support for using reactive client libraries such as an HTTP client or a reactive data repository.

There are plenty of existing applications that cannot change immediately and many arguably don't have a strong rason to change. This is why it's important to have a clear and evolutionary path of migration as well as to understand the trade-offs.

QCon: What’s the level & core persona?

Rossen: The main target audience is Java web application developers with some experience in running and scaling applications on Servlet containers (e.g. Tomcat, Jetty) including an understanding of the Servlet container execution model. Non-Java developers as well as non-developers can also benefit from the concepts presented in the talk. These concepts represent important trends in the Java ecosystem. Knowledge of using reactive libraries (e.g. RxJava, Reactor) is helpful but not required.

QCon: What 3 actionable things do you want persona to walk away with?


  • Use reactive libraries in classic Servlet ​container + Servlet API stack web applications
  • Go fully reactive and event-loop driven in Java with Spring 5 and Spring Boot
  • Understand the ​differences in execution models and explain the benefits of the reactive approach
QCon: Is using the term Reactive Servlet application an oxymoron?

Generally speaking yes, the Servlet API was originally created for a synchronous and imperative programming model. Some improvements have been made over time such as Servlet 3.0 async requests that allow for request handling code to become fully reactive with no cost to the Servlet container. Others such as the Servlet 3.1 non-blocking I/O go farther but they can't be used without leaving the rest of the Sevlet API behind. The goal of this session is to illustrate the differences.

Speaker: Rossen Stoyanchev

Spring Framework Committer @Pivotal

Rossen is a Spring Framework committer at Pivotal in NYC. He is deeply involved in the Spring 5 effort to enable reactive programming models starting with a reactive foundation for web applications and extending to data, messaging, and more.

Find Rossen Stoyanchev at

Similar Talks

Software Engineer @Agrilyst
Developer Advocate @Couchbase
Principal Software Engineer @ Vistaprint
Cofounder & CTO, previously Co-Founder & CTO @Gilt
Senior Infrastructure Engineer @Heroku


Monday, 26 June

Tuesday, 27 June

Wednesday, 28 June