New server on the block

JBoss unveil new nonblocking web server Undertow

Chris Mayer

JBoss have unleashed the first beta of a new lightweight web NIO web server.

Two months on from a
radical name change to WildFly, the application server formerly
known as JBoss AS has a new “high performance” and “nonblocking”
server standing alongside it.

Revealed by project lead Stuart Douglas
, the web server Undertow contains HTTP
upgrade support, which means Java developers are able to allow
multiple protocols to be multiplexed over the web port, without
losing any performance. Douglas also promised support for
WebSockets, including the recent Java EE 7 JSR 356, and the ability
to mix handlers in Servlet 3.1.

Douglas explained that Undertow “starts in
milliseconds” either embedded in an application or standalone, and
contains “a fluent builder API for building deployments,” making it
ideal for unit testing.

Although this is the first beta, performance
appears to have been on the agenda from the start. Third party
benchmarks, conducted by Tech Empower, show that Undertow
outperforms rival Java web servers, including Netty and Gemini,
when testing

plain text
responses for Hello World (shown

“One of the goals of Undertow was to have great
performance and I am happy to say so far we have surpassed our own
expectations,” Douglas added.

Listing: Hello World example

public class HelloWorldServer {

   public static void main(final String[] args) {
       Undertow server = Undertow.builder()
               .addListener(8080, "localhost")
               .setDefaultHandler(new HttpHandler() {
                   public void handleRequest(final HttpServerExchange exchange) throws Exception {
                       exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
                       exchange.getResponseSender().send("Hello World");

Undertow has a “composition-based architecture”
meaning developers can build a web server from single purpose
handlers. The 1MB core jar for Undertow keeps it in line with
JBoss’s penchant for lightweight projects. At runtime, the team
claim a simple embedded server uses less than 4MB of heap

Undertow is the new default web server in
and the team advise this as the best method of getting your hands
on it. They’re also looking for
contributors and others to join the mailing

Image courtesy of versageek

comments powered by Disqus