The story about the way to make commit messages in your repository more clear.

Intro

Hi! I’m using git pretty long, and I think this is the best version control system ever. Moreover, today this is de-facto standard in development, no matter which technology you are using. But there are several problems. One of them is the commit message. Did you see something like: “fix” or “add tests”? Of course, you do. In every company I’ve ever worked for, there was a set of rules of how to style your commit messages. You know, format like: “ISSUE-XXX: Fix padding for warning dialog”. And that was great, except the existing set of rules means nothing without…


I’ll to show you that being a great engineer that produce good code, chooses perfect architecture decisions, doing fast, etc., isn’t enough today.

Intro

Agree? No? So, let’s try to deep dive into the problem. Now, I’ll try to show you, by telling the story, that being a great engineer that writes good code, chooses perfect architecture decisions, doing fast, etc., isn’t enough today. In my opinion, software engineering today and 20 years ago is absolutely different things. In those days, engineers could do a project by a team of three people who know each other well, work together for ten years, and perfectly understand each other. Now, engineers work for a particular company one, maybe two, years on average. …


How to properly set process threads limit on modern Linux systems.

Intro

By default, the kernel itself doesn’t have a per-process thread limit. Strictly speaking, for the kernel, almost there is no difference between process and thread — all is a task. But kernel has different limits for max threads count and max pids count (max processes). Of cause for the servers default limits (at least for pids) may be too small, so it is pretty usual to see appropriate sysctl. But in practice pids limit, and tasks limit (introduced by systemd through cgroups) are much more associated than it might seem at first sight. …


Are golang binaries statically linked? How to check this and what need to do to prevent troubles on different operating systems.

Hello! As you know, linking in golang is static. It means that all libraries need to run our programs included in our final binary. And this is great — no more version problem, most straightforward deployment, etc. The only tradeoff is binary size, but this is not a problem in 2020. Perfect. Let’s do a small test using a docker multi-stage build feature. Assume we have a simple golang code

package mainimport (
"fmt"
)
func main() {
fmt.Println("Hello, world!")
}

Let’s build it on Alpine Linux, but run on Ubuntu. Dockerfile can look like

FROM golang:alpine as build


How to serve Prometheus metrics from multiprocessing app, like Gunicorn. Known issues of multiprocessing mode.

Intro

Prometheus is a popular software for monitoring and alerting. Written on Golang, Prometheus uses a pull model. It means that we need to provide endpoint, usually /metrics, where scrapping jobs from Prometheus can find our metrics. Cool. Let’s start.

Problem

So, let’s say we have a wsgi application, started by Gunicorn. We need to count some requests. Using prometheus_client we write something like

from prometheus_client import Gaugeg = Gauge('db_failed_requests_count', 'Failed db requests count')g.inc()

But there is a problem. This value is stored inside process memory. In Python, we lunch multiple processes serving requests. So, a request can be handled…


Is production configuration is so explicit: what does exactly timeout option mean, why sync worker is better than threads and why preload isn’t always a good option.

Introduction

Hi there! Let’s talk about the production configuration of Gunicorn. As you know, Gunicorn is an accessible WSGI HTTP server, which can be easily configured, deployed, and maintained. Another reason why it’s so popular is an HTTP protocol. You don’t need specialized modules for your favorite reverse-proxy, like ngx_http_uwsgi_module for Nginx + uWSGI setup, or mod_wsgi for Apache. You even can deploy your service without any load balancer or proxy, but please, don’t do that :) Finally, HTTP is simpler for debugging. But is production configuration is so explicit? Let’s find out!

Plan

What you’ll find here:

  • Sync workers configuration: type…

Pavel Sapezhko

Engineering from hell with love.

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