Diagnose your ASP.Net MVC application using Glimpse

Glimpse is an open source free diagnostics platform through we can understand our web applications performance and diagnose key areas of our code. Glimpse gives a intuitive UI through which we can examine server execution times, server configuration, in/out data etc., which will help us to improve performance of our application. More over getting started with glimpse is very easy, one can get a Glimpse report fairly in 3 quick steps.

Lets get started by creating a MVC4 Web application in Visual Studio 2012. Right click Solution, select “Manage Nuget Packages..”. Search for Glimpse and install its MVC4 nuget.

image

Installation adds the following entries in Web.config file, we can go with the default settings without doing any modifications.

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
  <!-- If you are having issues with Glimpse, please include this. It will help us figure out whats going on. 
    <logging level="Trace" />-->
    <!-- Want to use Glimpse on a remote server? Ignore the LocalPolicy by removing this comment.
    <runtimePolicies>
      <ignoredTypes>
        <add type="Glimpse.AspNet.Policy.LocalPolicy, Glimpse.AspNet"/>
      </ignoredTypes>
    </runtimePolicies>-->
</glimpse>
<httpModules>
   <add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" />
</httpModules>
<httpHandlers>
   <add path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" />
</httpHandlers>
<section name="glimpse" type="Glimpse.Core.Configuration.Section, Glimpse.Core" />

It also adds up GlimpseSecurityPolicy.cs, which can be used for setting up custom runtime policy for Glimpse.

Now to view Glimpse performance report, start the application by click F5. Navigate to /Glimpse.axd, Click Turn On.

image

 

Once done, navigate back to the application and you should be seeing a Glimpse bar at the bottom of the page.

image

 

That’s it, we got started with Glimpse. To get more detailed analysis, we can mouse hover on the bar which will slide up the bar and shows more information.

image

Now we can start analyzing different parameters to check performance of our application. Click on Glimpse icon at the end of the bar. That will bring detailed statistics of the Request and Response.

Check out code execution times as below –

image

 

Check out timeline of the complete code execution flow –

image

 

Request server variables available in the Request menu –

image

 

History of all the page inspections through glimpse are showed in History tab (can be found at the top right).

image

 

We can also explore Server Configuration through Configuration tab, Routes can be analyzed using Routes tab. Similarly all other tabs can be explored.

To close the Glimpse window, there was a shutdown button at the top right corner. To popup Glimpse window, there was a button right next to shutdown window. also we can minimize Glimpse window to be a bar, by clicking the Minimize button (3rd button from right to left).

Hope you guys found Glimpse platform interesting, Happy Coding.

You may also like...