I am writing a server, and I send each action of into a separate thread when the request is received. I do this because almost every request makes a database query. I am usi
I've written a number of heavily multi-threaded apps. I generally allow the number of potential threads to be specified by a configuration file. When I've tuned for specific customers, I've set the number high enough that my utilization of the all the CPU cores was pretty high, but not so high that I ran into memory problems (these were 32-bit operating systems at the time).
Put differently, once you reach some bottleneck be it CPU, database throughput, disk throughput, etc, adding more threads won't increase the overall performance. But until you hit that point, add more threads!
Note that this assumes the system(s) in question are dedicated to your app, and you don't have to play nicely (avoid starving) other apps.