avatar

Naufal's Blog

Software Engineer

Automating Deployment on Virtual Machines

I have experience where when we want to deploy our service should contact ops team. This is really takes time because sometimes those ops team very busy or need to contact ops team that takes time. So i think we should automate this to improve our SDLC. For this example i use github and github action to accomodate automation flow. Lest start. First create github token that will we used in our runner. Runner means a ‘virtual machine’ that we used for run testing and build docker image. To access our repository and github action, the runner should have github token. For simplycity we can use personal access token

Socket Sharding

Is it possible for us to listen on the same port within the same machine and application? The answer is yes—it is possible. The OS kernel provides an option called SO_REUSEPORT, which allows multiple sockets to bind to the same port for the same application and user. For example, we can run TCP server A on 0.0.0.0:8080 and, at the same time, run TCP server B on 0.0.0.0:8080 using SO_REUSEPORT.

Geohash

Have you ever thought about how to search for locations near specific coordinates, like in Google Maps? My first idea was to save the longitude and latitude in a database like MySQL or PostgreSQL. Adding an index to the longitude and latitude columns can help speed up queries, but it’s still inefficient. In 2008, geohashing was introduced by Gustavo Niemeyer as a solution. Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer and (similar work in 1966) G.M. Morton, which encodes a geographic location into a short string of letters and digits.

SQL Phenomena

When using PostgreSQL, certain phenomena can occur due to concurrent transactions. Below are some potential issues that might arise: