I've had the opportunity in the last few days to use quite a few cool little utilities that made my life considerably easier. I've known about most of them for awhile, but discovered some new tools or new uses for old tools and wanted to share two of them.

AutoSSH

SSH tunneling is a way of life. I can't count how many times I've had to throw one into place because "there was no other option." I've even seen people use them to protect MySQL replication, not for security interestingly enough but because SSH doesn't "trust the network" the way MySQL does. However, using an SSH tunnel brings the risk of its premature death due to network errors or timeout.

Enter autossh stage left. There are many ways to script an ssh wrapper to prevent tunnel death, but autossh does this all for you. It basically creates a tunnel loopback, where ssh is forwarding ports to the remote server and then back to the local server so that it can send a packet to one of the ports and have it loop all the way to the remote and back to local. If it doesn't get the packet back...ssh has died and it restarts it. Pretty cool little app. (http://www.harding.motd.ca/autossh)

MySQLSLA

This isn't exactly a new tool. Actually its aggressively not a new tool. However, I recently started using the --log-type binary option on it to examine binary logs themselves and not slow logs at all. It is amazing how useful this can be. Just recently there was a large write spike on drupal.org's master database server and while we could see the spike....how were we to know what was causing it? SLA to the rescue. I ran one of the logs through mysqlsla with a command something like:

mysqlbinlog logfile | mysqlsla --log-type binary - | less

The output was very clear, a project_usage update statement was 30% of the log. Very useful. (http://hackmysql.com/mysqlsla)