Hi Bobby,

the Acceptor will spread the load across many threads (where many = nb core +1, so with a 8 core CPU, you will have a pool with 9 threads).

That can be tuned, but the idea is to use the CPU as much as possible.

Note that for an UDP session, it will use the same IoProcessor, so the same thread (sticky thread, sort of)

The ExecutorFilter is your addition, it also use a pool of threads for some other means. It *may* be useful if you have asynchronous I/O that may take some time. Usually, it's rare you need to use a thread pool in the chain: if you already are at 100% CPU use (or close to that), adding more threads are a waste.

On 30/04/2024 04:09, Bobby R. Harsono wrote:
Good day,

I built a UDP Server using Mina, however i need to async'ed several operations; Currently, i have exactly one class extends IoHandlerAdapter called MainHandler, i wrote all of operations in this class.

Now, within Bootstrap building, i notice that there are several points that using Thread(pool),

#1 acceptor = new NioDatagramAcceptor(Executors.newCachedThreadPool());
#2 DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
chain.addLast("threadPool", new ExecutorFilter(Executors.newCachedThreadPool())); #3 Also, my SPV write a class that extends Thread to enable ThreadedMainHandler class (see above)

I can't find clear explanations of what does the different between using thread like the above, i mean, what is the DO and DON'T here;
Did i do this wrong? or maybe i dont need to do one of them?

Currently this application is running well (around 10k TPS per core, so in production, one deployment can handle around 80-100k TPS), however i would like to see the explanations of those points if anyone don't mind

Thanks
Bobby


--
*Emmanuel Lécharny* P. +33 (0)6 08 33 32 61
elecha...@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@mina.apache.org
For additional commands, e-mail: users-h...@mina.apache.org

Reply via email to