Profiling containers and applications

Our application components must also be profiled to produce instruction-level information and call stacks for us to analyze, not just to track performance but also to debug application flaws. The strace tool can be used to record system calls made by a running docker container. As an example, get the process ID for our orderer container as follows:

docker inspect --format '{{ .State.Pid }}' orderer.trade.com
Recall that our container was named orderer.trade.com in our docker-compose YAML file. The output will be a process ID; let's call it <pid>. Now run strace on that process:
sudo strace -T -tt -p <pid>

You should see a continuous output, something like the following:

strace: Process 5221 attached 18:48:49.081842 ...

Get Hands-On Blockchain with Hyperledger now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.