Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.

Performance of Multi-threaded Applications

Dost__Conrad_W
Beginner
584 Views

I have an multi-threaded application in which runs 20% slower on my MacBook Pro with two threads than one. I checked for blocking conditions and found that this is not the problem. The application is huge and accesses a huge in memory database so the cache doesn't have that much effect on performance. So I figure the problem is that this machine does not have enough memory bandwidth to support two threads that access a lot of memory.

An example would be where each thread accesses a 2 GB array with reads and writes to random locations. It finishes after 32 gig writes to the array so logically 2 threads would finish in half the time as one if there was sufficient bandwidth for the required memory accesses. Are there Intell based machines where this is true? How about with more threads and cores?

0 Kudos
3 Replies
Patrick_F_Intel1
Employee
584 Views
Hello Conradca, There is not really enough information to debug what the problem might be. It is easy with threading to make an app slower. Usually DB apps don't max out the memory bw. Usually (in my experience), the memory accesses are more random and having more threads improves application performance. Random memory accesses expose the memory latency and go pretty slow, so having more random memory accesses outstanding can usually be easily handled. I don't know how to debug MacOS applications. My guess would be to check system stats for the 1 thread vs 2 threads cases. For instance, are there more disk operations in the 2 thread cases? You might try disabling hyper-threading... just an easy thing to try. Is the performance reproduceably 20% slower? I would probably check with the creator of the software and ask them about how to effectively enable more than 1 thread. If the 2nd thread doesn't really have any work to do, it might just add overhead. Hope this helps, Pat
0 Kudos
SergeyKostrov
Valued Contributor II
584 Views
>>It is easy with threading to make an app slower. Usually DB apps don't max out the memory bw. Usually (in my experience), the memory >>accesses are more random and having more threads improves application performance... I agree with Patrick and you really need to provide more technical details on your system. If a Virtual Memory is used in your case when '...each thread accesses a 2GB array with reads and writes to random locations...' it could significantly affect (!) an overall performance of your application. However, you could think that a memory bandwidth limits / affects the performance. Based on my tests ( multiplication of very large matricies ) when large amounts of memory are used ( 2GB and more ) a performance of an application is significantly lower as soon as the Virtual Memory is used. The only solutions are more memory or a faster computer.
0 Kudos
SergeyKostrov
Valued Contributor II
584 Views
>>...I have an multi-threaded application in which runs 20% slower... A performance degradation in my case ( described in a previous post ) was greater than 200%. So, it was too slow.
0 Kudos
Reply