Sitecore 8.2 was released with Microsoft Dependency Injection and with the recent release of Sitecore 8.2.1 it was finally time for me to do what I have been promising. I wanted to take an existing solution which was on production using Simple Injector (My Favorite framework), test it again the same solution but with Microsoft DI.
So here is some information:
- Two sites were setup, one for Simple Injector and one for Microsoft DI
- The code is exactly the same, except the DI framework has been swapped out
- No other code changes were made to the code base
- The solution runs on 8.2 rev. 161115 (8.2 Update-1)
- The solution uses Web API calls as well and so the Web API controllers were also registered
- I used Kam‘s ServiceCollectionExtensions and made a change to include Web API controllers with the help of one Mr. Sean Holmesby. The modification is added as a comment on Kam’s Git.
- Each site was isolated to an identical environment
You can refer to my previous blog post to implement Microsoft DI: Microsoft Extensions Dependency Injection (DI) with Sitecore 8.2 Sample Project
I ran the following two tests on both the sites:
While the both tests were running, I took some sample screenshots of the server performance and the current load. I also compared page load times for specific pages. Here are some screenshots.
Results of Test 1
Test 1 – Page Load Times – Simple Injector
Test 1 – Page Load Times – Microsoft DI
Test 1 – Server Performance – Simple Injector
Test 1 – Server Performance – Microsoft DI
Test 1 – Winner – Microsoft DI
Now for test 2!
Results of Test 2
Test 2 – Page Load Times – Simple Injector
Test 2 – Page Load Times – Microsoft DI
Test 2 – Server Performance – Simple Injector
Test 2 – Server Performance – Microsoft DI
Test 2 – Winner – Microsoft DI
Over all with Microsoft DI, the server performance was much better. Needless to say that I will be using Microsoft DI. Hope Sitecore can update the Microsoft DI version in the upcoming versions.
If you have any questions or concerns, please get in touch with me. (@akshaysura13 on twitter or on Slack).