© Fadila Khadar

© Fadila Khadar

Hi there!

I’m Fadila Khadar, a software engineer with many years of experience in dealing with distributed systems and their scalability.

These are some notes about the projects I’m working on and the difficulties I faced doing so.

Expect these notes to be about software development, with a focus on distributed systems.

♦ ♦ ♦

Latest Notes

Getting the PostgreSQL Documentation as an epub

I wanted to have a look at the postgreSQL documentation but didn’t find it easy to read using their online version. So I went for the pdf, available on postgres’ website, but it renders very badly on my reader.

Going through the doc source code, I noticed there is a doc directory, with a Makefile in doc/src/sgml/. It has a epub target, but running ‘make epub’ I get the following error:

bin/sh ../../../config/missing dbtoepub -o postgres.epub postgres-full.xml
***
ERROR: `dbtoepub' is missing on your system.
***
make: *** [Makefile:171: postgres.epub] Error 1

Read more...

Article Summary: Understanding Real-World Concurrency Bugs In Go

I came across an interesting research article on concurrency in Go by Tengfei Tu, Xiaoyu Liu, Linkai Song and Yiying Zhang exploring real-world concurrency bugs in Go. They study six open-source applications, all written in Go and available on Github: Docker, Kubernetes, etcd, gRPC, CockroachDB, BoltDB.

They first give a brief overview of goroutines synchronization techniques, namely shared memory (Mutex, RWMutex,Once Cond, WaitGroup) and message passing.

Golang recommends using message passing (‘‘Share memory by communicating, don’t communicate by sharing memory’’). Interestingly, they also compare the number of goroutines created in gRPC to the number of threads created in gRPC-C and their lifetime with three simple client/server applications. The result is that more goroutines are created in gRPC than threads are in gRPC-C, but they have a way shorter lifetime. The threads created by gRPC-C lives until the end of the application.

Read more...

Setting up a reverse proxy serving Gitea with Gin

A reverse proxy receives requests and redirect them to the right host. It is very useful when you have only one server but need to serve several websites with domain names (or sub-domains).

Overview of the reverse proxy

Overview of the reverse proxy

In my case, I want to serve two sub-domains:

  • fadila.khadar.dev, this static website.
  • gitea.khadar.dev, a self-hosted all-in-one software development service.

So the idea is to have a docker container running for each site to be served, and another one that will act as reverse proxy. I use docker compose for this, but I won’t cover this here.

Read more...

Networking Cheat Sheet

Iptables

Redirect port 443 to port 3000 (tcp)

iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 3000

Delete a redirect

Just have to use the -D option:

iptables -t nat -D PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 3000

netstat

List open ports

sudo netstat -tulpn | grep LISTEN

Rsync

Use a different port than ssh’s default (22):

rsync -av -e 'ssh -p PORT' source user@host:/path/to/dest
Read more...