Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mvc-mini-profiler - working with a load balanced web role (azure et al)

I believe that the mvc mini profiler is a bit of a 'God-send'

I have incorporated it in a new MVC project which is targeting the Azure platform. My question is - how to handle profiling across server (role instance) barriers?

Is this is even possible?

like image 679
Andrew Harry Avatar asked Jul 25 '11 02:07

Andrew Harry


2 Answers

I don't understand why you would need to profile these apps any differently. You want to profile how your app behaves on the production server - go ahead and do it.

A single request will still be executed on a single instance, and you'll get the data from that same instance. If you want to profile services located on a different physical tier as well, that would require different approaches; involving communication through internal endpoints which I'm sure the mini profiler doesn't support out of the box. However, the modification shouldn't be that complicated.

However, would you want to profile physically separated tiers, I would go about it in a different way. Specifically, profile each tier independantly. Because that's how I would go about optimizing it. If you wrap the call to your other tier in a profiler statement, you can see where the problem lies and still be able to solve it.

like image 163
Anže Vodovnik Avatar answered Oct 02 '22 10:10

Anže Vodovnik


By default the mvc-mini-profiler stores and delivers its results using HttpRuntime.Cache. This is going to cause some problems in a multi-instance environment.

If you are using multiple instances, then some ways you might be able to make this work are:

  • to change the Http Cache to an AppFabric Cache implementation (or some MemCached implementation)
  • to use an alternative Storage strategy for your profile results (the code includes SqlServerStorage as an example?)

Obviously, whichever strategy you choose will require more time/resources than just the single instance implementation.

like image 39
Stuart Avatar answered Oct 02 '22 10:10

Stuart