On 9/7/11 11:48 AM, Antonio Rodriges wrote:
The overall idea is to avoid request processing bottleneck by allowing
a separate thread to process it (taken from a dedicated, say "worker"
pool) and releasing current IoProcessor thread for incoming events
(not for the same session).
This situation occurs when the server using Mina needs to perform a
database query to another machine to retrieve a result. The query may
take long time while the server may continue to accept user queries.At
the same time to control the number of queries for a particular
database, the idea is to create a separate thread with its own queue
intended to be executed onto that database. This is primarily to avoid
herd effect when there are several different clients competing for the
single database.
Okie, clear.
Add an executor in your filter chain, but be careful : if you have to
deal with concurrent requests on the same session, then use a
OrderedThreadPoolExecutor.
You can add this executor at the last position in your chain.
Note that you may have trouble if some requests are very slow, because
you will have many threads running in parallel.
Also keep in mind that there is a backlog of incoming requests, so you
won't usually lose any requests. The only problem is that one costly
request will slow down all the others.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com