[undertow-dev] few questions about undertow and asych nature

Jason Greene jason.greene at redhat.com
Mon May 5 18:10:54 EDT 2014


On May 4, 2014, at 2:51 PM, S Ahmed <sahmed1020 at gmail.com> wrote:

> Hello,
> 
> I have a few questions I was hoping someone could clarify some things for me.
> 
> 1. Undertow is asych by nature like netty etc., are there currently libraries that are asych when you need to connect to popular services like mysql (hibernate), memcached, and redis?

For data stores just about everything out there involves blocking. There are some experimental non-blocking drivers, but most of them are just doing threads under the hood which isn’t better than a blocking solution, since Undertow provides you a way to do that already.

Regardless of whether or not you need blocking activity, Undertow’s non blocking behavior can efficiently handle inactive connections, and you can also mix in pure non blocking aspects. For example, you can cache common static info in your application, or hardwire routing rules in a non blocking fashion. Undertow’s proxy capability is also completely non-blocking.

> 2. If there are no libraries for #1, is it common pracitise to then create a seperate thread pool and somehow execute blocking queries in a seperate thread pool?

If you are implementing a handler, you can do this:

  exchange.startBlocking();
  if (exchange.isInIoThread()) {
     exchange.dispatch(this);
  } else {
     this.handleRequest(exchange);
  }

Otherwise you can use the servlet API and get blocking behavior as well (without the non blocking .

> 
> 3. are there any big names using undertow currently or is it a very fresh framework that is just getting started?

It’s still relatively new. However, WildFly (previously known as JBoss Application Server) is based on Undertow, so it does get heavy usage.

--
Jason T. Greene
WildFly Lead / JBoss EAP Platform Architect
JBoss, a division of Red Hat




More information about the undertow-dev mailing list