Nginx Blocking

What’s blocking? Nginx has one master process and multiple worker processes, and each worker process is single threading. It’s well known that NGINX uses an asynchronous, event‑driven approach to handling connections. This means that instead of creating another dedicated process or thread for each request (like servers with a traditional architecture), it handles multiple connections and requests in one worker process.

Analyze Lua Memory Leak With Systemtap

Use systemtap to analyze the memory leak of lua code The memory used by lua code is managed by the GC, not calling malloc/free/mmap directly. The luajit GC uses mark-and-sweep algorithm. In simple words, it links all allocated gc objects in a global list.

Gdb Black Magics

Without questioin, gdb is a brilliant weapon to debug our program. However, the reality is complex. We need black magics to handle these cases. Magic1: optimized out? Your program is normally compiled in optimized mode (e.g. -O2), sometimes even without debug info!

Luajit String Interning

Why string interning? String Interning is a common optimization in most of programming languages. As the wiki said: In computer science, string interning is a method of storing only one copy of each distinct string value, which must be immutable.[1] Interning strings makes some string processing tasks more time- or space-efficient at the cost of requiring more time when the string is created or interned.