You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Mladen Turk <mt...@apache.org> on 2005/02/05 13:59:24 UTC

Tomcat Native example

To whom it may concern:

I've committed the example for Tomcat Native that acts
as simple Echo server.
Well, it does not echo anything, but that's not the point.

Here is how it works.
It creates two threads 'Acceptor' and 'Poller'.
The Acceptor is standard blocking acceptor that waits for
any new connection.
When the connection arrives it launches a new 'Worker' thread
that reads the input in standard blocking mode.
When the Workers finds the LF char, it treats this
as end-of-transaction (like HTTP request with keep-alive).
It does not close the client connection, but rather
passes the socket to the 'Poller'.
The Poller then waits for the first byte received on that
socket, thus offering the non-blocking keep-alive.
When the event occurs the Poller launches the Worker with
already connected socket (like next keep-alive request).

That's about it.
Although being only the proof of concept it shows that
both BIO and NIO models can be combined together, thus offering
much greater scalability, without NIO's event latency.

Regards,
Mladen.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org