I’ve spent some time in the last weeks playing with different ASP.NET and ASP.NET MVC Applications. Using dynaTrace I created a Technology Package that covers all different aspects of ASP.NET Development, Testing and Production Monitoring:
- Tracing of ASP.NET Web Requests
- Tracing of Unit, Web- and Load-Tests executed by Visual Studio, NUnit, XUnit, …
- Out-of-the-Box configuration for the ASP.NET Development Web Server, IIS and the above mentioned Test Runners
- Insight into ASP.NET, ASP.NET MVC, ASMX Web Services, Exceptions, ADO.NET
The dynaTrace Community can download the ASP.NET Technology Package on the dynaTrace Community Portal. It comes with a set of Sensor Packs, a System Profile with different configurations and 3 Dashboards.
Overview of MVC Controller and Action activity
The following dashboard shows the activity on the controllers and the actions within the controllers. It also shows which of the controllers/actions contribute how much to the overall performance. Another aspect that is shown is the usage of HtmlHelper Extension methods
The above dashboard shows me as an MVC Developer what is actually going on in my system, for instance:
- I can see that my Tag action is contributing almost 30% to the overall performance
- I can see that my Category action is the most popular action on my website with almost 50% of the overall execution count
- It also seems that I make extensive use of the GenerateLink extension method which totals to 37 seconds in execution time of my 2 minutes test run
- In fact – 25% of the overall execution time is spent in the MVC Extension Methods
Overview of what is going on in ASP.NET Application
The next dashboard focuses on general activity in any ASP.NET Application – not only specific to ASP.NET MVC:
The above dashboard gives a good overview of what is going on within the ASP.NET Application and where we may have problems, for instance
- I can see my slowest and most often used Web Requests. The request to /Tags/sample-tag is not only called most frequent but is also has the slowest average response time
- Using Linq2Sql hides the actual SQL calls that are made by my application. The dashboard here shows me all SQL statements, their calling count and execution times
- I can see that 50% of the time is spent in my ASP.NET MVC components – this includes my controller actions
- I can also see that the top 5 performance contributing methods are controller action methods, e.g.: Upcoming, Tags, Category, …
Drilling to the root cause
From any of these dashboards I can then drill into the PurePath. The PurePath is the visualization of a single web request that was executed. It includes method execution times, method arguments, SQL statements, exceptions, …
Following image shows one of the web requests against my ASP.NET MVC Application:
The PurePath shows me what has been going on to process the web request. It includes the creation of the Controller, the execution of the Actions and the rendering of the result views
Test Driven Development – identify regressions early on
The beauty of MVC applications is the strict separation between the controller and the views – which makes it easy to write tests for your controllers without having to have the application hosted in a web server in order to run web tests.
One pain that continuous testing solves is that you can easily identify functional regressions. If you run your unit tests for every build you can make sure that all your code is functionally correct. But we can do more than just verifying the functionality of our software from build to build. Alois wrote a great article about Performance Management in Continuous Integration.
The next dashboard will help identifying regressions by automatically comparing test results from different test runs.
In the shown dashboard I compare a Baseline test run with my current test run of the current build. It shows me that
- I had 2 additional SQL calls executed – why that?
- I had many additional calls within the LINQ Framework – why that?
- Most of the application layers experienced a performance degradation between 15 and 29%
Although my unit tests still show me that everything is green from a functional perspective – analyzing the dynamics of the application code that was executed by my tests allows me to react to certain situations before they actually become a problem.
The dynaTrace Technology Package for ASP.NET and ASP.NET MVC Applications enables easy understanding of the dynamics of your application. The package comes with different configurations that allow the package to be used by Developers, Testers and Operations for 24×7 transactional tracing in Production.