[Memory-metrics]: Linux /proc interface

This writeup is more of a demo to showcase the power of “proc” (process information pseudo-filesystem) interface in linux to get the memory details of process, and also a quick brief on the power of “proc interface”. In the current trend of building abstraction over abstractions in software/tooling, very few tend to care about the source of truth of a metrics. There are various APM / Monitoring tools to get the memory details of a process for a linux system, but when the need arises, I believe, one must know the ways of going closer to the source of truth on a linux system and verify things. ...

August 22, 2022 · 6 min · Akshay Deshpande

Docker: A list of most frequently used commands

This writeup is a dump of my study notes on most frequently used docker commands for reference. This is just a self reference page and will get updated on the go To run a container from an image docker run <image name> To run a docker image with a specific tag. Example below of pulling redis image with tag4.0. You will get these tag details on the dockerhub page for the image docker run redis:4.0 To run a docker image in detached mode docker run -d <image_name> To run a docker image and login to the container directly docker run -it <image_name> To list all the docker images docker images To pull a docker image from dockerhub but not run it. docker pull <image_name> To list all the docker containers docker ps -a To stop a docker container docker stop <container_name> To remove a docker container form the disk. Note: This will remove the container permanently. It will not list anymore in docker ps -a. However, the image still exists. The exited/stopped containers do not consume any CPU or memory, but they still use the machine’s disk space. docker rm <container_name> To remove a docker image docker rmi image To execute a command in a running docker container docker exec <container_name> <command> To get the ip of a docker container docker inspect <container_id/container_name> | grep IPAddress To map the internal port of a docker container to a host port docker run -p 80:5000 <image_name> To get the logs of a container docker logs <container_name> To build a docker file docker build . #from being in the dir which has Dockerfile To map an external directory at the bootup to a docker container docker run -v /myCustomdir:/defaultDir -u root imageName

April 7, 2022 · 2 min · Akshay Deshpande

[Performance] : Understanding CPU Time

As a Performance Engineer, time and again you will come across a situation where you want to profile CPU of a system. The reasons might be many; like, CPU usage being high, you want to trace a method to see its CPU cost or you suspect CPU times for a slow transaction. You might use one of the various profilers out there to do this. (I use yourkit and Jprofiler). All these profilers report the CPU costs in terms of CPU Time, when you profile the CPU. This time is not the equivalent of your watch time. ...

July 24, 2021 · 3 min · Akshay Deshpande

Shell Scripting - Functions [Part2]

This post is a followup on the first article - basics of Shell scripting [here - note: increasing the scope beyond Performance Engineers only]. In this write up we look at how to modularize a shell script using Functions and how to create a set of useful functions -> convert them in to library -> use them across scripts. Functions: It is a good practice to write shell scripts as functions rather than stand alone scripts so that they can be easily incorporated in to other scripts without incurring the overhead of system calls. While there is no import feature like in Python, there are capabilities of Sourcing files is shell scripts. But first, lets look at ways of writing functions and invoking them. ...

October 6, 2019 · 3 min · Akshay Deshpande

Shell Scripting for Performance Engineers and others - [Part 1]

Performance Engineers go through a set of manual tasks time and again. Be it for creating data for the load test, triggering of the test in a particular sequence / at a particular time or post processing of data collected after the test. The general rule of thumb is - anything that takes more than 10 minutes and has to be done more than two times a week has to be automated. That is a minimum of 1040 minutes saved per year - 2 working days / year per person. To achieve automation, although the world has come to Python & Scala for sophisticated solutions, quick and dirty Shell Scripts will never go out of style. I would not go for sophisticated / complex solutions, if the same can be attained in less than 20-lines of a quick Shell Script. ...

April 30, 2019 · 4 min · Akshay Deshpande