Blog
To Thread or not to Thread – Optimizing Integrations with Microsoft CRM
[img src=”/wp-content/uploads/2015/05/clock-on-track-300×200.jpg” class=”alignleft xs-aligncenter”]
We love to customize Microsoft Dynamics CRM solutions here @Beringer. We’ve been working with Microsoft Dynamics CRM since its inception, and we’re always finding innovative ways to integrate it with foreign systems. One of the challenges when ensuring data stays up to date is identifying and overcoming bottlenecks. Memory, CPU and Disk speed can contribute to a slow integration, but we typically see internet latency as the primary bottleneck. When an integration sends a request to a remote system, it usually waits idle until it receives its data. In these scenarios, it is very efficient to utilize that time by threading your integration. Why? Because threading can take advantage of that idle time by building and sending another request.
How does threading work? Take a look at my first example, and you’ll see I’m looping thru 10 different requests in a synchronous manner. The first request must fully complete before it moves onto the second request. My results show that this method takes 50.12 seconds.
[img src=”/wp-content/uploads/2015/11/Untitled-1-300×127.gif” class=”aligncenter”]
Let’s introduce threading into my second example, where we will now thread the same 10 requests in an asynchronous manner. Each request can now start as soon as there is an available CPU core available to process it. My results show that this method takes only 8.3 seconds to complete, which is 6 times faster than the non-threaded method.
[img src=”/wp-content/uploads/2015/11/Untitled-2-300×134.gif” class=”aligncenter”]
If I could scale my test system and had 10 available CPU cores, I could cut that time down to just above 5 seconds!
You can use this same approach in your integration, even if you are reading data from a SQL database or the Microsoft CRM API.
[img src=”/wp-content/uploads/2015/11/Untitled-3-300×31.gif” class=”aligncenter”]
You should always actively monitor your environment for optimal performance. It is possible to over implement threading, which can cause too much overhead and provide diminishing returns. In these scenarios, you can manually scale back the amount of threads by setting the Max Degree Of Parallelism.
If you are looking for a certified Microsoft solution partner to help you with your CRM installation, make sure you pick the one that keeps in sync with all of the latest technologies.
Can we help you with your CRM integration? Please feel free to contact us.