Golang Memory Leaks

Recently, I had a memory leak in production. I saw that a specific service’s memory steadily rises when under load, until the process hits an out of memory exception. After a thorough investigation, I found out the source of the memory leak as well as the reason to why it happened in the first place. To diagnose the problem, I used Golang’s profiling tool called pprof. In this post, I will explain what is pprof and show how I diagnosed the memory leak.

User Space Scheduling

A scheduler is a complex piece of software that is responsible for making sure cores are not idle if there are Threads that need work to be done.
The fast switching of Threads, also called a context switch, is done by the scheduler and it gives us the illusion that all of our processes run in parallel.
We have schedulers both in the Kernel of our favorite OS and in the user space, where our programs live and run.
Some types of programming languages leverage one type of scheduling, while others leverage another.
In this blog post, I will explain what a scheduler is and compare how scheduling affects different programming languages.

Authentication Middleware in Elixir

One of the first projects I was working on in Elixir was an API gateway. Like everyone else, I saw Pheonix, which is a cool framework for building web servers which is similar to Express.js, but, for my use case, I wanted raw performance for the API gateway, and one of its features was to have basic authentication as well as bearer authentication for json web tokens. One way to achieve this was using Plugs, which are built in the language. A plug is similar to a middleware in Express.js, it accepts input, does some manipulation and either halts the request or passes it on. In this post I will show how I implemented an authentication plug in Elixir.

Switching From Node.js to Elixir

After writing software for the past 6 years, I realized that the implementations that we write are far more important than the languages we choose, but, having a developer friendly, safe, strict language, can guide you towards better implementations. That is why I set out to search for a new programming language, that will replace my daily driver - Node.js. In a search for a new programming language, I asked myself two questions - what are the must-have features I expect from a programming language? and do its pros outweigh its cons?
In this post, I will weigh some of Javascript’s pros and cons, later on, I will list the features, I believe, a programming language should have, afterwards, I will explain why I chose to learn Elixir and at last, I will weigh Elixir’s pros and cons.

The Javascript Event Loop

After writing in Node.js for 3 years, I felt that the majority of the posts about it were lacking deeper knowledge, especially about the event loops internals, so, I decided to dig deep and give you my insights. Node.js seems like a simple beast to handle but in reality, there are a lot of layers of abstraction behind it. From one perspective, this abstraction is great, but, like everything else in software, abstraction comes at a cost.
The purpose of this post is to show you a broader picture of how the Node core handles the event loop, what it really is and how it coexists with the JS runtime.

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×