Cedana
Cedana Daemon
Cedana
Cedana Daemon
  • Cedana Daemon
  • Get started
    • Installation
    • Authentication
    • Configuration
    • Health checks
    • Plugins
    • Feature matrix
  • Guides
    • Managed process/container
    • Checkpoint/restore basics
    • Checkpoint/restore with GPUs
    • Checkpoint/restore runc
    • Checkpoint/restore containerd
    • Checkpoint/restore streamer
    • Checkpoint/restore kata
      • how-to-create-custom-busybox-image
      • how-to-install-criu-in-guest
      • how-to-install-on-aws
      • how-to-make-kernel-criu-compatible
      • how-to-make-rootfs-criu-compatible
      • Checkpoint/Restore kata containers
  • Developer guides
    • Architecture
    • Profiling
    • Testing
    • Writing plugins
  • References
    • CLI
      • cedana
      • cedana attach
      • cedana checkpoint
      • cedana checkpoints
      • cedana completion
      • cedana completion bash
      • cedana completion fish
      • cedana completion powershell
      • cedana completion zsh
      • cedana daemon
      • cedana daemon check
      • cedana daemon start
      • cedana delete
      • cedana dump
      • cedana dump containerd
      • cedana dump job
      • cedana dump process
      • cedana dump runc
      • cedana exec
      • cedana features
      • cedana inspect
      • cedana job
      • cedana job attach
      • cedana job checkpoint
      • cedana job checkpoint inspect
      • cedana job checkpoint list
      • cedana job checkpoints
      • cedana job delete
      • cedana job inspect
      • cedana job kill
      • cedana job list
      • cedana jobs
      • cedana k8s-helper
      • cedana k8s-helper destroy
      • cedana kill
      • cedana manage
      • cedana manage containerd
      • cedana manage process
      • cedana manage runc
      • cedana plugin
      • cedana plugin features
      • cedana plugin install
      • cedana plugin list
      • cedana plugin remove
      • cedana plugins
      • cedana ps
      • cedana query
      • cedana query k8s
      • cedana query runc
      • cedana restore
      • cedana restore job
      • cedana restore process
      • cedana restore runc
      • cedana run
      • cedana run containerd
      • cedana run process
      • cedana run runc
    • API
    • GitHub
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Developer guides

Profiling

PreviousArchitectureNextTesting

Last updated 2 months ago

Was this helpful?

The profiling system tries to be contextual and invisible. Profiling data is sent as . To enable, set Profiling.Enabled=true in .

Since each adapter to a request (see ) is a well-defined single-responsibility function, it makes sense to profile each of them. When enabled, the daemon will profile each adapter, and send back flattened data as a gRPC trailer. For readability's sake, this profiling is completely invisible and handled by the adapter logic in pkg/types/adapter.go (also see pkg/types/timer.go). This flattened data is parsed by the cmd package and displayed as shown below. An example out of cedana dump containerd ... when profiling is enabled:

image

Above, you can see complete flow of the request before it reaches CRIU's dump function, including which plugin (2nd column) the adapter belongs to. For containerd, you can see that the request is largely handled by the low-level runtime runc's plugin. The second table above shows a compressed view of the same data, with only the total time spent in each plugin/category. Note that, above there are some components that are executed concurrently, e.g. rootfs, so the time you see in the (flattened) data above is only the time spent waiting for rootfs to finish.

In many cases, we may need to add more context to this data, or add more components to it. Helpers defined in pkg/profiling/timing.go can be used. A good example is adding a new component to the compression category in internal/server/filesystem/dump_adapters.go as seen above:

		_, end := profiling.StartTimingCategory(ctx, "compression", utils.Tar)
		tarball, err := utils.Tar(imagesDirectory, imagesDirectory, compression)
		end()

These helpers use the passed context to store profiling data. If the context already has parent profiling data, the data is added as a component to the parent.

Behind the scenes, if OTel is enabled ( Metrics.Otel=true), this data is also captured in OTel spans.

configuration
gRPC Metadata
configuration
architecture