Following the introduction of the Sitecore Helix framework at Sitecore Symposium 2016 in New Orleans, and after attending Sitecore User Groups where Helix has been discussed, I wanted to take this opportunity to share insights on how to achieve the automation aspects outlined in Helix.
By adding Dynatrace AppMon into your DevOps Continuous Integration (CI) / Continuous Deployment (CD) processes, you automatically ensure the highest levels of quality, performance, and user experience for your Sitecore based application. And you achieve this while dramatically increasing the frequency of your releases and decreasing the lead time for each release.
Before we get into the detail, and for completeness, I should also add that along with Helix, Habitat was also launched at Symposium 2016.
Helix documents the development guidelines and recommended practices that describes the application of overall design principles that should be applied to a Sitecore project.
Habitat is a real Sitecore project implemented on the Sitecore Experience Platform using Helix. It is an example that allows developers to see how Helix is applied and lets developers experience a project based on these principles.
Dynatrace AppMon complements Helix, in particular Section 3, which focuses on DevOps & Development Lifecycle Management. AppMon provides deep insight into some of the largest production Sitecore environments around the world, and it’s this same unique depth of insight that delivers tremendous value during the development, build, integration, and testing phases outlined in Helix.
The objective of this blog isn’t to go into detail regarding the principles of DevOps, that’s an area covered extremely well by my colleague and subject matter expert, Andi Grabner, and I’ll provide some links at the foot of this blog to his content for further education on DevOps. Instead, we’ll focus on section 3 of Helix and how Lifecycle and Automation can greatly impact Sitecore project delivery and project outputs.
Lifecycle and Automation
Helix Section 3.1 highlights the Development environment as the place teams will spend most of their time, and thus an obvious candidate for optimization and automation. But taking a sequential and isolated approach to Section 3 would be a mistake. To achieve the full benefits and outputs of DevOps, Section 3.1 needs to be tightly integrated with Sections 3.2 ‘Build & Integration’, and Section 3.3 ‘Testing’, to accomplish effective feedback loops between teams.
Essentially what we’re looking to accomplish is a change in approach from the old way of developing and testing that involves multiple manual iterations between dev and test resulting in a slow, inefficient, and painstaking process…
…to the new way, where performance is engineered early in the lifecycle and automation is embraced to speed up development, compress test time, and increase quality so that innovation flourishes and technical debt is minimized.
Adding the ‘How’ to Helix
Let’s look at some simple steps Sitecore teams can take to embrace Lifecycle and Automation and create a delivery pipeline the embraces a shift left approach to quality and performance with automated feedback loops and quality control.
Localized Development & Unit Tests
The First Way principle in DevOps talks about the need to minimize downstream problems, and improving the code quality at the individual developer level through automation is a great way to achieve drastic improvements in both code quality and developer productivity. Enhancing a developer’s IDE with Dynatrace provides incredible insight into the inner workings of developer’s code, for example:
- Visual representations of runtime transaction flows
- Sequence diagrams
- Degradations in KPIs including, but not limited to:
- Response times
- Method use
- Execution times
- Database query timings
- Error counts
- Number of remote calls
- Full comparison analysis between either their prior local builds or operational builds
- Comparison analysis between specific transactions currently being repaired vs a corresponding fatal transaction collected during an operational incident.
Dynatrace can pinpoint issues faster while reducing the need for numerous break points and line-by-line debugging. Call stacks are recorded each time the developer runs the code, enabling end-to-end post-mortem analysis of every local run. Not only can the developer prevent a risky check-in but designers such as solution engineers and architects can perform visual architectural validations (as opposed to them having to do full code reviews).
- Using the Dynatrace Visual Studio plugin (other IDE plugins are available such as Eclipse) allows developers to launch applications with an injected AppMon Agent directly from Visual Studio
2. Executing unit tests using a tool like NUnit or directly from Visual Studio allows the AppMon Agent to capture data in the form of PurePaths:
PurePath Technology® is a complete multi-dimensional trace of every transaction in a monitored application providing comprehensive visibility across web browsers, web apps, mobile apps, web servers, Java, .NET, PHP, databases, middleware, and mainframe apps.
3. Developers can quickly analyze the PurePaths generated from the unit test to identify performance bottlenecks. The Transaction Flow view in Dynatrace provides a simple way to identify where time is being spent, thereby significantly speeding up the analysis process.
When analyzing the PurePath, right clicking ‘source lookup > open in IDE’ will take you to the exact line of code that executed, in Visual Studio:
4. PurePaths from different builds, or even captured from Production, can be compared directly to identify performance regressions or performance improvements, and validate architecture before promoting code to higher environments like Continuous Integration or Continuous Deployment (CI/CD).
Build & Integration Test Automation
Moving beyond code check-in and onto the CI build server, such as Jenkins, Bamboo, and TeamCity, CI provides various steps and phases in which developers can test and piece together all of the code necessary for deployment. During a CI build step, a series of unit testing scripts should be executed to exercise as many of the critical methods as possible. (Note: while not advocating a particular tool, consider using code coverage tools such as Clover, SonarQube, Team Test or dotCover, to determine the critical areas of the code to be unit tested).
Once the unit test automation scripts are executed, the rich intelligence collected by AppMon can be leveraged, such as reporting if critical KPIs or SLAs are violated. Using build-scripting tools like Maven, Ant or MSBuild, developers and testers can ensure that performance data is aligned and labeled for each build and that actions can be auto-orchestrated based on the performance data collected from each build.
“It is only through automated testing that we can transform fear into boredom…
The only way you can get people productive is to show them there is a safety net underneath them that will catch errors long before they get into production.” Eran Messeri, SCM, Google
Helix provides a much-needed framework for best practice of Sitecore projects defining ‘What’ should be done, and Dynatrace AppMon complements Helix by providing the ‘How’ to do it. Specifically, Dynatrace AppMon supports continuous delivery processes by:
- Promoting the sharing of performance data across development, test, & operations
- Providing reliable metrics along your delivery pipeline through automation interfaces for CI/CD systems, such as Jenkins, Bamboo, and TeamCity
- Delivering more stable applications in production faster through automatic analysis of regressions and the comparison of response times, structural differences, code executions, errors, exceptions and database performance
If you’re new to Dynatrace and want to evaluate Dynatrace for your .NET application, check out this YouTube video that includes instructions for getting started What is Dynatrace AppMon?