边缘内存占用测试
Why measure memory footprint?
- This platform is designed for a light-weight edge computing deployment, capable of running on devices with few resources (for example, 256MB RAM)
 - It is important to know when deploying many pods that it showcases as little memory footprint as possible
 
KPI's measured
- %CPU
 - %Memory
 - Resident Set Size (RSS)
 
How to test
After deployment and provisioning of KubeEdge cloud and edge components in 2 VM's (supported and tested over Ubuntu 16.04) respectively, start deploying pods from 0 to 100 in steps of 5. Keep capturing above KPI's using standard linux ps commands, after each step.
Test setup
Fig 1: KubeEdge Test Setup
Creating a setup
Requirements
- Host machine's or VM's resource requirements can mirror the edge device of your choice
 - Resources used for above setup are 4 CPU, 8GB RAM and 200 GB Disk space. OS is Ubuntu 16.04.
 - Docker image used to deploy the pods in edge, needs to be created. The steps are:
- Go to github.com/kubeedge/kubeedge/edge/hack/memfootprint-test/
 - Using the Dockerfile available here and create docker image (
perftestimg:v1). - Execute the docker command 
sudo docker build --tag "perftestimg:v1" ., to get the image. 
 
Installation
For KubeEdge Cloud and Edge:
Please follow steps mentioned in KubeEdge README.md
For docker image:
- Deploy docker registry to either edge on any VM or host which is reachable to edge. Follow the steps mentioned here: https://docs.docker.com/registry/deploying/
 - Create 
perftestimg:v1docker image on the above mentioned host - Then push this image to docker registry using 
docker taganddocker pushcommands (Refer: Same docker registry url mentioned above) [Use this image's metadata in pod deployment yaml] 
Steps
- Check edge node is connected to cloud. In cloud console/terminal, execute the below command
 
root@ubuntu:~/edge/pod_yamls# kubectl get nodes
NAME                                   STATUS     ROLES    AGE     VERSION
192.168.20.31                          Unknown    <none>   11s
ubuntu                                 NotReady   master   5m22s   v1.14.0
- On cloud, modify deployment yaml (github.com/kubeedge/kubeedge/edge/hack/memfootprint-test/perftestimg.yaml), set the image name and set spec.replica as 5
 - Execute 
sudo kubectl create -f ./perftestimg.yamlto deploy the first of 5 pods in edge node - Execute 
sudo kubectl get pods | grep Running | wcto check if all the pods come to Running state. Once all pods come to running state, go to edge VM - On Edge console, execute 
ps -aux | grep edgecore. The output shall be something like: 
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root     102452  1.0  0.5 871704 42784 pts/0    Sl+  17:56   0:00 ./edgecore
root     102779  0.0  0.0  14224   936 pts/2    S+   17:56   0:00 grep --color=auto edge
- Collect %CPU, %MEM and RSS from respective columns and record
 - Repeat step 2 and this time increase the replica by 5
 - This time execute 
sudo kubectl apply -f <PATH>/perftestimg.yaml - Repeat steps from 4 to 6.
 - Now repeat steps from 7 to 9, till the replica count reaches 100