I was carrying out a performance test in order to compare the performance of my app running on host and inside docker container.
Here’s brief introduction on my application:
- Frontend UI written in Vue.js and deployed its static files in NGINX-alpine container.
- Backend API server written in flask, communicate with zeebe broker inside the container.
- Utilizes Zeebe broker(inside container also, i put zeebe tar.gz file inside the container and unzipped it to install) to submit multiple data processing job to remote clusters when requested by from client by browsers. This leads to multiple extra processes creation.
My test environment info:
8core CPU / 32GB RAM / Ubuntu 20.04 LTS
When starting sending bunch of requests (over hundreds) to application, my logging process starts recording host’s overall cpu usage and memory usage using python psutil library (cpu_percent()/virtual_memory().percent). This is done by application itself, which means when performing test, psutil recording is done on host machine if app is running on host machine and is done inside the docker container if app is running inside docker container.
There’s NO resource usage restriction on any of my containers and from within my container, when I do:
cat /proc/cpuinfo
cat /proc/meminfo
I get exactly the same result as the one I get from host, which means full cpu/mem is accessiable to the application inside container.
But from the result of psutil recording, it seems when my application is running within container, it shows less cpu usage (in percent)….
But to my knowledge, processes inside docker container are just isolated in terms of environment, the usage of host’s resources such as CPU/RAM should be larger if same application is running inside the container, because same thing is happening but with docker daemon etc., which causes extra resources usage.
I tried manually running psutil recording directly on host and inside the container when sending multiple requests, i don’t really see any difference, which means this is not the problem caused by psutil inside container collecting wrong info.
Chanbin Park is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.