Introducing Prefix and Retrace : Interview with Stackify's Founder Matt Watson
- Prefix is a desktop profiler for developers, providing live data on local applications being developed.
- Retrace is an APM solution, optimized for server workloads.
- Many popular frameworks and libraries, such as ASP.NET and Entity Framework, are supported out of the box without additional configuration.
- .NET Core is supported for both Prefix and Retrace.
Stackify was founded in 2012, making it a relatively new player in the field of Application Performance Management (APM) and code profilers. InfoQ reached out with Matt Watson, founder and CEO of Stackify, to learn more about its products Prefix and Retrace.
What is Prefix?
Prefix is free lightweight profiler for .NET & Java developers. It runs on their workstation and gives them details about what their code is doing while creating or testing their apps. I always described Prefix as the world's best log viewer for developers. By ASP.NET web request you can see all your log statements plus many other details. For example, it can show you how long a request takes, what SQL queries were executed, HTTP calls, exceptions and much more.
Our goal is to help developers understand what their code is spending every millisecond of time on. Of course, we will never be able to track everything. We work very hard to track all the common things, including common libraries and dependencies that their code uses. Some other things that Prefix tracks includes the amount of time it takes to read and send a response. Most developers never think about how long it takes their code to read incoming POST data and deserialize it or serialize a large response.
Not all applications problems are related to something being slow. Your app can fail very spectacularly and very quickly. Being able to see all exceptions being thrown, even if they are being caught and thrown away can be very helpful. Prefix also warns about SQL queries being ran multiple times which helps catch N+1 type SQL query problems.
It gives developers a fast feedback loop to know what their code just did and how long it took. It can really help with finding application problems early in the development cycle. We have over 10,000 users in 100 countries that have downloaded Prefix. Some of them put it on a second monitor on their desk and just leave it on all day to keep an eye on what their code is doing.
What is Retrace?
Retrace is our application performance management (APM) product for .NET and Java applications. It helps developers understand the performance for all their applications across all their servers. Developers can quickly see which web requests are taking the longest and why. Including slowest SQL queries, external web services and many more details.
Retrace is unique compared to other APM products because it is designed for developers to use. Most APM solutions are primarily used by IT operations types for high level business transaction monitoring and they are extremely expensive. Retrace is purposely simpler to use for developers and very affordable.
As an example, the last company I worked at was using AppDynamics and it cost them over $200,000 a year. They primarily used it to monitor the overall performance of their applications. They had dashboards setup on TVs around the office. For all that money, that was pretty much the extent of how much they used it. It was an expensive traffic light. They have 100 software developers and none of them use it because it is too difficult to quickly find answers to the problems they are trying to solve.
APM products collect an amazing amount of data that can be very useful for developers. The problem is the products were never really designed for that purpose. They were designed for IT operations and sold as expensive application monitoring products. Developers need access to the same types of data through a different lens.
Developers just want visibility to understand why their applications aren't working correctly. This could be due to application errors, high CPU, a server being down, a spike in web traffic, a slow SQL query, or lots of other things. The trick is being able to figure out which of the potential causes is the actual problem, as fast as possible.
Prefix and Retrace support .Net Core on Windows. What led you to provide .NET Core 1.0 support instead of waiting for the 2.0 release?
Both of our products are designed to help developers understand the performance of their applications. Since our customers are the first adopters of new technologies like .NET Core, they immediately started asking us if we supported it. We knew it was the future of all Microsoft .NET development and wanted to make sure that we had great support for it.
Microsoft Azure started supporting .NET Core right when it first came out. Because of this, we naturally had a lot of customers using Azure as a playground for .NET Core. This lead them to also start asking us for .NET Core support for monitoring their Azure applications.
We also wanted to use .NET Core ourselves to port Prefix over to be usable on MacOS. Since Prefix supports both .NET and Java on Windows, we wanted to reuse the same codebase on the Mac for Java. So weirdly enough we can now profile Java apps on a Mac and display the data with .NET, which still sounds very strange!
Any unexpected challenges in porting to .NET Core?
Taking an existing app and switching it to .NET Core is easy if your goal is to still use the full .NET framework and deploy your app on Windows. You just create a new project file and re-add all of your package references. We wrote a great article about lessons we learned in converting to .NET core you can read for more details.
Things get a lot more complicated if you want to target the new .NET Core CLR which also runs on MacOS and Linux. For version 1.0 of .NET Core it had a limited set of APIs that were supported. As a couple examples, things like System.Drawing and DataTables were missing. You can run your .NET Core app on Linux or MacOS if you target “netcoreapp” as your target framework.
The biggest issue was .NET Core 1.0 when it came out was really compatibility with third party libraries. If your app used any third-party libraries, you had to make sure they had converted it to support .NET Core or you could no longer use it. One of the biggest ones that was lacking at launch was log4net which is a common logging framework for .NET developers. As another example, at Stackify we use a third-party SQL parsing library and it did not work for .NET Core. We were forced to come up with an alternate solution.
One of the big changes coming in .NET Core 2.0 is support for being able to reference third party libraries that have not been fully ported to .NET Core yet. Microsoft created a compatibility shim that magically makes it work somehow. If the referenced library does something that isn't supported by Core I guess it will just throw a PlatformNotSupportedException or something similar.
Prefix support visualizing data collected by Retrace. Can you explain what does it provide for developers?
Prefix and Retrace both function as profilers to collect performance and behavior details about your code. The big difference is Prefix is designed to run on your workstation and show you every single request that occurs. Retrace, on the other hand, is designed for servers and aggregates all the performance details together.
One of the cool things that Prefix can do is pull down some performance metrics out of Retrace about whatever web request you are looking at in Prefix. This is useful because it lets you compare performance to what you are seeing on your local box to QA and production. You can see how often the request happens in production, average response times, and error rates. With one click you can also jump right in to Retrace to view more details about that web request.
What are the libraries and frameworks supported out of the box by Prefix? Are they the same for Retrace?
Our goal with both products is to make them very easy to install and use. We don't want our users to think about how to instrument their applications to collect data for performance analysis. We want them to install our tools and they just work out of the box. So we work hard to ensure that we have good support for all of the popular dependencies and frameworks.
Out of the box both Prefix and Retrace support common .NET apps like ASP.NET, ASP.NET Core, and Windows Services. Within ASP.NET you then have to worry about supporting MVC, WebForms, WCF, Owin, Nancy, and Web API running inside and outside of IIS. This is further complicated by .NET 2.0, .NET 4.5, 32 bit, 64 bit, and .NET Core. As you can imagine, there are a lot of scenarios.
Both products then support automatic instrumentation of SQL Server, HTTP calls, MongoDB, Elasticsearch, Redis, common Azure libraries, AWS libraries and much more. We have a full list in our support documentation.
What are the differences between Prefix and Retrace regarding the data collected?
The are almost identical. Prefix does slightly more data collection because we are not as worried about the performance overhead of the profiling. For Retrace performance is the top priority and it is used in a slightly different manner. So we have some things we default on for Prefix but off for Retrace.
For example, in Prefix we can collect and show incoming request headers and POST data as well as the complete response from the request. We don't collect that for Retrace by default but do provide options to enable it.
Is it possible to customize Prefix to profile other libraries than the ones already supported?
Yes! One of the great things about both of our products is they are based on the common .NET profiling APIs. Therefore, we can profile any method in your code or a third-party library. We provide a mechanism to specify what namespaces, classes, and methods you want to profile and then we include those in the transaction traces we collect and show.
Both Prefix and Retrace use the standard .NET CLR profiling APIs. Developers can leverage these APIs to get information about things like exceptions, garbage collection, current stack trace, just-in-time (JIT) compilation, function entry and exit, thread creation, and more. The profiling APIs also work with .NET Core on Windows and partially on Linux. I'm not sure what the latest is on the Linux/MacOS port of the profiling APIs but some of those APIs were still being implemented when .NET Core 1.0 came out.
About the Interviewee
Matt Watson (@mattwatson81) is the founder & CEO of Stackify. He has been a .NET developer for 14 years and is passionate about helping developers improve their software. When he isn't hacking away on some code or blogging he is usually chasing his three young boys.