Skip to content

wkl/channel_stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

channel_stats plugin for Apache Traffic Server 3.0.0+

About channel_stats plugin
==========================
channel_stats plugin collect the runtime statistics (speed, request count and
more in the future) for each channel. The stats is exposed with http interface
in json. (The code of interface is from 'stats_over_http' plugin.)

In general, the plugin could be used on reverse proxy with a **fixed** number
of remap rules. It's not designed for the proxy which serves unlimited channels
(like open-relay forward proxy).


Installation
==========================
Compile:
  make -f Makefile.tsxs
  sudo make install -f Makefile.tsxs
(if 'tsxs' is not in your PATH, run make by appending TSXS=/path/to/ts/bin/tsxs)

Edit:
  Add 'channel_stats.so' to plugins.config.
  By default, the path of http interface is '_cstats'. For safety, you should
  change it by adding a parameter after 'channel_stats.so'.
  Example: 'channel_stats.so _my_cstats'.

Start:
  Restart Traffic Server: sudo traffic_line -L or sudo trafficserver restart


Viewing Stats
==========================
Visit http://local_IP:port/_cstats (or as you configured in plugin.config)
Output will be in json:

{
  "channel": {
    "www.example.com": {
      "response.bytes.content": "3486995502046",
      "response.count.2xx.get": "64040675",
      "response.count.5xx.get": "1404",
      "speed.ua.bytes_per_sec_64k": "3972287"
    },
    "www.test.com": {
      "response.bytes.content": "3349404916760",
      "response.count.2xx.get": "64038172",
      "response.count.5xx.get": "30",
      "speed.ua.bytes_per_sec_64k": "3989255"
    }
  },
 "global": {
    "response.count.2xx.get": "268516715",
    "response.bytes.content": "58537730819906",
    "channel.count": "10",
    "server": "3.0.4"
  }
}

Available stats:
 - response.bytes.content: transferred content length (not including header)
 - response.count.2xx.get: 2xx transaction count
 - response.count.5xx.get: 5xx transaction count
 - speed.ua.bytes_per_sec_64k: count of transaction whose speed is < 64KBps

Additional parameters:
 - topn: only output top N channels order by response count
 - channel: only output the channels which contain specific string
 - global: also display TS internal stats as 'stats_over_http' plugin
 Example:
 - http://127.0.0.1/_cstats?global
 - http://127.0.0.1/_cstats?topn=5
 - http://127.0.0.1/_cstats?channel=test.com
 - http://127.0.0.1/_cstats?channel=test.com&topn=5&global
If you have a large number of channels (e.g. more than 10k), those parameters
may not be heavily used due to extra overhead.


Warning
==========================
Security
 - As mentioned above, you should change default path of http interface to make
   other people harder to access your channel stats.
 - For IPv4, plugin will make sure visitor is from private network.
   (http://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces)
   In addition, you should deny the request to http interface on your L7 front-
   end because your L7 server and TS are probably in a same local network. And
   currently plugin will deny the request from IPv6 address.
 - The number of channels is limited to 100000.
Performance
 - According to load test, QPS will decrease by around 5% after enabling plugin.


DEV
==========================
See also "Get Involved" on http://trafficserver.apache.org/


ChangeLog
==========================

Version 0.2
  - Count 5xx response

Version 0.1 (11/26/12)
  - Initial release

About

channel_stats plugin for Apache Traffic Server 3.0.0+

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published