<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: sayed belal</title>
    <description>The latest articles on DEV Community by sayed belal (@beellz).</description>
    <link>https://dev.to/beellz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F399831%2F8bdb92dc-7404-4c4a-897d-c284d658a68b.jpeg</url>
      <title>DEV Community: sayed belal</title>
      <link>https://dev.to/beellz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/beellz"/>
    <language>en</language>
    <item>
      <title>Continuous Profiling in Kubernetes Using Pyroscope</title>
      <dc:creator>sayed belal</dc:creator>
      <pubDate>Thu, 20 Jan 2022 06:01:24 +0000</pubDate>
      <link>https://dev.to/beellz/continuous-profiling-in-kubernetes-using-pyroscope-4493</link>
      <guid>https://dev.to/beellz/continuous-profiling-in-kubernetes-using-pyroscope-4493</guid>
      <description>&lt;p&gt;Developers typically need to look at performance bottlenecks in production applications to determine the cause of the problem. To do this, you usually need information that can be collected through logs and code tools. Unfortunately, this approach is usually time-consuming and does not provide enough details about the underlying problem.&lt;/p&gt;

&lt;p&gt;A modern and more advanced approach is to apply and use profiling techniques and tools that highlight the slowest application code, that is, the area consuming most of your resources.&lt;/p&gt;

&lt;p&gt;In this blog post, we will be talking about continuous profiling, and then instrument a couple of microservices running on Kubernetes using an open source tool called Pyroscope.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is profiling?
&lt;/h2&gt;

&lt;p&gt;Code must be analyzed, debugged, and reviewed to determine the most effective way to make it run faster. Using a profiling tool to examine an application’s code helps us to locate and fix performance bottlenecks. This can quickly diagnose how an application performs and enable programmers to get down to core details of poor performance. The result is a streamlined codebase that decreases CPU/memory consumption and makes the user experience better!&lt;/p&gt;

&lt;p&gt;Profiling is a program analysis that measures the memory, time complexity of a program or the frequency and duration of function calls. Profiling information serves to aid program optimization and performance. Profiler programs can track each individual line of code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Continuous profiling
&lt;/h2&gt;

&lt;p&gt;Continuous Profilers are used to make troubleshooting even faster and easier. Continuous Profilers are production code profilers that allow you to analyze code-level performance across your environment over time. As profiles are collected continuously, they can reveal the most resource-intensive features (or lines of code) quickly after new code is introduced. Optimization can reduce end-user delays and cloud provider accounts.&lt;/p&gt;

&lt;h2&gt;
  
  
  What continuous profilers are out there?
&lt;/h2&gt;

&lt;p&gt;So, here’s a list of some of the profilers you may have come across:&lt;/p&gt;

&lt;h3&gt;
  
  
  Pyroscope
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://pyroscope.io/" rel="noopener noreferrer"&gt;Pyroscope&lt;/a&gt; is an open source platform, consisting of server and agent. It allows the user to collect, store, and query the profiling data in a CPU and disk efficient way.&lt;/p&gt;

&lt;h3&gt;
  
  
  Parca
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://parca.dev/" rel="noopener noreferrer"&gt;Parca&lt;/a&gt; collects, stores and makes profiles available to be queried over time. It is open source and can be deployed on production environments as Parca focuses on sampling profiling two main types of profiles: tracing and sampling.&lt;/p&gt;

&lt;h3&gt;
  
  
  Datadog
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.datadoghq.com/product/code-profiling/" rel="noopener noreferrer"&gt;Datadog Continuous Profiler&lt;/a&gt; analyzes and compares code performance all the time and in any environment, including production. It pinpoints the hard to replicate production issues caused by inefficient code. Also has automated code profiling insights.&lt;/p&gt;

&lt;h3&gt;
  
  
  Google - Cloud Profiler
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://cloud.google.com/profiler" rel="noopener noreferrer"&gt;Cloud Profiler&lt;/a&gt; is a statistical, low-overhead profiler that continuously gathers CPU usage and memory-allocation information from your production applications. It has Actionable application profiling, Low-impact production Profilin and Broad Platform support.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why use Pyroscope
&lt;/h2&gt;

