SBirthare
SBirthare

Reputation: 5137

Web app performance not improved significantly while migrating from Ninject to LightInject

We have a production web application (ASP.NET MVC). The application was developed 2 years ago and used Ninject as DI Container.

Looking at performance results, we got motivated to replace Ninject with LightInject. We have done that in other small web application before so were confident that there won't be any technical roadblocks.

In a separate code branch, we made changes and replace Ninject with LightInject successfully. The web application is running properly utilizing LightInject as a DI container.

Now comes the interesting part, what did we gain?

So I thought to perform a quick (non scientific) performance analysis. So I used Prefix (which is fantastic tool) on my development box and captured timings manually running both version of web app. Ran each page 10 times ignoring first run and average time.

enter image description here

The results are not so encouraging and made me wonder why?

I think there could be following possibility for these results:

  1. Less number of UI pages measured.
  2. Performance measure technique used is manual and not scientific.
  3. The way we have used DI Container in web app, it does not matter much whether to use Ninject or LightInject. If this is the case, we do not want to replace it (as replacement affects full application). To establish this, we need more scientific results.

I thought to use Prefix on server but we host in AWS Elastic Beanstalk.

I just need some performance matrix to establish whether it is worth to switch to LightInject in our case.

Any suggestion on this?

Upvotes: 2

Views: 177

Answers (1)

seesharper
seesharper

Reputation: 3379

You should not expect to see the same difference in performance here as you see in the IoC benchmark. Since there is so much more going on in a web application, it might be tempting to claim that the difference is negligible. That way of thinking might be a slippery slope though. Every added cost will increasingly count for a smaller portion of the total that keeps growing very rapidly. Every millisecond counts. If you take a look at Kestrel, the new web server for .Net Core, extreme measures has been taken to squeeze out maximum performance both with regards to throughput and memory usage. Memory allocations and concurrency efficiency are also very important factors that should be measured.

Upvotes: 3

Related Questions