The Tengine Web Server

“Tengine is a web server originated by Taobao, the largest e-commerce website in Asia. It is based on the Nginx HTTP server and has many advanced features. Tengine has proven to be very stable and efficient on some of the top 100 websites in the world, including and…”

Linux 3.9 introduced new way of writing socket servers

“Linux kernel 3.9 came with an interesting feature: ability to bind multiple listening sockets to the same port on the same host, by unrelated processes or threads. The socket option is called SO_REUSEPORT and here is an article by Michael Kerrisk describing the feature.

The article makes SO_REUSEPORT look like it’s a performance hack relevant only to multithreaded Google servers, but the option works also for processes and gives a new way of thinking about multiprocess socket servers. There are two standard UNIX designs of such servers: …”

CloudFlare’s new WAF: compiling to Lua

“We use nginx throughout our network for front-line web serving, proxying and traffic filtering. In some cases, we’ve augmented the core C code of nginx with our own modules, but recently we’ve made a major move to using Lua in conjunction with nginx.

One project that’s now almost entirely written in Lua is the new CloudFlare WAF that we blogged about the other day…”

“The Lua WAF uses the nginx Lua module to embed Lua code and execute that code as part of the normal nginx handling of phases. The entire execution of the WAF is actually handled by the following nginx configuration:…”

Rust’s Memory Management

“Rust seems to intimidate newcomers, as its memory model is fairly complex. I think part of the problem is that the language tutorial introduces the memory model by feature. Rather, I’ll introduce it by concept, showing examples of code that breaks memory safety in C, and how Rust’s memory model prevents the error. Hopefully I can convince you that Rust isn’t as complex as it looks, and that the extra syntax is well-worth the zero-cost memory safety. I’ll be comparing Rust code to equivalent C idioms using the zeromq library because it has a very clean API in both languages. As such, I assume basic familiarity with C. Rust is not a very suitable language for new programmers, and neither is this tutorial…”