Archive for the ‘Domas Mituzas’ tag
The new hotness in open-core: InnoDB
There’s lots of buzz lately about the so-called “open-core” business model of Marten Mickos’s new employer. But this is nothing new. Depending on how you define it, InnoDB is “open-core,” and has been for a long time. The InnoDB Hot Backup (ibbackup) tool was always closed-source. Did anyone ever cry foul and claim that this made InnoDB itself not open-source, or accuse Innobase / Oracle of masquerading as open-source? I don’t recall that happening, although sometimes people got suspicious about the interplay between the backup tool and the storage engine. Generally, though, the people I know who use InnoDB Hot Backup have no gripes about paying for it.
What is the difference between open-source with closed-source accessories, and crippleware? I think it depends on how people define the core functionality of software. Some might say that backup is core functionality for a database; and others would point to mysqldump and say that InnoDB isn’t crippleware as long as there is some alternative.
I think InnoDB is an interesting case that illustrates what can happen when commercial and GPL play together. Part of that story is the appearance of XtraBackup, an open-source competitor to InnoDB Hot Backup. Everyone’s subject to the rules of the game, unless they restrict the “core,” which would make it non-open-source to begin with.
A script snippet for aggregating GDB backtraces
A short time ago in a galaxy nearby, Domas Mituzas wrote about contention profiling with GDB stack traces. Mark Callaghan found the technique useful, and contributed an awk script (in the comments) to aggregate stack traces and identify which things are blocking most threads. I’ve used it myself a time or five. But I’ve found myself wanting it to be fancier, for various reasons. So I wrote a little utility that can aggregate and pretty-print backtraces. It can handle unresolved symbols, and aggregate by only the first N lines of the stack trace. Here’s an example of a mysqld instance that’s really, really frozen up:
bt-aggregate -4 samples/backtrace.txt | head -n12
2396 threads with the following stack trace:
#0 0x00000035e7c0a4b6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x00000000005f2bd8 in open_table ()
#2 0x00000000005f3fb4 in open_tables ()
#3 0x00000000005f4247 in open_and_lock_tables_derived ()
4 threads with the following stack trace:
#0 0x00000035e7c0a4b6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000780099 in os_event_wait_low ()
#2 0x000000000077de42 in os_aio_simulated_handle ()
#3 0x000000000074a261 in fil_aio_wait ()
An easy way to run many tasks in parallel
Domas Mituzas mentioned this recently. It’s so cool I just have to write about it. Here’s an easy command to fork off a bunch of jobs in parallel: xargs.
seq 10 20 | xargs -n 1 -P 5 sleep
This will send a sequence of numbers to xargs, which will divide it into chunks of one argument at a time and fork off 5 parallel processes to execute each. You can see it in action:
$ ps -eaf | grep sleep baron 5830 5482 0 11:12 pts/2 00:00:00 xargs -n 1 -P 5 sleep baron 5831 5830 0 11:12 pts/2 00:00:00 sleep 10 baron 5832 5830 0 11:12 pts/2 00:00:00 sleep 11 baron 5833 5830 0 11:12 pts/2 00:00:00 sleep 12 baron 5834 5830 0 11:12 pts/2 00:00:00 sleep 13 baron 5835 5830 0 11:12 pts/2 00:00:00 sleep 14
There are basically unlimited uses for this!