&lt;p&gt;Before we start exploring Pyroscope, let’s see how it is different from few of the other continuous profiling tools available in the market. DataDog and Google Cloud Profiler are widely used in the industry. As pointed out by &lt;a href="https://www.reddit.com/r/selfhosted/comments/netsku/pyroscope_open_source_alternative_to_datadog/" rel="noopener noreferrer"&gt;one of the Reddit user&lt;/a&gt;, below are some of the reasons why Pyroscope is better compared to the other two.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2F10202bc486fc116b4304cb7394463117fafd4997%2Fd7304%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fpyroscope-differnce.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2F10202bc486fc116b4304cb7394463117fafd4997%2Fd7304%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fpyroscope-differnce.jpg" alt="Comparison of Datadog, Google Cloud, and Pyroscope continuous profiling capabilities"&gt;&lt;/a&gt;&lt;br&gt;
Source: &lt;a href="https://www.reddit.com/r/selfhosted/comments/netsku/pyroscope_open_source_alternative_to_datadog/" rel="noopener noreferrer"&gt;Comparison of Datadog, Google Cloud, and Pyroscope continuous profiling capabilities&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pyroscope, focuses on building a &lt;a href="https://pyroscope.io/docs/storage-design" rel="noopener noreferrer"&gt;storage engine&lt;/a&gt; that is built specifically for profiling data to both store and query that data as efficiently as possible. It uses an agent-server model to send the profiles from applications to the Pyroscope server:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2F0a04245193314a8c748d567209bf19adca94c8af%2F6230f%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fpyroscope-agent-profiler.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2F0a04245193314a8c748d567209bf19adca94c8af%2F6230f%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fpyroscope-agent-profiler.png" alt="Image of Pyroscope Agent Profiler"&gt;&lt;/a&gt;&lt;br&gt;
Source: &lt;a href="https://pyroscope.io/docs/#how-does-pyroscope-work" rel="noopener noreferrer"&gt;How does Pyroscope Work?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pyroscope allows for profilers from any language to send data to it and have that data efficiently stored by the storage engine. For example, Pyroscope has language specific agents for Go, Python, Ruby, eBPF, Java, .NET, PHP, and Rust.&lt;/p&gt;

&lt;p&gt;Parca on the other hand takes a slightly different approach and relies on eBPF for &lt;a href="https://www.parca.dev/docs/faq#what-languages-are-supported" rel="noopener noreferrer"&gt;compiled languages like C, C++, Go, etc&lt;/a&gt;. At the time of writing this article, support for other languages is work in progress. &lt;a href="https://pyroscope.io/docs/golang-pull-mode#supported-languages-and-platforms" rel="noopener noreferrer"&gt;Similar to Pyroscope&lt;/a&gt; it can read from any &lt;a href="https://www.parca.dev/docs/ingestion#pull-based" rel="noopener noreferrer"&gt;pprof formatted profiles from HTTP endpoints&lt;/a&gt; as well.&lt;/p&gt;

&lt;p&gt;Theoretically, since all these languages eventually compile down and run on the kernel, eBPF should work for any of these languages. However, in practice, if you actually run eBPF for interpreted languages like Python, function names are unreadable for humans in many cases. This is because symbols are not stored in those languages.&lt;/p&gt;

&lt;p&gt;For this reason Pyroscope supports both language specific profilers as well as eBPF profiling. This comes at the expense of slightly more work to integrate language specific agents as compared to eBPF, which can just run at the kernel level. But it also comes with the benefit of having much more actionable and human-readable profiles.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to install Pyroscope?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;You can start the server followed by the agent no matter what you use, Docker, Linux, or are looking for Ruby or Go docs, Pyroscope covers you. Even if you aim for ten seconds or ten months of software profiling data, their custom-designed storage engine makes fast queries.&lt;br&gt;&lt;br&gt;
— Pyroscope website&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We will use minikube for running a Kubernetes cluster. Create a cluster using minikube:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;minikube start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the Helm chart repo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;helm repo add pyroscope-io https://pyroscope-io.github.io/helm-chart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install Helm chart:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;helm &lt;span class="nb"&gt;install &lt;/span&gt;pyroscope pyroscope-io/pyroscope &lt;span class="nt"&gt;--set&lt;/span&gt; service.type&lt;span class="o"&gt;=&lt;/span&gt;NodePort
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check Pyroscope Helm chart installed successfully:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;helm list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check if Pyroscope is running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we have Pyroscope running in our Kubernetes cluster, we will proceed with the steps of using the application with it.&lt;br&gt;
We will be using &lt;a href="https://github.com/GoogleCloudPlatform/microservices-demo" rel="noopener noreferrer"&gt;Google microservices&lt;/a&gt;, for this demo.&lt;/p&gt;
&lt;h2&gt;
  
  
  Integrating Google microservices demo with Pyroscope
