Customers are not patient and never in history has your website or application's performance mattered as much as today. According to Amazon, every 100 millisecond increase in load time decreased sales by 1%. In 2013 that could mean as much as 740 million dollars! Site and application speed is mentally associated with reliability, credibility, security, and stability. Developers are often unaware of how to optimize performance properly. Even worse, performance becomes a priority only when it is unacceptable or, in the best case, annoying. Learn how to profile, identify hotspot bottlenecks, and optimize .NET code to create fast and efficient applications with JetBrains dotTrace.
Xavier is very passionate about teaching, helping others understand search and Big Data. He is also an entrepreneur, project manager, technical author, trainer, and holds a few certifications with Cloudera, Microsoft, and the Scrum Alliance, along with being a Microsoft MVP.
What Is dotTrace & How Do I Get It? Now that I have made my point on how important performance is, let's get into the details of what you can do for your own applications. In this module we will define profiling and get an overview of the profiling process, mention other JetBrains products, learn how to get dotTrace, and find out what types of licenses are available and which one is suited for me.
Kicking the Tires: Profiling Demo Applications The brave and the bold may just jump right into to profiling their current application. Extra cookie points if they do it remotely into a production server. However, that's not how responsible, good developers should approach learning the art of profiling. Instead, let's get started with a couple of profiling sessions with several applications that are included in this training. The aim is to learn the basics and work our way into more advanced scenarios. Think of this module as a tour bus around dotTrace town.
Hotspots, Bottlenecks, & Snapshots In this module we will learn about Snapshots, Hotspots, Bottlenecks, and Views. Let's start with the theory and then at the end we will have several demos that will cover what's mentioned in this module. I find this is the best way to understanding first the topics and then viewing them in action all in one go. It makes it easier to follow along when seen in full context. So let's get into the details. Hotspots and bottlenecks. When we talk about hotspots, what we mean is a function with a lot of time spent in it. So this means it stands out. So the reasoning is usually to optimize it. However, it's not really true that a lot of time means that it's inefficient. It may also mean that a lot of work is getting done, but on the other hand we have the bottlenecks. A bottleneck is a hotspot. It is an efficient code, which means that some hotspots are bottlenecks and all bottlenecks are hotspots. So you need to identify hotspots and determine if they are bottlenecks.
Navigation, Subsystems , Filtering, Formatting, Folding, & Options In this module we will explore techniques, methods, and features that will make you stand out from the crowd as a performance profiler using JetBrains dotTrace.
Tracing, Line by Line, Sampling, & Timeline Not all profiling options are created equal. Depending on your needs, you can select one of the four profiling modes, so let's review and understand each one. There are four profiling types available to you that are Sampling, Tracing, Line-by-Line, and Timeline. Each one has a different level of accuracy and granularity, and with Timeline it's a whole new experience. So how intrusive is each one of the profiling types? So each profile type intervenes at a different level on the application being profiled. That is, having to collect the data can make your application either run slow or much slower. So as a test, let's see how long the rate trace application takes to execute with each mode. For this exercise I just ran one after the other, a simple profile with no additional configuration. So look at the differences. Without any profiling, it's about 13 seconds, a little bit more. Sampling, it's pretty much the same amount of time. With Tracing it takes 1. 4 minutes, so that's quite a bit of a difference, but nothing compared to the Line-by-Line, which is 14 minutes. And Timeline is not very intrusive. As you can see, it takes only about 15 seconds, which is just a little bit more above Sampling. And if you put it in a graph, the difference is much more compelling.
Performance Gain Forecasting & Comparing Snapshots A brute force approach may work if you have limited resources, which is not usually the case. DotTrace allows you to estimate potential performance optimization gains on specific functions, which is what's called forecasting so that you can proactively decide where to focus your efforts. For example, it can help when you ask, what would be the overall impact if I optimize by 30% this piece of code? Nothing's more frustrating than spending several hours on optimizing individual functions and finding out that the gains are not as expected. In this module I will show you how to fight the battle beforehand, that is use dotTrace to estimate performance gains before starting the optimization work. Then we will learn how to compare snapshots to measure our progress once we've done the work, and finally we will go over dotTrace's sharing functionality.
Remote Profiling & Profiling API In most cases, you will profile applications locally in your development environment; however, you might run into one of those cases where it simply works in my machine, but not so much in QA, UAT, or, even worse, in production. Let's learn how to remote profile an application in a machine without the need to install dotTrace. You will only need to deploy a couple of files or use NuGet. You can profile a standalone or web application, Windows Azure, or even a Windows service, and then that profiler API allows you to create applications where you can specify with great granularity what portions of the code should be profiled. Also, it is possible to create self-profiling applications that can create snapshots if certain execution parameters are exceeded. So let's take a look.