In the last few years, the use of containers has increased significantly. The concept of containers have been around for several years, but it was Docker’s easy-to-use command line that started to popularize containers among the developer from 2013.

In this series I am trying to demonstrate how containers work underneath and how I did develop the vessel.

What is vessel?

vessel is an educational-purpose project of mine which implements a tiny version of Docker to manage containers. It does not use either containerd or runc, it uses a set of the Linux features to be able to create containers.

vessel is neither…

Go is a programming language often used for applications in which performance matters. Optimizing your code based on assumptions is not a best practice of course. You need to have insights about your code performance and bottlenecks to be able to optimize it efficiently.

What is a profiler?

Profiler is a dynamic performance analysis tool that provides critical execution insights in various dimensions which enable resolving performance issues, locating memory leaks, thread contention and more.

To err is human, to forgive divine.
— Alexander Pope

These are mistakes that I’ve made writing Go. Although these might not cause any sort of error but they can potentially affect the software.

1. Inside Loop

There are several ways to make a mess inside a loop which you need to be aware of.

1.1 Using reference to loop iterator variable

Due to efficiency, the loop iterator variable is a single variable that takes different values in each loop iteration. It might lead to unwitting behavior.

Using reference to loop iterator variable

The result will be:

Values: 3 3 3
Addresses: 0xc000014188 0xc000014188 0xc000014188

As you can see all…

I encountered a problem in Go Garbage Collection inside a project of mine recently. A massive amount of object were allocated repeatedly and caused a huge workload of GC. Using sync.Pool I was able to decrease the allocations and GC workload.

What is sync.Pool?

One of the highlights of Go 1.3 release was sync Pool. It is a component under the sync package to create a self-managed temporary retrieval object pool.

Why to use sync.Pool?

We want to keep the GC overhead as little as possible. Frequent allocation and recycling of memory will cause a heavy burden to GC. sync.Pool can cache objects that are not used…

Ali Josie

Software Engineer at Harlem Next

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store