Introduction to Tengine Web Server

Tengine seems to be a popular web server for Chinese websites. I’ve come upon it while browsing through Aliexpress and stumbling upon a 404 error:

This error and more specifically its footer “Powered by Tengine” stirred up my interest and so I started looking for more information about this unknown to me web server.

Here are some interesting things about Tengine:

  • It’s a fork of Nginx and still compliant with Nginx in term of configuration. This is important in case you decide to migrate from Nginx to Tengine.
  • Tengine is developed by Taobao / Alibaba. This means plenty of resources and serious backing. Considering how huge Alibaba is and its sites such as aliexpress.com, Tengine is already very popular.
  • Tengine has unique, in-house made modules which are not found in Nginx. Examples: Sysguard and Consistent hash module.

The Sysguard and Consistent hash modules impressed me as very useful because they would allow advanced load balancing.

To get an idea of Tengine’s capabilities, imagine you wish the web server to return a 503 error or a custom page when your free memory is below 100M or CPU load is above 20? With the Sysguard module this can be easily done with a configuration like this:

server {
    sysguard on;
    sysguard_mode or;

    sysguard_load load=10 action=/loadlimit;
    sysguard_mem free=100M action=/freelimit;

    location /loadlimit {
        return 503;
    }
    location /freelimit {
        return 503;
    }
}

Beyond this simple example, the options of Sysguard, Consistent hash module and the other Tengine modules could help you provide easily maximum resilience to failures while ensuring reliable session stickiness. One could imagine these modules evolved from Taobao’s needs to serve high traffic with high quality of service.

Tengine is still not available in Ubuntu’s apt repo, nor in any other major Linux distribution. This means that you will have to install it manually if you decide to give it a try. The good news is that the installation is as simple as running the usual compilation steps of ./configure, make and make install.

If and once Tengine appears in the official Linux distributions’ repos, its popularity will swiftly increase. In any case, we’ll be probably seeing more of Tengine in future, considering Nginx complications related to its F5 acquisition and Rambler Group accusations.

Comments

So empty here ... leave a comment!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Sidebar