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

how many threads to create within a jvm?  RSS feed

 
Nick Faiz
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does one measure how many threads to create within a given jvm, to provide optimal performance?
I ask because Im writing an application that must make a threaded request of SAP for every order number it finds in an database. It seems unreasonable that I allow this to be an open-ended number of threads, even though my employers will never have an infinite amount of orders in their database.
I'm thinking of writing some kind of optimization algorithm using Runtime.freeMemory(), totalMemory() and maxMemory().
Is there a better alternative?
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will have to test to see the optimum number. But this number will change depending on your environment so your software should be configurable in that sense.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!