09-14-2005 09:32 AM
This is my question.
I have to build a Java based database middleware, it holds database connection, the no of middleware worker threads are equal to the no of database connections ( This is because, the no of concurrent database operation we can do on database is limited to the database connections). Any request coming in the system are queued and supplied to the worker theread if they are available.
In a scenario like this how can i take advantage of hyper thereading.
If I have a 4 processor " Then I will have 8 Virtual Processor ", then can i have 8 database connections, and 8 worker thereads as the ideal setup, will it work effectively.
09-19-2005 02:36 PM
You can have 16 or 32 threads. More threads than processors can be beneficial in some situations, but will rarely give perfect efficiency. So, keeping the number of threads equal to the number of processors is a good idea.
HT has been shown to yield up to 30% better performance on some real-world applications. This usually takes the form of increased throughput. That is, two 5-second tasks may take 8 seconds to complete both, which is 20% faster than running the two in serial, but longer than the 5 seconds running one task by itself.
If your database users can stand to get slower individual results, but more of them in a given amount of time, HT and one thread per logical processor may be a viable solution. Of course, HT may give no computational advantage, depending on the calculations that are made. In this latter case, one thread per physical processor should give the best performance.
You will need to test both run-time scenarios and determine what performance level is significant to the users of your system in order to make the call about whehter HT and more threads should be used.