The Architecture of SQLAlchemy


Interacting with the databases involves the executions of SQL expressions. In early days, people manipulate through raw SQL strings. However, it has several disadvantages.

  • It needs different database drivers.
  • There are various SQL dialects, that is, these SQL expressions might look different in different databases.
  • String manipulation increases security …


Dear my readers, this is the update of week 38 of 2018.

First thing first, four posts have been made.

What's more, with the help of Pelican, now subscribing the RSS feed is getting easier: . You may …



WSGI is the de facto standard interface in Python Web Programming around web servers, frameworks, and applications. However, it sticks into synchronous programming and makes itself hard to support new protocols like WebSocket.

ASGI is a successor of WSGI. Its goal is to provide a unified interface for asynchronous …


WSGI or Web Server Gateway Interface is a specification of PEP 3333 that defines how the web server communicates with Python web applications.

In this post, we will cover below topics:

  • Basic concepts in WSGI
  • Things not defined in WSGI
  • Booming Web Frameworks
  • Pros and Cons
  • Conclusions


  • WSGI is …

The Architecture of APScheduler

APScheduler is a job scheduling framework that executes code either one-off or periodically. People often integrate it into an existing Python application for running interval jobs.

In this post, we will cover below topics:

  • What are the basic concepts of APScheduler?
  • How does object-oriented programming help extending the use cases …

Pseudo-Random Numbers


PRNG or Pseudo-random number generators are used for generating numbers distributed randomly.

The reason of being pseudo-random is that the PRNG algorithm doesn't generate true-random information actually.


  • RNG: Random Number Generators. It's a general classification regardless of generating psuedo-random or true-random numbers.
  • PRNG: Pseudo-Random Number Generators. The pseudo …

Layered Architecture


The layered architecture has several other names, such as onion architecture, the clean architecture, etc. The basic theory is, you organize the components layer by layer in which only the upstream layer can make calls to the downstream layers.

Most systems are designed in the layered architecture.


  • MVC …


Dear my funders, there is a tremendous change on UI this week!

It's based on Pelican and theme Medius. Almost all old posts have been migrated into the new blog. Besides, I added Disqus comment widget and tagging system.

Below is a sample screenshot.

New Look

Any feedback, please let me know …


Dear my funders, here comes the new issue.

Two-Phase Locking. The 2PL is the basic algorithm in relational database.

Airbnb Architecture. It's quite interesting to outline the architecture of Airbnb without knowing too much details. Fortunately, the Airbnb engineering blog reveals a lot of information so that we can know …

Airbnb Architecture


Airbnb is a website that operates an online marketplace and hospitality service for people to lease or rent short-term lodging. The challenges for the engineering team includes high-availability, quick-scaling, etc. In this post, I put the architecture of Airbnb website in one article. Please tweet to @enqueuezero if you …


The 2PL or Two-Phase Locking is a method to reach serializability.


Dear my funders,

This is the weekly newsletter on Enqueue Zero new posts. I'm trying to break down topics into small posts. The tiddlywiki has a nice feature that it can include some other notes into one note, for example, this is the raft topic that compiles from below three …



As the earth is a sphere, different places in the world will have different clocks. Human invented timezone to split the globe into 24 areas by regions. The UTC or Coordinated Universal Time is the primary time standard by which the world regulates clocks and time.

Programmers need to …

Periodic Scheduler


It’s a fundamental requirement that we need to run a command at a specific time.


Periodical Scheduler schedules code to be executed periodically. It has below features:

  • Job managing, meaning adding new jobs, removing old ones, or modifying existing ones.
  • Job storing.
  • Run as a long-running process …

The Difference between SLI, SLO, and SLA

The SLA, SLO, and SLI are related concepts though they're different concepts.

  • SLA or service level agreement is a contract that the service provider promises customers on service availability, performance, etc.
  • SLO or service level object is a goal that service provider wants to reach.
  • SLI or service level indicator …

Raft and Stream Paradigm

The stream is a data structure that evaluates data when we need them. Below is a typical Python Stream.

from functools import lru_cache

class Stream:

    def __init__(self, head, restfn=None):
        self.head = head
        self.restfn = restfn

    def stopped(self):
        return self.restfn is None

    def rest …

Raft and Unreliable Network

The synchronization of the Raft states among nodes in the cluster imposes order on messages. However, the unreliable gears make the ordering very difficult. Sometimes, it plays like a thief stealing your data packets. Sometimes, it plays like a jerk swapping the order of data packets sending to a node …

Raft and The Nature of Time

The Raft consensus algorithm assumes nodes are in the vicinity, meaning they should be able to communicate very fast. Let's imagine the case of one node on Earth, one node on Mars, and one node on the Moon. It would take minutes for messages communicating between nodes and hence minutes …


Dear my pledgers, here comes our new issue.

  • FFI. Foreign Function Interface is a bridging technology between VM languages and shared libraries. I wrote this post after a tough battle in implementing FFI in my previous educable scripting language ao. Besides, I introduced Grammarly to help improving grammar and verbals …

Container and Cgroups

Cgroups is a Kernel feature that organizes processes into hierarchical groups to limit and monitor their system usage such as CPU, memory, disk, network and so on.

The Linux kernel provides a pseudo-filesystem named cgroupfs as the interface. A cgroup is a set of processes which has settings in cgroupfs …