Skip to content

Enhance: update logic for enabling and serving profiling information #715

@iltoga

Description

@iltoga

Description

Reading more about profiling for realtime applications in golang, it turned out that the previous way we enabled cpu and memory profiling is not the best for our use case.

I am adding a new pr that reverts part of what I have done this morning and enables realtime profiling via http server, which is the preferred way to go when debugging remote applications.

Breakdown

  • using net/http/pprof package that serves the full profiling api via http
  • enabling profiling api only when running app with -cpu-profile flag (see updated readme)
  • refactoring the way monitoring server is instantiated: not using default http hanlder anymore

Expected behavior

when running node with -cpu-profile flag a set of new endpoints will be exposed on port 'cpuProfilingPort' (from config.toml)
for details see https://golang.org/pkg/net/http/pprof/

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions