Apache Traffic Server - a unique caching proxy server for CDN

image

Once an idea arose to launch a Russian-language version of a popular American site. After some thought, it was decided to implement a fully interactive scheme of the form examplesite.com -> examplesite-ru.com and make the machine do as much work as possible.

Some research and experiments with various proxy servers led to an interesting product - Apache Traffic Server , which I want to talk about.

Traffic Server was originally created by Inktomi Corporation, which was bought by Yahoo! in 2002. For a long time, the product was actively used commercially both inside Yahoo !, and on some very large sites. Since 2009, the project opened the source codes and transferred them to the Apache incubator, and in April 2010 the Apache Traffic Server appeared.

Details on comparing ATS with other caching and balancing servers can be found here .

I’ll just say briefly that the ATS architecture outperforms such well-deserved counterparts as Ngnix, HAproxy and Squid in scalability, while each of the listed products is specialized, while ATS can do more (except for Squid, which can do even more, but an order of magnitude slower ) Serious bid? Need to try!

Installing ATS
Due to its novelty, the project documentation leaves much to be desired. The abundance of configuration directives, the terrifying heap of files in etc /, the unfinished wiki and the lack of a step-by-step manual first scared. But then I found a wonderful presentation by Tom Melendez from Yahoo! and everything fell into place.

Further settings were carried out on Centos 5.5 x64.

Step 1. Download the ATS distribution.
[root@Srv1 ~]# wget www.sai.msu.su/apache//trafficserver/trafficserver-2.1.5-unstable.tar.bz2

Step 2. We check the availability of the necessary libraries.
[root@Srv1 ~]# yum list autoconf automake libtool gcc-c++ glibc-devel openssl-devel tcl-devel expat-devel db4-devel pcre-devel

Step 3. Most likely, some packages will have to be installed; in my case, tcl-devel and pcre-devel were required. Without this step, compilation will fail. For users of Debian-based distributions, the set of components is slightly different and it is described in the README file.

Step 4. Unpack the archive and go to the directory Step 5. Compile. By default, prefix == "/ usr / local" which is enough for tests ATS setup I will remind the main commandment of Tom Melendez: "I REALLY LAZY!" Now I will describe the settings for our task. Step 1. Open /usr/local/etc/trafficserver/records.config Step 2. /usr/local/etc/trafficserver/remap.config Step 3. From pure curiosity we will see /usr/local/etc/trafficserver/storage.config And we see that the lazy Tom added a small 256 MB piece of disk enough for tests: ATS start Service is started by the command Configuration is updated by the Bingo team !
[root@Srv1 ~]# tar -xjf trafficserver-2.1.5-unstable.tar.bz2
[root@Srv1 ~]# cd trafficserver-2.1.5-unstable




[root@Srv1 trafficserver-2.1.5-unstable]# ./configure [--prefix=PREFIX]
[root@Srv1 trafficserver-2.1.5-unstable]# make install







CONFIG proxy.config.proxy_name STRING examplesite-ru.com
CONFIG proxy.config.http.server_port INT 80
CONFIG proxy.config.reverse_proxy.enabled INT 1



map examplesite-ru.com/ examplesite.com/
reverse_map examplesite.com/ examplesite-ru.com/



var/trafficserver 256M



[root@Srv1 ~]# /usr/local/bin/trafficserver


[root@Srv1 ~]# /usr/local/bin/traffic_line -x


As you can see, the launch really needs a minimum of effort.

My test server is made from the smallest computer based on the Intel Atom 525, which is connected to the Internet channel at a speed of 1 Mbps. My test site has a main page of approximately 85 kB in size. Each time it generates a unique Session ID (this always puts into the stupor rocking sites like TeleportPro and various proxies).

It is easy to calculate that a regular non-caching reverse proxy will spend only about 0.7 seconds on downloading a page, then 0.7 seconds on its return, as well as time on “proxying” the content.

In the case of ATS, the additional delay when the page is fully loaded is much less than 1 second per lap, and the processor load is simply invisible. Alternately, starting to load the site directly and through ATS, I noticed that quite often the proxy gives the page faster than the original! As you can see, 8 years of operation on Yahoo servers in the role of CDN were not in vain.

Let's go back to the beginning
The idea of ​​creating a website mirror will not surprise anyone, but in my plans it should be supplemented by a system of automated translation of texts and graphics into Russian using ... (there are only questions in this place). Such a system can be connected using
the HTTP transformation plugin .

Also popular now: