Jack
Jack

Reputation: 761

What should be optimal number of threads in an application?

My application fires only SELECT queries on Oracle DB. I have multiple schema and I am having one thread to read from each schema. Each thread creates its own connection to connect to DB.

When I ran three tests I observed that the performance is best for 8-10 threads and degrades after that on a single core Machine. Does anyone know if there is any reason for that?

Upvotes: 0

Views: 138

Answers (1)

Eugene
Eugene

Reputation: 120858

There is no general rule or a simple math equation for this. Usually the best is one thread per core, but it depends. The only way to tell is by testing your application. Having 8-10 threads on a single core machine in your case is bad, the threads will spent more time in dealing with each other instead of doing actual work.

Upvotes: 2

Related Questions