Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mvc-Mini-Profiler: Why so many X-MiniProfiler-Ids?

I'm using Mvc-Mini-Profiler (what a great product!). Using my ordinary web browser everything seems to work fine but as soon as I use my own http client (basic http 1.1 without cookie support) the amount of X-MiniProfiler-Ids in the http header increases. This happens quite rapidly and becomes quite many in a short amount of time (11kB and above of data).

Can the lack of cookies make Mvc-Mini-Profiler work this way or could anything be wrong with my implementation?

like image 770
m__ Avatar asked Aug 25 '11 10:08

m__


People also ask

What is MiniProfiler for MVC?

Abstract: Profiling MVC production code at runtime can often be tough, messy and a performance hog. MiniProfiler created by the Stack Exchange team is an easy-to-setup-and-use profiling library for ASP.NET MVC and Entity Framework.

How to use MiniProfiler profiler to detect Ajax calls?

Run the application now and you’ll see the profiler indicator come up. As you can see, there are two little divs on the top. Miniprofiler automatically detected the AJAX call and added separate profiling information for the AJAX call. Expanding it shows us the Ajax query and the time it took to do the query.

Where do I find the results of a mini-profiler?

The default is mini-profiler-resources, so the results would be available at /mini-profiler-resources/results. With this setting, the result is available at /profiler/results. Time to define our traces! When you fire up the application, a MiniProfiler object is created and shared across the project.

How to install MiniProfiler in ASEP MVC?

First, create an application in ASEP.NET MVC 4, right-click on the project, and choose “Manage NuGet Packages..” to install MiniProfiler for ASP.NET MVC application. As we can see with the below screenshot, we have searched for MiniProfiler.MVC and are going to install the second one, “MiniProfiler.Mvc4”.


1 Answers

This is by design I think. Though we could improve the implementation a bit.

The X-MiniProfiler-Ids need to be "consumed", they only show up when profiling is enabled. The reason it works this way is so you can profile POST and redirects.

We probably should set some clear upper limit there (like 20 or so) - please post a bug for that.

However, since you never really plan to consume any profiling blocks for you HTTP client, I would recommend abandoning profiling if the useragent is your HTTP client.

You can do this by adding a conditional before:

// don't run if UserAgent is "my http client"
if(notMyUserAgent)
   MvcMiniProfiler.MiniProfiler.Start();  
like image 76
Sam Saffron Avatar answered Sep 18 '22 06:09

Sam Saffron