Jump to content
xisto Community
Sign in to follow this  
longer

Java Multithreading Issues

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.