Profiling your RavenDB MVC application
Your application is starting to take shape and you want to be able to quickly see what’s going on when using RavenDB.
Step forward the in-built profiling dll which is very easy to set up and get going with, lets implement that along with MiniProfiler.
- Add the Nuget package MiniProfiler.RavenDb to your application
- Add the Raven.Client.MvcIntegration dll which can be found in the Client folder when you download the source for RavenDB
- Add the following to your global.asa.cs file:-
[sourcecode language=”csharp”] protected void Application_BeginRequest()
and then :-[sourcecode language=”csharp”] protected void Application_EndRequest()
- Add the following to your global.asa.cs file in the Application_Start event:-
- Lastly add the following lines into your _Layout.cshtml file in the Shared folder, under Views:-
That’s it – you have now adedd the built in profiler and MiniProfiler for RavenDB, run your application and you can
see that in the top left hand corner you can view the details of whats going on in both profilers:-
MiniProfiler for RavenDB looks like this:-
while with the RavenDB profiler we see something like this:-
The in-built profiler from RavenDB shows us how long the query took, the status, result, Method, Url, Query and Actions as well as the actual request details.
All in all both profilers are very hand and very easy to install – go get them installed.