&lt;/h2&gt;

&lt;p&gt;We will modify our container images to use pyroscope binary. This binary will start our application and inject itself to monitor. You can refer more &lt;a href="https://pyroscope.io/docs/agent-overview" rel="noopener noreferrer"&gt;in this Pyroscope document&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We will be working on Python, Go, and .NET microservice from Google microservices for the demo. All the modifications are pushed to &lt;a href="https://github.com/infracloudio/microservices-demo-dev" rel="noopener noreferrer"&gt;the fork of Google microservices&lt;/a&gt; on GitHub, let's take a look at those changes per serivce.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: To try out Pyroscope with Google microservices demo, you don't need to build the Docker images yourself. You can just apply the Kubernetes manifest as shown by the Obtaining the profiling data from microservice section.&lt;/p&gt;
&lt;h3&gt;
  
  
  Python
&lt;/h3&gt;

&lt;p&gt;We will use the Email Service application which is written in Python.&lt;br&gt;
Following changes in the &lt;code&gt;Dockerfile&lt;/code&gt; are required, for using a Python application with Pyroscope.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=pyroscope/pyroscope:latest /usr/bin/pyroscope /usr/bin/pyroscope&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; [ "pyroscope", "exec", "python", "email_server.py" ]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After editing the Dockerfile, under the same folder, we proceeded with building and pushing the image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt; beellzrocks/emailservice:latest
docker push beellzrocks/emailservice:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  .NET
&lt;/h3&gt;

