mardi 31 octobre 2017

How to decide the number of thread in a thread pool

In a java web project, users send their tasks to the web. To handle these tasks, I use a thread pool that contains 10 threads to handle their tasks. Every task will be built to a thread and send to the thread pool. The thread pool is designed to a static variable, which means that all of the tasks(threads) share the same thread pool.
Today, 200 users come to my web and then, they complained that their tasks ran very very slow...

  • are The threads in the static thread pool is too few? Maybe the number should be 30? 50 ?
  • Maybe I shouldn't use a static thread pool?
  • Maybe I shouldn't use a thread pool, since there are lots of tasks, I can just taskThread.start() ?



Aucun commentaire:

Enregistrer un commentaire