Honesty Rocks! truth rules.

Java Multithreading Issues

HOME      >>       Programming

longer

So we have a web based application running on JBoss on several clustered servers. The front end of the application is using jms to communicate with the middleware MDB, which communicates with other backend application servers. The application runs well when only a few requests are submited. However, when requests boost to couple thousands, the app starts to crash. The log files shows a concurrency issue with the ThreadPoolExecutor. When we set the core size pool to one the issue was solved. Looks like we have concurrent issue of multiple threads accessing same resource simultaneously. We have to look into it for a better solution. Maybe synchronizing the method that accesses the same resource will be a better solution. Any suggestions?


xico

So we have a web based application running on JBoss on several clustered servers. The front end of the application is using jms to communicate with the middleware MDB, which communicates with other backend application servers. The application runs well when only a few requests are submited. However, when requests boost to couple thousands, the app starts to crash. The log files shows a concurrency issue with the ThreadPoolExecutor. When we set the core size pool to one the issue was solved. Looks like we have concurrent issue of multiple threads accessing same resource simultaneously. We have to look into it for a better solution. Maybe synchronizing the method that accesses the same resource will be a better solution. Any suggestions?



Hello,

Synchronizing methods is the simplest way to solve this problem. But if your system performs many I / O operations is better you use the class SynchronousQueue.
Check out this link SynchronousQueue to use a LIFO for waitingTakes and see if it´s what you are expecting.

Best Regards.

longer

Hello,
Synchronizing methods is the simplest way to solve this problem. But if your system performs many I / O operations is better you use the class SynchronousQueue.
Check out this link SynchronousQueue to use a LIFO for waitingTakes and see if it´s what you are expecting.

Best Regards.


This is pretty good option. We don't have too many I/O operations in the app that's why we decided to use LinkedBlockingQueue<Runnable>. Maybe we should try synchronization statement and SynchronousQueue to see the performance difference. Thanks for your suggestion.