• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java threads and concurrency issue

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 1093
29
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic