简体   繁体   中英

ThreadPool communication

We are working on a n-tire system where there are +10 modules available, and each module does a certain work.
each module has own thread pool and thread manager.
The whole system is running on JBoss AS, and some modules uses native codes ( pthread for native guys)
Everything is looks perfect except we have recently found that one of the modules works very slow at a certain time(peak time), the reason is because there are to many works for the module, I also checked and realized whole of the thread with that related module thread pool is working.
but while a modules is working hard, another module is kinda idle, or not so busy.
QUESTION:
Is it possible that borrow threads from thread pool a to thread pool b and get back the borrowed threads after the hard work?! I worked to much with ExecutorService , but it didn't help, or at least I couldn't understand how to do that.
please help, thanks.

Amount of threads has little to do with workload distribution.

If one of the modules is the bottleneck, and your machine is saturated, you have to implement your own mechanisms which will ensure that this module is using the most resources at given time.

A simple way would be to monitor the amount of data awaiting processing in the critical module and pausing work of other modules if it exceeds a certain threshold.

Other way is to implement a priority queue for all data, where data is prioritized based on its type and the time it has already waited in the queue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM