Profiling Go Applications in Production Environments

March 10, 2016

Continuous Application Profiling in Production

Production environments are different from development and staging. Whether optimizing application performance or trying to find a problem root cause, it is often necessary to use Go’s profiling tools in production.

Obviously, before doing anything in production, especially for performance optimizations, it makes sense to try to simulate production load and generate, for example, CPU or memory profiles with the built-in profilers using go tool pprof.

Using built-in profilers

To profile remote applications, go tool pprof accepts URLs, e.g.:

go tool pprof http://localhost:6060/debug/pprof/profile

The endpoint should be initialized on the application by importing the pprof http handler package:

import _ "net/http/pprof"

Also, the application should have a listening HTTP server, e.g.:

http.ListenAndServe("localhost:6060", nil)

It’s important to ensure that this endpoint is not accessible to the outside world; for example, by only allowing access from internal addresses.

The next step would be to regularly request profiles from the application and track performance regression at the function call level or identifying the root cause of a performance problem.

Using Instana AutoProfile™ for Go

Instana’s AutoProfile takes production profiling to the next level. It continuously collects and reports profiles, including:

  • CPU usage
  • Memory allocations
  • Blocking calls

These profiles, along with application and runtime metrics, are includes in Instana’s Unbounded Analytics Engine, where they can be viewed and compared. Analyzing performance differences at the function call level over time is critical for performance optimizations and problem root cause identification.

Production Go Profiling from Instana

It takes only a few minutes to get AutoProfile set up and running. Sing up for a free two week trial, then install the Go Agent and enable profiling.

See the documentation for detailed setup instructions.

Play with Instana’s APM Observability Sandbox

Announcement, Engineering, Product
Instana Adds Production Ruby Profiling In the latest Instana release (Instana Release 201), AutoProfile for Ruby is generally available. This allows teams developing and supporting Ruby based applications to continuously collect and...
Developer, Engineering, Product
One look at the Instana website lets you know that Instana is in the Observability (and APM) business — providing the nascent Enterprise Observability Platform, especially useful for Cloud-native and containerized microservices...
There are multiple reasons why a program will consume more CPU resources than excepted. In the case of a high computational complexity of an algorithm, the amount of data it operates on...

Start your FREE TRIAL today!

Instana, an IBM company, provides an Enterprise Observability Platform with automated application monitoring capabilities to businesses operating complex, modern, cloud-native applications no matter where they reside – on-premises or in public and private clouds, including mobile devices or IBM Z.

Control hybrid modern applications with Instana’s AI-powered discovery of deep contextual dependencies inside hybrid applications. Instana also gives visibility into development pipelines to help enable closed-loop DevOps automation.

This provides actionable feedback needed for clients as they to optimize application performance, enable innovation and mitigate risk, helping Dev+Ops add value and efficiency to software delivery pipelines while meeting their service and business level objectives.

For further information, please visit