Server Performance Optimization

This document was translated by GPT-4

# 1. Introduction

With Golang Profile (opens new window), we can capture and optimize the data writing performance of DeepFlow Server.

# 2. Steps

  1. Install the deepflow-ctl tool.
  2. Find the DeepFlow Server Pod IP that needs to be profiled. If the number of replicas of DeepFlow server is larger than 1, pick any one from them:
deepflow_server_pod_ip=$(kubectl -n deepflow get pods -o wide | grep deepflow-server | awk '{print $6}')
1
  1. Turn on the Profile function:
deepflow-ctl -i $deepflow_server_pod_ip ingester profiler on
1

# 3. Get CPU Profile

go tool pprof http://$deepflow_server_pod_ip:9526/debug/pprof/profile
1

After executing the command, the default sampling time is 30s. You can modify the Profile duration by adding seconds=x parameter such as http://$deepflow_server_pod_ip:9526/debug/pprof/profile?seconds=60. After profiling, you can enter the svg command to generate a vector graphic format of the Profile result image and copy it to your local machine for inspection through a browser.

# 4. Get Memory Profile

go tool pprof http://$deepflow_server_pod_ip:9526/debug/pprof/heap
1

After executing the command, it will take a real-time sampling and get the current memory snapshot. Then similarly, you can enter the svg command to generate a vector format of the Profile result image and copy it to your local machine for inspection through a browser.

# 5. Other Profile Information

If you want to get other Profile information, you can find all the available types for analysis in the Golang SourceCode (opens new window).