&lt;p&gt;We will use the application Cart Service for .NET.&lt;br&gt;
For using the .NET application with Pyroscope, the following changes in Dockerfile are required.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=pyroscope/pyroscope:latest /usr/bin/pyroscope /usr/bin/pyroscope&lt;/span&gt;
&lt;span class="k"&gt;ENTRYPOINT&lt;/span&gt;&lt;span class="s"&gt; ["pyroscope", "exec", "-spy-name", "dotnetspy", "/app/cartservice"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After editing the Dockerfile, we proceeded with building and pushing the image.&lt;/p&gt;

&lt;h3&gt;
  
  
  Go
&lt;/h3&gt;

&lt;p&gt;We will take the Product Catalog Service application which is written in Go.&lt;br&gt;
For using the Go application with Pyroscope following changes in &lt;code&gt;server.go&lt;/code&gt; are required.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;pyroscope&lt;/span&gt; &lt;span class="s"&gt;"github.com/pyroscope-io/pyroscope/pkg/agent/profiler"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="n"&gt;pyroscope&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pyroscope&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Config&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ApplicationName&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"APPLICATION_NAME"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;ServerAddress&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;   &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"SERVER_ADDRESS"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="c"&gt;// code here&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After editing the server.go, we proceeded with building and pushing the image.&lt;/p&gt;

&lt;h2&gt;
  
  
  Obtaining the profiling data from microservice
&lt;/h2&gt;

&lt;p&gt;We modified the Kubernetes manifests to use our images with Pyroscope.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;kubernetes-manifests.yaml&lt;/code&gt; file contains resources for all the applications. We edited it to use the images which we built in above steps i.e. emailservice, cartservice, productcatalogservice.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;server&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;beellzrocks/emailservice&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When running Pyroscope in Kubernetes, we need to do following changes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add &lt;code&gt;SYS_PTRACE&lt;/code&gt; capability.&lt;/li&gt;
&lt;li&gt;Tell the agent about the location of Pyroscope server, and the application name using environment variables.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;      &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;server&lt;/span&gt;
        &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PYROSCOPE_SERVER_ADDRESS&lt;/span&gt; &lt;span class="c1"&gt;# To change Pyroscope Server Port change the value&lt;/span&gt;
          &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http://pyroscope:4040"&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PYROSCOPE_APPLICATION_NAME&lt;/span&gt; &lt;span class="c1"&gt;# Application name shown in the UI&lt;/span&gt;
          &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;email.service"&lt;/span&gt; 
        &lt;span class="na"&gt;securityContext&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;capabilities&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;SYS_PTRACE&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, to deploy all the services, you can apply the Kubernetes manifest to your cluster.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; https://raw.githubusercontent.com/infracloudio/microservices-demo-dev/master/release/kubernetes-manifests.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Get the service url for Pyroscope:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;minikube service pyroscope
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;|-----------|-----------|-------------|---------------------------|
| NAMESPACE |   NAME    | TARGET PORT |            URL            |
|-----------|-----------|-------------|---------------------------|
| default   | pyroscope | http/4040   | http://192.168.49.2:30639 |
|-----------|-----------|-------------|---------------------------|
🎉  Opening service default/pyroscope &lt;span class="k"&gt;in &lt;/span&gt;default browser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To access the Pyroscope UI, you can go to the URL: &lt;a href="http://192.168.49.2:30639" rel="noopener noreferrer"&gt;http://192.168.49.2:30639&lt;/a&gt; (your's will be different).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2F26579b5029fea94c13b64f2b7b2a24f99d322b13%2F31964%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fpyroscope-server-cpu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2F26579b5029fea94c13b64f2b7b2a24f99d322b13%2F31964%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fpyroscope-server-cpu.png" alt="Pyroscope web UI"&gt;&lt;/a&gt;&lt;br&gt;
Pyroscope UI with Pyroscope server CPU&lt;/p&gt;

&lt;p&gt;As you can see in above screenshot, Pyroscope itself takes low CPU usage while storing the data locally. It uses Badger database to store data locally.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pyroscope resource utilization
&lt;/h2&gt;

&lt;p&gt;Monitoring Kubernetes pods is also important in the context of resource usage, utilization, and cost control. Pyroscope uses low resources with low overhead.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2Fc19db839228ea5cc83cb956458b83ffea2b17659%2Ff32d2%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fpyroscope-cpu-resource-utilization.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2Fc19db839228ea5cc83cb956458b83ffea2b17659%2Ff32d2%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fpyroscope-cpu-resource-utilization.png" alt="Pyroscope CPU resource utilization shown by kubectl top"&gt;&lt;/a&gt;&lt;br&gt;
Pyroscope CPU utilization&lt;/p&gt;

&lt;h2&gt;
  
  
  Monitoring using Pyroscope
&lt;/h2&gt;

&lt;p&gt;Pyroscope profiles the code using different agents depending upon the programming language. Here are some examples of the profiled application's flame graph using Pyroscope.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2F68712fef8b5f2951063ce65b36034b658ef16d70%2Fe7cb8%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fproduct-catalog-service.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2F68712fef8b5f2951063ce65b36034b658ef16d70%2Fe7cb8%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fproduct-catalog-service.png" alt="Product Catalogue service written in Go"&gt;&lt;/a&gt;&lt;br&gt;
Pyroscope with Go Product Catalogue Service application&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2F4ed0b158fbe3759253fbe37b59c340cb40d1305f%2Fa8ce8%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fcart-app-cpu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2F4ed0b158fbe3759253fbe37b59c340cb40d1305f%2Fa8ce8%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fcart-app-cpu.png" alt="Cart service written in DotNet"&gt;&lt;/a&gt;&lt;br&gt;
Pyroscope with .Net Cart application&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2Fe497124feac70e03e033249cb1680b67795a6d40%2F68bb6%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fpython-email.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd33wubrfki0l68.cloudfront.net%2Fe497124feac70e03e033249cb1680b67795a6d40%2F68bb6%2Fassets%2Fimg%2Fblog%2Fcontinuous-profiling-kubernetes-using-pyroscope%2Fpython-email.png" alt="Email service written in Python"&gt;&lt;/a&gt;&lt;br&gt;
Pyroscope with Python Email application&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Continuous profiling performance is a crucial factor in fulfilling the expectation of end-users. And if performance issues occur, you must be ready to diagnose the issue before impacting the end-user experience.&lt;/p&gt;

&lt;p&gt;Hence, keep optimizing your applications and fix the issues immediately to continue delivering super-fast application performance to the users using tools like Pyroscope. Pyroscope showcases a layer of visibility to help you understand how to improve the performance of your code in Production and reduce cloud infrastructure costs.&lt;/p&gt;

&lt;p&gt;That’s a wrap folks :) Hope the article was informative and you enjoyed reading it. I’d love to hear your thoughts and experience - let’s connect and start a conversation on &lt;a href="https://www.linkedin.com/in/belal-sayed-183893b0/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>pyroscope</category>
      <category>profiling</category>
    </item>
  </channel>
</rss>
