You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Jack Bates <du...@nottheoilrig.com> on 2012/11/30 06:11:26 UTC

Mark traffic for different domains

Do you have any advice how to apply different traffic shaping to HTTP 
traffic for different domains? Our router, which does the traffic 
shaping, is on a different machine than Traffic Server, so I think I 
need Traffic Server to match requests for different domains, and then 
somehow mark traffic in a way that the other machine can pick up and 
filter on?

Re: Mark traffic for different domains

Posted by Jack Bates <du...@nottheoilrig.com>.
On 29/11/12 09:11 PM, Jack Bates wrote:
> Do you have any advice how to apply different traffic shaping to HTTP
> traffic for different domains? Our router, which does the traffic
> shaping, is on a different machine than Traffic Server, so I think I
> need Traffic Server to match requests for different domains, and then
> somehow mark traffic in a way that the other machine can pick up and
> filter on?

I found a solution by using a remap plugin and 
TSHttpTxnServerPacketTosSet() to set the DSCP field based on the domain. 
For example, in remap.config:

map http://wikipedia.org http://wikipedia.org @plugin=tos.so @pparam=12
regex_map http://.*\.wikipedia\.org http://$0 @plugin=tos.so @pparam=12
map http://youtube.com http://youtube.com @plugin=tos.so @pparam=28
regex_map http://.*\.youtube\.com http://$0 @plugin=tos.so @pparam=28

Then on the router we use connection tracking to shape both request 
traffic from Traffic Server and response traffic from the origin server.

The remap plugin is *very* short [1], thanks to 
TSHttpTxnServerPacketTosSet(). It's just a wrapper so it can be 
configured in remap.config. But I'm considering adding a wiki page about 
this solution to traffic shaping based on the domain. Would this be 
helpful/welcome?

TSHttpTxnServerPacketTosSet() was added in commit b77838 and discussed 
in TS-1090

   [1] http://nottheoilrig.com/trafficserver/201212070/tos.cc