22 Jul 2012


If you've been working with Linux system for enough time, you will know sar. Since sar supports collecting many system statistic and its syntax is a bit complicated, Yahoo people created a tool in Perl called Ysar, it's similar to sar with simpler syntax, Yahoo has not published that tool yet. People at Taobao created another tool in C, named it with tsar and open source it at: https://gitorious.org/trafficserver/tsar/commits/master

Working with Apache Traffic server to build internal CDN for our company, I also join #trafficserver on FreeNode, that's when I heard about Tsar and started using it.  The opensource version of Tsar has 2 features, once is to get its syntax simpler and easier to use than sar, another is collecting various statistic of Apache Traffic server, integrate with nagios. For some reasons, this public version does not work in some cases: 

  • It only support traffic server installed as standard Red Hat package, so if you installed traffic server on another Linux distro,  BSD or Sun Solaris, it will not work. 
  • Module traffic does not work.
  • it  only supports standard network ethernet (eth*), bonding and p2p device won't work. 
I modified tsar to fix above problems. the modified version will work in any kind of Apache traffic server on any system. It support bonding and p2p and standard ethernet device....
My pull requests was not accepted by Taobao developer, so I put it on github  (Installation and Usage in README file). If you're using traffic server with nagios monitor system, this tool will fit your need. 

Load balancing using HTTP redirect reponse

This May I wrote a simple HTTP load balancer using HTTP 302 redirect response based on Facebook Tornado, it's called rbalancer  
After running it for 2 months, I'm confidence that it's stable and quite good for some purpose.
This's a short introduction of rbalancer:

rbalancer is a simple HTTP load balancer using HTTP 302 redirect response with round-robin and weighted random support built ontornadorbalancer can perform health check on server in balancer list, when a server went down, rbalancer will automatic re-balance request to alive servers. When dead one goes up, it will be added to cluster and serving request likes normal

If you're curious  about this thing, come check it on github