Learn Golang - a Mind Map

Earlier this year I started to learn Golang. There were three good reasons why I wanted to learn this programming language.

1. For work: Some of the projects my team worked on, or planned to work on, use Golang to improve applications’ performance.
2. For better understanding cloud infrastructure: Some of the key cloud infrastructure open source projects, including Kubernetes and Docker, are written in Golang.
3. For using it to easily create multithreaded and concurrent programs.

One thing I did when learning Golang was creating a mind mapping diagram. The mind map helps me to organize the different topics of Golang that I need to learn about, and to dig into each part without getting lost in too many details. It also makes it much easier to remember information.

If you are also learning Golang, you can take a look at the Golang mind map here on my github. It mainly covers Golang syntax, flow control, data structures, methods, functions, interfaces and basic concurrency. One thing it doesn’t have yet is Go Modules, which was added in Go 1.11 (released in August 2018). As Go dev team announced, current module support is priliminary. In Go 1.12, scheduled for February 2019, they will refine module support. I will update this mind map to add Go Modules then.

Lastly, 2019 is around the corner. Happy New Year!

Reading Notes - Designing Distributed Systems

Recently I read a book Designing Distributed Systems, which is written by Brendan Burns, and published by O’Reilly earlier this year. This book introduces the patterns and components used in the development of distributed systems.

Before I started to read this book, I had three questions in my mind, and try to find the answers from the book. Those three questions are:

1. What’s the most important difference between designing distributed systems and single machine systems?
2. Why container technology, such as docker, kubernates, is so popular? How could it be helpful?
3. What are the common patterns used in distributed systems design, and when shall I use them?

This book does give me the answers, at least partial ones. I put my reading notes into a Google Slides, and you can find it here to read the details. A PDF version in light background color is available here.

The short answers to my questions are as in the following:

Performance Profiling Tools on Windows

Last year, I wrote a blog post about CPU Profiling and the tools on Linux. Today I’m going to write about a few Performance profiling tools on Windows platform. Last week I was working on profiling and analyzing the build process of a project on Windows, and during the process I experimented with a few different tools.

Performance Monitor (perfmon)

Performance Monitor is a small utility provided by Windows OS, you can start it by running command perfmon. With perfmon, you can monitor real-time system performance, and record performance to files for post analysis. This tool provides some extremely useful interfaces in its GUI.

Real-time Performance

To view current performance activity, you just need click on the Performance Monitor button in the left panel:

Effective Jenkins Plugins (1)

(Update 2018-05-13: Here is a translation of this post in Hindi, provided by Nikol @ DealsDaddy.)

Jenkins, originally founded in 2006 as “Hudson”, is one of the leading automation applications which support building, deploying and automating software projects. One great advantage of Jenkins is there are hundreds of plugins available which enable various kinds of extended features needed in the Continous Integration and Continuous Delivery process. As I just checked on the Jenkins Plugins page, there are 873 plugins that fall into five categories: Platforms, User interface, Administration, Source code management and Build management.

Effectively using Jenkins plugins makes your experience with Jenkins more productive. I’m going to occasionally write about Jenkins plugins that I used or learned about. The first post will start from some of the plugins I used when I worked on building a Continuous Delivery system last year (from 2015 to 2016).

Job Configuration History

JobConfigHistory Plugin

This plugin saves every change made to a job. It allows you to see the history of job configurations, compare configuration differences, and restore a particular version of config. You can also see which user makes a particular change if you configured a security policy.

Python: Why Decorators Are Useful

In Python, by definition decorators are functions that accept a function as an argument, and return a new function as their return value. The reason why decorators exist in Python, but not in other similar language such as Ruby, is that functions are objects in Python. Functions can be assigned to variables and passed around the same as other object in Python. For example, a list can have functions as its elements, and functions can take other functions as arguments. Functions can be defined inside another function, and this forms closures.

When to use decorators?

It’s easy to understand what decorators are, while the real question you may have is: Why decorators are useful? When shall I use decorators in my Python program?

In some way, I see decorator functions are useful whenever you need process or extend the inputs or outputs of a given function (or more often, multiple functions) in some way you want. Here I list three usages of decorators that I can think of: