Ogre is now running on Apache Traffic Server

I've just switched over to serve all of www.ogre.com out of Apache Traffic Server. The site is still managed and created using Apache HTTPD, PHP and Drupal, but that is running as an "origin" server to ATS. This gives me a few benefits over serving straight out of Apache HTTPD:

  • Static content is automatically "cached" on the ATS server, and it can serve such content very fast with low latency.
  • I can jack up keep-alive much higher than I dared doing with HTTPD. Fwiw, I still use the pre-fork MPM, so I have limited number of processes and can't afford to tie those up with idle KA connections.
  • In a pinch, I could turn the HTML generated from Drupal to be cacheable, and serve straight out of ATS. I'm contemplating making this setting automatic, so when the load on the box hits a certain level, all HTML will also be cached by ATS. That would increase my capacity by at least a magnitude I think.

This change required no changes on my Drupal site, but I did change the port on my Apache HTTPD virtual host:

NameVirtualHost 209.126.158.218:8080

<VirtualHost 209.126.158.218:8080>
    ServerName www.ogre.com
...

I then installed Apache Traffic Server to listen on port 80, and I also told it to only bind a specific IP on my server (I have three IPs for different things). I also increased the RAM cache size and Keep-Alive timeouts, so I now have these changes in etc/trafficserver/records.config:

CONFIG proxy.config.proxy_name STRING kramer3.ogre.com
CONFIG proxy.config.http.server_port INT 80
CONFIG proxy.config.http.keep_alive_no_activity_timeout_in INT 60
CONFIG proxy.config.http.keep_alive_no_activity_timeout_out INT 1
CONFIG proxy.config.http.transaction_no_activity_timeout_in INT 15
CONFIG proxy.config.http.transaction_no_activity_timeout_out INT 30
CONFIG proxy.config.cache.ram_cache.size LLONG 33554432

LOCAL proxy.local.incoming_ip_to_bind STRING 209.126.158.218

Next, I added a disk cache to use for ATS, etc/trafficserver/storage.config:

/disk/tmp 134217728

This creates a 128MB cache in /disk/tmp. I know, very small, but this is still experimental. Finally, I added a remapping rule to etc/trafficserver/remap.config:

map http://www.ogre.com/ http://www.ogre.com:8080/

After starting everything up, the entire site is now reverse proxied (or accelerated) through Apache Traffic Server! As you can see, the changes necessary to ATS are fairly small, and pretty straight forward, most of the default settings 'just work'. It's a miracle.

Hacking: 

Comments

Stats example

Here's an example "statistics" log from my server (half a days worth of logs):


                        Totals (all Origins combined)

Request Result                         Count    Percent       Bytes    Percent
------------------------------------------------------------------------------
Cache hit                              1,464     51.64%     12.60MB     59.76%
Cache hit IMS                            118      4.16%    213.65KB      0.99%
Cache hit refresh                         86      3.03%    892.76KB      4.13%
Cache hit other                            0      0.00%      0.00KB      0.00%
Cache hit total                        1,668     58.84%     13.68MB     64.89%

Cache miss                               793     27.97%      4.55MB     21.59%
Cache miss IMS                           264      9.31%      2.13MB     10.11%
Cache miss refresh                       101      3.56%    733.95KB      3.40%
Cache miss other                           0      0.00%      0.00KB      0.00%
Cache miss total                       1,158     40.85%      7.40MB     35.10%

Client aborted                             1      0.04%      0.41KB      0.00%
Connect failed                             4      0.14%      2.03KB      0.01%
Invalid request                            4      0.14%      0.85KB      0.00%
Unknown error(99)                          0      0.00%      0.00KB      0.00%
Other errors                               0      0.00%      0.00KB      0.00%
Errors total                               9      0.32%      3.28KB      0.02%
..............................................................................
Total requests                         2,835    100.00%     21.09MB    100.00%


HTTP return codes                      Count    Percent       Bytes    Percent
------------------------------------------------------------------------------
200 OK                                 2,493     87.94%     20.87MB     98.98%
204 No content                             0      0.00%      0.00KB      0.00%
206 Partial content                        0      0.00%      0.00KB      0.00%
2xx other success                          0      0.00%      0.00KB      0.00%

301 Moved permanently                    167      5.89%    104.81KB      0.49%
302 Found                                 30      1.06%     21.03KB      0.10%
304 Not modified                         122      4.30%     35.40KB      0.16%
3xx other redirects                        0      0.00%      0.00KB      0.00%

400 Bad request                            4      0.14%      0.85KB      0.00%
403 Forbidden                              0      0.00%      0.00KB      0.00%
404 Not found                             19      0.67%     58.78KB      0.27%
4xx other client errors                    0      0.00%      0.00KB      0.00%

501 Not implemented                        0      0.00%      0.00KB      0.00%
502 Bad gateway                            0      0.00%      0.00KB      0.00%
503 Service unavailable                    0      0.00%      0.00KB      0.00%
5xx other server errors                    0      0.00%      0.00KB      0.00%

999 YDoD rejection                         0      0.00%      0.00KB      0.00%
000 Unknown                                0      0.00%      0.00KB      0.00%


Origin hierarchies                     Count    Percent       Bytes    Percent
------------------------------------------------------------------------------
NONE                                   1,591     56.12%     12.82MB     60.77%
DIRECT                                 1,244     43.88%      8.27MB     39.23%
SIBLING                                    0      0.00%      0.00KB      0.00%
PARENT                                     0      0.00%      0.00KB      0.00%
EMPTY                                      0      0.00%      0.00KB      0.00%
invalid                                    0      0.00%      0.00KB      0.00%
other                                      0      0.00%      0.00KB      0.00%


HTTP Methods                           Count    Percent       Bytes    Percent
------------------------------------------------------------------------------
GET                                    2,802     98.84%     20.96MB     99.37%
PUT                                        0      0.00%      0.00KB      0.00%
HEAD                                      19      0.67%      6.77KB      0.03%
POST                                      10      0.35%    129.25KB      0.60%
DELETE                                     0      0.00%      0.00KB      0.00%
PURGE                                      0      0.00%      0.00KB      0.00%
OPTIONS                                    0      0.00%      0.00KB      0.00%
none (-)                                   4      0.14%      0.85KB      0.00%
other                                      0      0.00%      0.00KB      0.00%


URL Schemes                            Count    Percent       Bytes    Percent
------------------------------------------------------------------------------
HTTP (port 80)                         2,831     99.86%     21.09MB    100.00%
HTTPS (port 443)                           0      0.00%      0.00KB      0.00%
none                                       4      0.14%      0.85KB      0.00%
other                                      0      0.00%      0.00KB      0.00%


Content Types                          Count    Percent       Bytes    Percent
------------------------------------------------------------------------------
text/javascript                            0      0.00%      0.00KB      0.00%
text/css                                  81      2.86%      2.72MB     12.89%
text/html                              1,163     41.02%      7.12MB     33.77%
text/xml                                   1      0.04%      2.95KB      0.01%
text/plain                               135      4.76%    625.17KB      2.89%
text/ other                                0      0.00%      0.00KB      0.00%
text/ total                            1,380     48.68%     10.45MB     49.56%

image/jpeg                                15      0.53%     70.36KB      0.33%
image/gif                                449     15.84%    352.11KB      1.63%
image/png                                481     16.97%      4.84MB     22.96%
image/bmp                                  0      0.00%      0.00KB      0.00%
image/ other                              80      2.82%    125.65KB      0.58%
image/ total                           1,025     36.16%      5.38MB     25.50%

audio/x-wav                                2      0.07%     28.80KB      0.13%
audio/x-mpeg                               0      0.00%      0.00KB      0.00%
audio/ other                               0      0.00%      0.00KB      0.00%
audio/ total                               2      0.07%     28.80KB      0.13%

application/x-shockwave                    0      0.00%      0.00KB      0.00%
application/x-javascript                   0      0.00%      0.00KB      0.00%
application/x-quicktime                    0      0.00%      0.00KB      0.00%
application/zip                            0      0.00%      0.00KB      0.00%
application/ other                       298     10.51%      5.19MB     24.63%
application/ total                       298     10.51%      5.19MB     24.63%

