Xaprb

Stay curious!

Archive for the ‘humor’ tag

4 ways that instrumentation is like sex

with 3 comments

In an application such as a database server, instrumentation is like sex: it’s not enough to know how often things happen. You also care about how long they took, and in many cases you want to know how big they were.

“Things” are the things you want to optimize. Want to optimize queries? Then you need to know what activities that query causes to happen. Most systems have at least some of this kind of instrumentation. If you look around at… let’s not pick on the usual targets… oh, say Sphinx, Redis, and memcached. What metrics do they provide? They provide counters that say how often various things happened. (Most of these systems provide very few and coarse-grained counters.) That’s not very helpful. So I read from disk N times, and I read from memory N times, and I compared rows N times… so what? I still don’t know anything relevant to execution time.

That’s why we need to measure how long things took. It’d be great if, for every Handler_X counter variable in MySQL’s SHOW STATUS, we also had a Handler_X_time in microseconds. True, better instrumentation could be designed, but that’d be a huge step forward already. Instead of guessing at the significance of Sort_rows, we could look at Sort_rows_time and see if a lot of time is being consumed sorting rows!.

Next, we need to know how big things are. This is a rather generic term, but in a lot of cases, the size, difficulty, or some other metric of an operation is important. “I wrote a message to the network socket” is okay; “I wrote and it took N microseconds” is better; and “I wrote N bytes and it consumed M microseconds” is best. Made a temp table on disk? Nice — how big was it? Mine’s smaller than yours!

The final way that instrumentation is like sex: more is better, to an extent. You can get too much, but how often has that happened to you?

Written by Xaprb

March 30th, 2010 at 11:57 pm

Posted in PostgreSQL,SQL

Tagged with ,

Vim versus Emacs

with 17 comments

Which is better? I don’t know, because I’m a Vim user, so it’s a moot point for me. But I have not noticed any Emacs-style keyboard shortcuts on websites. To the contrary, it seems like everything is Vim-style — certainly most Google apps are Vim-ish, and even Firefox is Vim-ish (press the / key to start searching for text on the page). Based on this highly scientific criterion, I declare Vim the winner.

Written by Xaprb

March 2nd, 2010 at 2:18 pm

Posted in Commentary

Tagged with , ,

I’m a Postgres user, as it turns out

with 14 comments

Someone recently posted this to an email list as a sample of an interesting SHOW INNODB STATUS output:

mysql> SHOW ENGINE INNODB STATUS\G
          _______  _______
|\     /|(  ____ \(  ____ \
| )   ( || (    \/| (    \/
| |   | || (_____ | (__
| |   | |(_____  )|  __)
| |   | |      ) || (
| (___) |/\____) || (____/\
(_______)\_______)(_______/

 _______  _______  _______ _________ _______  _______  _______  _______
(  ____ )(  ___  )(  ____ \\__   __/(  ____ \(  ____ )(  ____ \(  ____ \
| (    )|| (   ) || (    \/   ) (   | (    \/| (    )|| (    \/| (    \/
| (____)|| |   | || (_____    | |   | |      | (____)|| (__    | (_____
|  _____)| |   | |(_____  )   | |   | | ____ |     __)|  __)   (_____  )
| (      | |   | |      ) |   | |   | | \_  )| (\ (   | (            ) |
| )      | (___) |/\____) |   | |   | (___) || ) \ \__| (____/\/\____) |
|/       (_______)\_______)   )_(   (_______)|/   \__/(_______/\_______) 

I thought it was worth trying out, so I gave it a shot:

mysql> use postgres
ERROR 1049 (42000): Unknown database 'postgres'

Clearly I just need to create the database. Short work:

mysql> create database postgres;
Query OK, 1 row affected (0.00 sec)

mysql> use postgres
Database changed

So now I’m using Postgres. I still feel like I’m missing something, though. It feels a lot like reading XKCD comics. Where’s the tooltip?

Written by Xaprb

November 3rd, 2009 at 4:05 pm

Posted in PostgreSQL,SQL

Tagged with , ,