Skip to content

pipedrive/container-performance-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

container-performance-analyzer

Container-based solution for performance analyzes

WHY?

Currently there are plenty of tools to analyze performance of the application running on host machine (unix/Mac) while services running inside containers are still something black-boxed. So, this is a special container-based tool to run performance analyzes

PRE_REQUESTS for NodeJS

First of all, node won't generate useful .map files without the following arguments:

  • --trace-deopt
  • --perf-basic-prof

So in order to be able to see useful information in flame graphs, enable these 2 parameters. Try not to leave out these 2 parameters for long time in LIVE usage, because .map files are generated excessively, making FS do some work ;)

HOW?

In order to perform analysis against any container you can simply run: ./run-analysis.sh <container id> <time in seconds> Analysis report will appear in the ./reports directory

Please refer to the file ./lib/analyzer.sh for all possible parameters. But in general it's simply running container with some parameters. Simplified example:

# ${CONTAINER_ID} - id of the the container to be analyzed
# ${REPORTS_ROOT} - root folder where all reports will be available
# ${ANALYZING_TIME} - time in seconds to perform analyzes

docker run -it --rm --privileged --pid="container:${CONTAINER_ID}" -v /var/run/docker.sock:/var/run/docker.sock -v ${REPORTS_ROOT}:/tmp/reports pipedrive/container-performance-analyzer ${CONTAINER_ID} ${ANALYZING_TIME}

In order to run performance analyzer for different processes simply include pattern as PROCESS_PATTERN env variable (don't forget to put first letter in []):

(why []? => simply so PS itself won't end up in list of processed to analyze :-) )

For PHP:

# ${CONTAINER_ID} - id of the the container to be analyzed
# ${REPORTS_ROOT} - root folder where all reports will be available
# ${ANALYZING_TIME} - time in seconds to perform analyzes

docker run -it --rm --privileged --pid="container:${CONTAINER_ID}" -e PROCESS_PATTERN='[p]hp' -v /var/run/docker.sock:/var/run/docker.sock -v ${REPORTS_ROOT}:/tmp/reports pipedrive/container-performance-analyzer ${CONTAINER_ID} ${ANALYZING_TIME}

Other kernel versions

Please refer to Dockerfile and change linux-perf-X to kernel version your host machine is running.

Whats generated:

  • .html - files containing flame graphs generated by 0x. Quite useful out of the box
  • .out - actually this is source for any tool which can generate flame graphs. Feel free to use your favorite one :)

Inspired by

http://www.brendangregg.com/perf.html

https://github.com/davidmarkclements/0x/tree/c15fb159a3bc03fa47e7ba8766132d2f0bf713f6

http://man7.org/linux/man-pages/man1/perf-record.1.html

http://man7.org/linux/man-pages/man1/perf-script.1.html

https://gist.github.com/trevnorris/9616784

https://yunong.io/2015/11/23/generating-node-js-flame-graphs/

Flamecharts generated using

All flamecharts are generated using: https://github.com/davidmarkclements/0x

About

Small utility to analyze performance inside containers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published