none                                     122      4.30%     35.40KB      0.16%
other                                      8      0.28%      2.87KB      0.01%


Elapsed time stats     Min       Max                 Avg           Std Deviation
------------------------------------------------------------------------------
Cache hit                1     5,840       61.5044746399        413.140899658203
Cache hit IMS            1        32       19.1685352325         13.564630508423
Cache hit refresh        1       207       64.5346298218         60.208576202393
Cache hit other          0         0        0.0000000000          0.000000000000
Cache hit total          1     5,840       61.0175666809        387.563781738281
Cache miss               1     4,299      189.4292755127        383.761535644531
Cache miss IMS           7     1,083      139.8293151855        107.992271423340
Cache miss refresh      27       689      128.8317108154        120.233024597168
Cache miss other         0         0        0.0000000000          0.000000000000
Cache miss total         1     4,299      173.3039398193        326.247009277344

______________________________________________________________________________

Hi buddy, i have installed

Hi buddy,
i have installed the ATS 2.1.3, everythins works well excpet for the Hit, the Hit is always is zero. i do not know why ..... i configure it as yours

It sounds like you don't have

It sounds like you don't have a cache then? Or possibly that nothing of your content is cacheable (I tweaked my Apache HTTPD configs for Drupal to assue it makes the CSS / JSS / images cacheable if I recall). But check the cache configurations first, particularly storage.config. And, come to #traffic-server or our mailing lists if you still have problems. :).

Statistic printing

Hi man, I've also installed ATS in forward proxy mode, how do you print out those stats of yours?

Thanks before.

Re: Statistic printing

To get those particular stats, you have to enable the squid log in binary format (this is done in records.config). With that enabled, you will get a log file named squid.blog, you can then run the command "traffic_logstats", which produces those log stats summaries.

Btw, I hope you've upgraded to v2.1.7, or perhaps even try the new v2.1.8 release candidate (see http://people.apache.org/~zwoop/rel-candidates/).

Re: It sounds like you don't have

Do you remember what these HTTPD setting were by chance? I am working on a similar setup and the CSS and images are getting stripped out by ATS.

Re: It sounds like you don't have

Hmmm, I can't imagine what would cause this, ATS would never strip out stuff from the HTML. It doesn't touch it at all, and there are no settings I can think of in HTTPD that would cause that. What I can imagine is that ATS is getting an error when it tries to proxy the CSS/JS, but you should be able to see that in your logs (both on ATS and HTTPD). But that's not stripping out CSS/JS, if you do a "view source" on the HTML, I'd assume you still see the references to those in there ?

Re: It sounds like you don't have

Indeed the CSS is still there just no longer being parsed by the client browser. I am getting good cache hit, looking at the ATS logs, but for some reason the client is not parsing the Drupal page the same. I am using Drupal 6.20, and HTTD 2.2.3 ATS 2.1.6 if that helps. If I hit the origin server directly everything looks fine.

Re: Ogre is now running on Apache Traffic Server

Hey Leif,

Thanks for your post - and I know it's a while ago now!
But I was wondering if you could shed some light on your hosting?
Are you using two separate boxes - one for Drupal and one for ATS?
I figured you're using one box, since you changed the Apache port.

I am asking because I am setting up a new web server and am investigating reverse proxies for serving static content - obvious choices are Nginx and GWAN.

I was also wondering about the concept of using ATS on a VPS (say with Linode) so that I have a scalable static-content-serving 'layer'; and then using my dedicated for PHP content - we have a lot of image heavy sites.

Interested in your thoughts.

Thanks!
Joe

Re: Ogre is now running on Apache Traffic Server

Yeah, I'm runniing ATS and Apache HTTPD / Drupal on the same box. I prefer open source software for this, which rules out GWan. Nginx suffers (or at least suffered) noticeably as a proxy. Varnish is pretty nice, if you are willing to do a lot of VCL hacking, and can deal with a potentially non-persistent cache (I know, they have "persistent" cache now).

I've run ATS on various VM hypervisors. It generally works ok, but performance is nowhere near bare metal. But, it'll be the same no matter which server you use, it's not a proxy server software problem, it's a problem making network virtualization that doesn't suck.