April 22, 2020

The Cache Replacement Problem

Intro Tradeoffs between time and space complexity often need to be made in computing. A solution that is faster at the expense of using more storage is usually preferred. One way to make a solution faster is to save the results of expensive operations in a cache for later use. Since cache capacity is limited and is usually much smaller than the amount of data the algorithm requires, caching every result is not practical. Read more

May 21, 2018

Targeted Quantiles in Prometheus

The algorithm behind Prometheus’ Summaries. Abstract Prometheus uses a technique called Targeted Quantiles to implement the Summary metric type which is used to monitor distributions, such as latencies. Here, we give an overview of how the algorithm works, we answer why it is so efficient and how to configure Summaries. Introduction A very important way of understanding how your distributed system works in production is to monitor it. In recent years, Prometheus has emerged as the most popular monitoring system for applications deployed on Kubernetes. Read more

February 1, 2018

Scheduling in Kubernetes

The importance of understanding the implementation of the tools we use in production every day cannot be underestimated. This process informs about the trade-offs engineers made in the implementations. Knowing a tool’s strengths and weaknesses helps better design systems on top of it; it exposes potential failure modes and helps debug critical errors when they occur. It also reveals brilliant ideas, tricks, patterns and conventions used in production systems. In this post, I will go through the implementation of the default scheduler in Kubernetes (k8s). Read more

February 17, 2017

[video] Introduction to GraphQL

Introduction to GraphQL This post embeds a recorded presentation I gave at the offices of Pusher where I currently work. The talk is a short introduction on GraphQL. My goal here is to describe how GraphQL works, how it positions against similar approaches and to give an example of how one might use it to design an API for a blog engine. If you want more details about that process I previously wrote a blog post GraphQL with Go and PostgreSQL and an implementation at github. Read more

February 11, 2017

Writing Quality Golang Code

The tools I use to help produce quality Golang code Abstract Go has excellent libraries for source-code parsing. These have enabled the creators of Go and the open source community to produce a variety of tools which help eliminate errors in advance. The large number of tools and the lack of documentation on how to best use them presents a problem for engineers. This blog post describes the process and the tools I use to improve code quality and catch bugs early in my Go code. Read more

January 22, 2017

GraphQL With Golang and PostgreSQL

Building a Blogging Engine API with Golang and PostgreSQL Abstract GraphQL appears hard to use in production: the graph interface is flexible in its modeling capabilities but is a poor match for relational storage, both in terms of implementation and performance. In this document, we will design and write a simple blogging engine API, with the following specification: three types of resources (users, posts and comments) supporting a varied set of functionality (create a user, create a post, add a comment to a post, follow posts and comments from another user, etc. Read more