On Jul 7, 2006, at 2:46 PM, Austin Lee wrote:
Does anyone know of a good way to go about taking all of an NIO's server requests on the public-facing side and routing them through a SINGLE socket to a backend server?
...
The NIO Server would receive each user's data until it is a full "message" then pass each message to the dedicated backend server asyncronously, through the socket (kind of like a queue).
sure, use MINA :) use an IoFilter to assemble full messages, and in your IoHandler, use an IoConnector to connect to your backend system.
Does anyone know how best to go about doing this? Also, would this be a good approach if I need to do alot of "number crunching" or intensive database access for some requests and I don't want to slow down the NIO's progress on all connections? Or if I need heavy and slow database accesses on certain requests?
sure, it'll work.. but my initial approach might be to just do the work in the IoHandler, and not worry about introducing another system.
by default, by the time the events hit your IoHandler, its running on a thread from the ThreadPoolFilter, thus if you take a little bit of time to do things, you aren't blocking the NIO processing threads. The only drawback to that is if you wanted to be able to process multiple requests from your client in parallel. If you needed to do that, you'd have to do something like your initial idea (although it could be done in a single JVM just by using a queue vs a socket to send stuff out).
-pete -- [EMAIL PROTECTED] - http://fotap.org/~osi
smime.p7s
Description: S/MIME cryptographic signature
