{"id":293,"date":"2026-05-02T09:00:00","date_gmt":"2026-05-02T03:30:00","guid":{"rendered":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/"},"modified":"2026-10-10T21:21:01","modified_gmt":"2026-10-10T15:51:01","slug":"go-profiling-pprof-guide","status":"publish","type":"post","link":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/","title":{"rendered":"Go Profiling with pprof for Beginners"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Go profiling shows exactly where your program spends its time and memory, so you fix real bottlenecks instead of guessing. In this post, you will write a benchmark and record CPU and memory profiles. Next, you will read them with <code>go tool pprof<\/code>. Finally, you will add live profiling to a web server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because benchmarks come from the testing package, first review <a href=\"https:\/\/smitabharat.com\/blog\/go-unit-testing-guide\/\">Go unit testing for beginners<\/a>. Our example also compares string building methods from <a href=\"https:\/\/smitabharat.com\/blog\/go-strings-examples\/\">Go strings explained with examples<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Is Go Profiling?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In short, a profiler watches a running program and takes samples. For example, the CPU profiler checks about 100 times per second which function is running. After a while, the busiest functions stand out clearly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, think of a doctor&#8217;s check-up. Instead of guessing why you feel tired, the doctor runs tests and reads the numbers. Similarly, Go profiling replaces guesses with measurements.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Profile<\/th><th>What it shows<\/th><\/tr><\/thead><tbody><tr><td>CPU<\/td><td>Which functions use the most processor time<\/td><\/tr><tr><td>Heap (memory)<\/td><td>Where memory is allocated and still in use<\/td><\/tr><tr><td>Goroutine<\/td><td>What every goroutine is doing right now<\/td><\/tr><tr><td>Block and mutex<\/td><td>Where goroutines wait on locks or channels<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In general, you start with CPU and memory. The other two help when a program feels stuck rather than slow. For example, goroutines may pile up behind one busy mutex.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Write a Benchmark<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>func JoinPlus(words []string) string {\n\ts := \"\"\n\tfor _, w := range words {\n\t\ts += w + \",\"\n\t}\n\treturn s\n}\n\nfunc JoinBuilder(words []string) string {\n\tvar b strings.Builder\n\tfor _, w := range words {\n\t\tb.WriteString(w)\n\t\tb.WriteByte(',')\n\t}\n\treturn b.String()\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>func BenchmarkJoinPlus(b *testing.B) {\n\tfor b.Loop() {\n\t\tJoinPlus(words) \/\/ words holds 1,000 strings\n\t}\n}\n\nfunc BenchmarkJoinBuilder(b *testing.B) {\n\tfor b.Loop() {\n\t\tJoinBuilder(words)\n\t}\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>b.Loop()<\/code> arrived in Go 1.24. Specifically, it runs the body as many times as needed for a stable result. On older versions, use <code>for i := 0; i &lt; b.N; i++<\/code> instead.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Run and Compare<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>$ go test -bench=. -benchmem\nBenchmarkJoinPlus-2         624   1613349 ns\/op   3717275 B\/op   1000 allocs\/op\nBenchmarkJoinBuilder-2    62240     17561 ns\/op     34296 B\/op     15 allocs\/op<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">First of all, the <code>-benchmem<\/code> flag adds memory columns. Here the <code>+<\/code> version is about 90 times slower and makes 1,000 allocations per call. Your numbers will differ by machine, but the gap stays huge. Also, run benchmarks on a quiet machine, because other busy programs add noise to the results.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Read a Go Profiling Report<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>$ go test -bench=JoinPlus -cpuprofile cpu.out -memprofile mem.out\n$ go tool pprof -top -sample_index=alloc_space mem.out\n      flat  flat%   sum%        cum   cum%\n    2.26GB 99.88% 99.88%     2.26GB 99.88%  prof.JoinPlus<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For instance, the diagram below shows the full Go profiling loop, from benchmark to fix.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-profiling-pprof-guide-diagram-1024x640.png\" alt=\"Go Profiling diagram showing the loop of benchmark, record, read, fix and measure again\" class=\"wp-image-277\" srcset=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-profiling-pprof-guide-diagram-1024x640.png 1024w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-profiling-pprof-guide-diagram-300x188.png 300w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-profiling-pprof-guide-diagram-768x480.png 768w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-profiling-pprof-guide-diagram-1536x960.png 1536w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-profiling-pprof-guide-diagram-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Measure with a benchmark, record a profile, find the hot function with pprof, fix it and measure again.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Reading flat and cum<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In short, <code>flat<\/code> is time or memory spent inside the function itself. <code>cum<\/code> also includes everything it calls. So start with the highest <code>cum<\/code> value from your own code, then drill into its children.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ go tool pprof -top -cum cpu.out\n      flat  flat%   sum%        cum   cum%\n         0     0%     0%      680ms 46.26%  prof.JoinPlus\n      20ms  1.36%  1.36%      680ms 46.26%  runtime.concatstring3<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here <code>runtime.concatstring3<\/code> is the <code>+<\/code> operator at work. In other words, the profile points straight at the string concatenation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Go Profiling a Live Web Server<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import (\n\t\"log\"\n\t\"net\/http\"\n\t_ \"net\/http\/pprof\"\n)\n\nfunc main() {\n\tlog.Fatal(http.ListenAndServe(\"localhost:6060\", nil))\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here, the blank import adds pages under <code>\/debug\/pprof\/<\/code>. Then you can grab a 30 second CPU profile from the running server.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ go tool pprof http:\/\/localhost:6060\/debug\/pprof\/profile?seconds=30<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Keep these pages on localhost or behind a login, because they reveal internal details. Also try <code>go tool pprof -http=:8081 cpu.out<\/code>, which opens an interactive graph in your browser.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Go Profiling Mistakes<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Problem you see<\/th><th>Why it happens<\/th><th>How to fix it<\/th><\/tr><\/thead><tbody><tr><td>Benchmark result is 0 ns\/op<\/td><td>Because the compiler removed unused work.<\/td><td>So use <code>b.Loop()<\/code> or store the result.<\/td><\/tr><tr><td>Profile shows only runtime functions<\/td><td>Because your own code is too fast to sample.<\/td><td>So run longer with <code>-benchtime=5s<\/code>.<\/td><\/tr><tr><td>Slower code after a &#8220;fix&#8221;<\/td><td>Because the change was not measured.<\/td><td>So re-run the benchmark every time.<\/td><\/tr><tr><td>\/debug\/pprof open to the internet<\/td><td>Because the server listens on all interfaces.<\/td><td>So bind to localhost only.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In fact, performance questions often appear in senior interviews. So practise with my <a href=\"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers\/\">Go interview questions and answers<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Official Resources<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These pages come straight from the Go team, so they stay accurate and up to date.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/go.dev\/doc\/diagnostics\">Go docs: Diagnostics<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/pkg.go.dev\/runtime\/pprof\">runtime\/pprof package documentation<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/go.dev\/blog\/pprof\">Go blog: Profiling Go Programs<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Recap<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go profiling measures where time and memory really go.<\/li>\n\n\n\n<li>Benchmarks with <code>-benchmem<\/code> compare speed and allocations.<\/li>\n\n\n\n<li><code>-cpuprofile<\/code> and <code>-memprofile<\/code> record profiles for pprof.<\/li>\n\n\n\n<li><code>flat<\/code> is the function itself, while <code>cum<\/code> includes its callees.<\/li>\n\n\n\n<li>Import <code>net\/http\/pprof<\/code> to profile a live server on localhost.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s Next?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">At last, you can find and fix slow code. Next, we will ship it by building binaries for Windows, macOS and Linux with cross compilation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next lesson: <a href=\"https:\/\/smitabharat.com\/blog\/go-cross-compilation-build\/\">Go Cross Compilation: Build for Any OS<\/a><\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Go profiling shows exactly where your program spends its time and memory, so you fix real bottlenecks instead of guessing. In this post, you&hellip;<\/p>\n","protected":false},"author":1,"featured_media":276,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_swapz_level":"","_swapz_series_part":0,"_swapz_hide_toc":false,"_swapz_hide_featured":false,"_swapz_description":"","footnotes":""},"categories":[15],"tags":[11,59,23,21],"swapz_series":[],"class_list":["post-293","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-go-lang","tag-go-lang","tag-go-profiling","tag-go-tutorial","tag-golang-basics"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Go Profiling with pprof Explained for Beginners<\/title>\n<meta name=\"description\" content=\"Learn Go profiling with pprof: write benchmarks, record CPU and memory profiles, read flat and cum values and profile a live server safely.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Go Profiling with pprof Explained for Beginners\" \/>\n<meta property=\"og:description\" content=\"Learn Go profiling with pprof: write benchmarks, record CPU and memory profiles, read flat and cum values and profile a live server safely.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"Smita Bharat - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-05-02T03:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-10T15:51:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-profiling-pprof-guide-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Smita\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Smita\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-profiling-pprof-guide\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-profiling-pprof-guide\\\/\"},\"author\":{\"name\":\"Smita\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"headline\":\"Go Profiling with pprof for Beginners\",\"datePublished\":\"2026-05-02T03:30:00+00:00\",\"dateModified\":\"2026-10-10T15:51:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-profiling-pprof-guide\\\/\"},\"wordCount\":645,\"publisher\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-profiling-pprof-guide\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-profiling-pprof-guide-featured.png\",\"keywords\":[\"Go Lang\",\"Go Profiling\",\"Go Tutorial\",\"Golang Basics\"],\"articleSection\":[\"Go Lang\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-profiling-pprof-guide\\\/\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-profiling-pprof-guide\\\/\",\"name\":\"Go Profiling with pprof Explained for Beginners\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-profiling-pprof-guide\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-profiling-pprof-guide\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-profiling-pprof-guide-featured.png\",\"datePublished\":\"2026-05-02T03:30:00+00:00\",\"dateModified\":\"2026-10-10T15:51:01+00:00\",\"description\":\"Learn Go profiling with pprof: write benchmarks, record CPU and memory profiles, read flat and cum values and profile a live server safely.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-profiling-pprof-guide\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-profiling-pprof-guide\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-profiling-pprof-guide\\\/#primaryimage\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-profiling-pprof-guide-featured.png\",\"contentUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-profiling-pprof-guide-featured.png\",\"width\":2400,\"height\":1260,\"caption\":\"Go Profiling featured image: cards for benchmarks, CPU profiles and pprof\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-profiling-pprof-guide\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Go Profiling with pprof for Beginners\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\",\"name\":\"Smita Bharat Blog\",\"description\":\"Golang &amp; Backend Development Tutorials and Interview Questions\",\"publisher\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"alternateName\":\"Smita Bharat\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\",\"name\":\"Smita\",\"logo\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/smitabharat.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Go Profiling with pprof Explained for Beginners","description":"Learn Go profiling with pprof: write benchmarks, record CPU and memory profiles, read flat and cum values and profile a live server safely.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/","og_locale":"en_US","og_type":"article","og_title":"Go Profiling with pprof Explained for Beginners","og_description":"Learn Go profiling with pprof: write benchmarks, record CPU and memory profiles, read flat and cum values and profile a live server safely.","og_url":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/","og_site_name":"Smita Bharat - Blog","article_published_time":"2026-05-02T03:30:00+00:00","article_modified_time":"2026-10-10T15:51:01+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-profiling-pprof-guide-featured.png","type":"image\/png"}],"author":"Smita","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Smita","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/#article","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/"},"author":{"name":"Smita","@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"headline":"Go Profiling with pprof for Beginners","datePublished":"2026-05-02T03:30:00+00:00","dateModified":"2026-10-10T15:51:01+00:00","mainEntityOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/"},"wordCount":645,"publisher":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-profiling-pprof-guide-featured.png","keywords":["Go Lang","Go Profiling","Go Tutorial","Golang Basics"],"articleSection":["Go Lang"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/","url":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/","name":"Go Profiling with pprof Explained for Beginners","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/#primaryimage"},"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-profiling-pprof-guide-featured.png","datePublished":"2026-05-02T03:30:00+00:00","dateModified":"2026-10-10T15:51:01+00:00","description":"Learn Go profiling with pprof: write benchmarks, record CPU and memory profiles, read flat and cum values and profile a live server safely.","breadcrumb":{"@id":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/#primaryimage","url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-profiling-pprof-guide-featured.png","contentUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-profiling-pprof-guide-featured.png","width":2400,"height":1260,"caption":"Go Profiling featured image: cards for benchmarks, CPU profiles and pprof"},{"@type":"BreadcrumbList","@id":"https:\/\/smitabharat.com\/blog\/go-profiling-pprof-guide\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/smitabharat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Go Profiling with pprof for Beginners"}]},{"@type":"WebSite","@id":"https:\/\/smitabharat.com\/blog\/#website","url":"https:\/\/smitabharat.com\/blog\/","name":"Smita Bharat Blog","description":"Golang &amp; Backend Development Tutorials and Interview Questions","publisher":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"alternateName":"Smita Bharat","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/smitabharat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339","name":"Smita","logo":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/smitabharat.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/comments?post=293"}],"version-history":[{"count":2,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/293\/revisions"}],"predecessor-version":[{"id":316,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/293\/revisions\/316"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media\/276"}],"wp:attachment":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media?parent=293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/categories?post=293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/tags?post=293"},{"taxonomy":"swapz_series","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/swapz_series?post=293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}