Skip to content

Enable CPU profile mode using HTTP routes

Marcos Huck requested to merge feature/profiler into develop

Related tasks

Context

Cloudsim hit a 100% CPU usage when running the multi-region support & worker refactor code. We discussed the possibility of adding a CPU profiling mechanism to allow us understanding how the different components of the system interact with each other while running a certain set of instructions.

Change

This MR adds support for enabling CPU profile mode. We can access the CPU profile throughout an HTTP endpoint, in order to do this, the go executable needs to be used in to process the data. An example of the command is added below:

go tool pprof "https://cloudsim.ignitionrobotics.org/profile?seconds=30"

This command generates a zip file in the current user's home folder under the pprof directory, but also a png version of the CPU profile can be rendered by running the png command after the previous command finishes gathering the profile data.

Additional information

Gloo was modified by adding a higher timeout interval:

Spec:
  Display Name:  web-cloudsim-virtual-stix
  Virtual Host:
    Domains:
      cloudsim.ignitionrobotics.org
    Routes:
      Matchers:
        Prefix:  /
      Options:
        Timeout:  60s
      Route Action:
        Single:
          Upstream:
            Name:       cloudsim
            Namespace:  gloo-system

More information about the go pprof tool:

https://golang.org/pkg/net/http/pprof/

Edited by Marcos Huck

Merge request reports