Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java threads and concurrency issue  RSS feed

 
Romeo Perez
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible to tune Java threads to handle up to 1 million concurring blocking jdbc calls assuming we have all the hardware and database components ?

For example if a program had 5,000 threads and each task takes 250ms to complete then that would be equal to 25,000 tasks/concurrency per second and it would take roughly 40 seconds to get through 1 million concurring tasks?


Thanks for reading, i am new to Java threading but haven't had a chance to ask questions and clear my misconceptions.
 
Les Morgan
Rancher
Posts: 752
17
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is going to depend on your ability to load balance: distribution of request across a server farm and the ability for the OS to take the hand offs, so your going to have a software requirement in there besides your Java.

btw: 250ms per transaction is 4 per second (optimum) and 5000 executing threads, that is 20,000 per second. or 50 seconds to complete your 1 Million tasks.
 
Campbell Ritchie
Sheriff
Posts: 53773
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
Henry Wong
author
Sheriff
Posts: 22846
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Side note. Your database request is taking too long, so the plan is 5000 threads to put 5000 times the load on the database.

This is probably okay for the JVM as the requests are mainly blocked waiting for the database... but... what about the database? Have you tested it with 5000 times the load?

Henry
 
Romeo Perez
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Les Morgan appreciate the answer and glad that I found this site Campbell Ritchie. Hey Henry I have checked for the query speed and it comes back at 250ms it is a complex query. It is however un-optimized and I do expect it to finish under 100ms once I can optimize it completely.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!