> 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.

How this will help to avoid herd effect? It is expected to have
requests to the same database from several different clients, and,
thus, sessions.

> 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.

That's it. For example, I have 2 databases and 2 thread for each DTB1
and DTB2 with two queues for these threads: DTB_Q1 and DTB_Q2.
In this situation I need only a single separate thread which handles
incoming requests from all possible sessions and determines the queue
to place query on. This thread is very fast and it is always
available. DTB1,2 are very slow. So, for a database I will always have
a single point of query source (DTB_Q1,2) which eliminates herd
effect.

So, is there a more graceful solution with Mina to do that?

Reply via email to