Performance analysis of Golang program by Pprof

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

First, import the package

Import _ "Net/http/pprof"

Second, start monitoring routine

Go func () {
http. Listenandserve ("0.0.0.0:18080", nil)
}()


Third, access to Web services
Example: Analyzing CPU Usage
Go Tool pprof Http://localhost:18080/debug/pprof/profile
  (pprof) top10total:2525 samples 298 11.8% 11.8% 345 13.7% runtime.mapacces S1_fast64 268 10.6% 22.4% 2124 84.1% Main.   Findloops 251 9.9% 32.4% 451 17.9% scanblock 178 7.0% 39.4% 351 13.9% Hash_insert 131 5.2% 44.6% 158 6.3% Sweepspan 119 4.7% 49.3% the 13.9% main. DFS 53.1% 98 3.9% flushptrbuf 3.8% 3.8% 56.9% 95 3.  8% 60.6% 101 4.0% runtime.settype_flush the 3.5% 64.1% 988 39.1% runtime.mallocgc  

IV, refer to
//pprof command
https://blog.golang.org/profiling-go-programs
//several monitoring metrics on the web
https://golang.org/pkg/net/http/pprof/
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.