github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/docs/setup/memfootprint-test-setup.md (about)

     1  # Measuring memory footprint of EdgeCore
     2  
     3  ## Why measuring memory footprint
     4  
     5  - This platform is also tagged for a light weighted edge computing deployment
     6  - To be able to be deployed over devices with less resources (for example, 256MB RAM)
     7  - It is required to know by deploying as many as possible pods, it showcases as much as less possible memory footprint
     8  
     9  ## KPI's measured
    10  
    11  - %CPU
    12  - %Memory
    13  - Resident Set Size (RSS)
    14  
    15  ## How to test
    16  
    17  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.
    18  
    19  ### Test setup
    20  
    21  ![KubeEdge Test Setup](../../docs/images/memfootprint-img/perftestsetup_diagram.PNG)  
    22  
    23  *Fig 1: KubeEdge Test Setup*
    24  
    25  ### Creating a setup
    26  
    27  #### Requirements
    28  
    29  - Host machine's or VM's resource requirements can mirror the edge device of your choice
    30  - Resources used for above setup are 4 CPU, 8GB RAM and 200 GB Disk space. OS is Ubuntu 16.04.
    31  - Docker image used to deploy the pods in edge, needs to be created. The steps are:
    32      1. Go to github.com/kubeedge/kubeedge/edge/hack/memfootprint-test/
    33      2. Using the Dockerfile available here and create docker image (`perftestimg:v1`).
    34      3. Execute the docker command `sudo docker build --tag "perftestimg:v1" .`, to get the image.
    35  
    36  #### Installation
    37  
    38  * For KubeEdge Cloud and Edge:
    39  
    40      Please follow steps mentioned in KubeEdge README.md
    41  
    42  * For docker image:
    43  
    44  - 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/
    45  - Create `perftestimg:v1` docker image on the above mentioned host
    46  - Then push this image to docker registry using `docker tag` and `docker push` commands (Refer: Same docker registry url mentioned above)
    47    [Use this image's metadata in pod deployment yaml]
    48  
    49  ### Steps
    50  
    51  1. Check edge node is connected to cloud. In cloud console/terminal, execute the below command
    52  
    53  ```
    54  root@ubuntu:~/edge/pod_yamls# kubectl get nodes
    55  NAME                                   STATUS     ROLES    AGE     VERSION
    56  192.168.20.31                          Unknown    <none>   11s
    57  ubuntu                                 NotReady   master   5m22s   v1.14.0
    58  ```
    59  
    60  2. 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
    61  3. Execute `sudo kubectl create -f ./perftestimg.yaml` to deploy the first of 5 pods in edge node
    62  4. Execute `sudo kubectl get pods | grep Running | wc` to check if all the pods come to Running state. Once all pods come to running state, go to edge VM
    63  5. On Edge console, execute `ps -aux | grep edgecore`. The output shall be something like:
    64  
    65  ```
    66  USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    67  root     102452  1.0  0.5 871704 42784 pts/0    Sl+  17:56   0:00 ./edgecore
    68  root     102779  0.0  0.0  14224   936 pts/2    S+   17:56   0:00 grep --color=auto edge
    69  ```
    70  
    71  6. Collect %CPU, %MEM and RSS from respective columns and record
    72  7. Repeat step 2 and this time increase the replica by 5
    73  8. This time execute `sudo kubectl apply -f <PATH>/perftestimg.yaml`
    74  9. Repeat steps from **4 to 6**.
    75  10. Now **repeat steps from 7 to 9**, till the replica count reaches 100