| Adam Jacob 2007-05-09, 7:11 pm |
| Hello all. I've had occasion to start using Perlbal to front some Rails
applications of late. Since it has fabulous statistics, we wanted to be able
to see what's up with our Perlbal instances in a vmstat-like way. Attached is
the (admittedly quick) first pass at a script that does just that, at the
moment for Client Socket states and URI listings. Language snobs beware, it's
written in Ruby, as that's what the client is most familiar with. 
For example:
../pbstat perlbal1 perlbal2
hostname tc r_h w_b b_s w_r x_r d_r w_s w_o x_d
perlbal1 0 0 0 0 0 0 0 0 0 0
perlbal2 18 0 0 0 17 1 0 0 0 0
perlbal1 0 0 0 0 0 0 0 0 0 0
perlbal2 18 0 0 0 16 2 0 0 0 0
perlbal1 0 0 0 0 0 0 0 0 0 0
perlbal2 20 0 0 0 19 1 0 0 0 0
perlbal1 0 0 0 0 0 0 0 0 0 0
perlbal2 19 0 0 0 17 2 0 0 0 0
The columns are:
total connections: tc
reading_headers: r_h
wait_backend: w_b
backend_req_sent: b_s
wait_res: w_r
xfer_res: x_r
draining_res: d_r
wait_stat: w_s
wait_open: w_o
xfer_disk: x_d
A more entertaining mode (but perhaps less useful) will show all the URIs that
the client proxy is serving:
../pbstat -d 0.1 -u perlbal1 perlbal2
perlbal1 http://127.0.0.1:4999/ 1
perlbal2 http://127.0.0.1:4999/search 1
(The number on the end is a count.)
Finally, you can just issue raw commands to the Perlbal backends:
../pbstat -c 1 -r "proc" amos1test amos2test
perlbal1 time: 1178747525
perlbal1 pid: 21240
perlbal1 utime: 10.752672 (+9.732609)
perlbal1 stime: 2.756172 (+2.576161)
perlbal1 reqs: 3590 (+0)
perlbal2 time: 1178747525
perlbal2 pid: 25966
perlbal2 utime: 2629.856355 (+2629.856355)
perlbal2 stime: 519.304454 (+519.304454)
perlbal2 reqs: 1041492 (+0)
Like I said above, it's pretty rough, but not a bad first start. Are there
other statistics that would be useful to display? How should they be
displayed?
If people have suggestions, I'll be happy to refactor this and make it a more
useful tool.
Otherwise, fun toy. 
It's attached to this message, or you can get it from:
svn://cabo.hjksolutions.com/pbstat/trunk
Adam
--
HJK Solutions - We Launch Startups - http://www.hjksolutions.com
Adam Jacob, Senior Partner
T: (206) 508-4759 E: adam@hjksolutions.com
|