Andrew Stribblehill: The story of ping(1)
How we laughed when we discovered that Linux s ping makes a reverse DNS lookup for every incoming ICMP echo reply! For added mirth and/or merriment, it also happens on flood-ping.
| Tool | MB saved | Space vs. gzip | Time vs. gzip | Cost |
|---|---|---|---|---|
| gzip | 3081 | 100.00% | 100.00% | 0.41 |
| gzip -1 | 2908 | 104.84% | 82.34% | 0.36 |
| gzip -9 | 3091 | 99.72% | 141.60% | 0.58 |
| bzip2 | 3173 | 97.44% | 201.87% | 0.81 |
| bzip2 -1 | 3126 | 98.75% | 182.22% | 0.74 |
| lzma -1 | 3280 | 94.44% | 163.31% | 0.63 |
| lzma -2 | 3320 | 93.33% | 217.94% | 0.83 |
| xz -1 | 3270 | 94.73% | 176.52% | 0.68 |
| xz -2 | 3309 | 93.63% | 200.05% | 0.76 |
| lzop -1 | 2508 | 116.01% | 77.49% | 0.39 |
| lzop -2 | 2498 | 116.30% | 76.59% | 0.39 |
At the extremely fast, but not as good compression, end is lzop. gzip is still the balanced performer, bzip2 still looks really bad, and lzma -1 is still the best high-compression performer.
Now, let s throw cat into the mix:
Here s something notable, that this graph makes crystal clear: lzop was just as fast as cat. In other words, it is likely that lzop was faster than the disk, and using lzop compression would be essentially free in terms of time consumed.
And finally, look at the cost:
What happened to pbzip2?
I tried the parallel bzip2 implementation just like last time, but it ran extremely slow. Interestingly, pbzip2 < notes.txt > notes.txt.bz2 took 1.002 wall seconds, but pbzip2 notes.txt finished almost instantaneously. This 1-second startup time for pbzip2 was a killer, and the test would have taken more than 3 days to complete. I killed it early and omitted it from my results. Hopefully this bug can be fixed. I didn t expect pbzip2 to help much in this test, and perhaps even to see a slight degradation, but not like THAT.
Conclusions
As before, the difference in time was far more significant than the difference in space. By compressing files individually, we lost about 400MB (about 7%) space compared to making a tar file and then combining that. My test set contained 270,101 files.
gzip continues to be a strong all-purpose contender, posting fast compression time and respectable compression ratios. lzop is a very interesting tool, running as fast as cat and yet turning in reasonable compression though 25% worse than gzip on its default settings. gzip -1 was almost as fast, though, and compressed better. If gzip weren t fast enough with -6, I d be likely to try gzip -1 before using lzop, since the gzip format is far more widely supported, and that s important to me for backups.
These results still look troubling for bzip2. lzma -1 continued to turn in far better times and compression ratios that bzip2. Even bzip2 -1 couldn t match the speed of lzma -1, and compressed barely better than gzip. I think bzip2 would be hard-pressed to find a comfortable niche anywhere by now.
As before, you can download my spreadsheet with all the numbers behind these charts and the table.
After dropping all (pretense at) regular exercise after leaving high/grammar/secondary school (the german word is Gymnasium) and doing more or less nothing for more than 10 years, I've taken up weight training (after a not very successful attempt at volleyball; I like the sport but the team fell apart) two years ago. Since I actually managed to work out regularly (twice a week) in the first year, and since membership in a gym is not cheap, and since I moved and thus had to find a different solution anyway, I decided to buy a Bowflex Sport home gym. I can't compare it to other home equipment, and it apparently it has been discontinued by Nautilus, but nonetheless, a few thoughts:
The conclusion first: Would I buy it again? No. Was it a waste of money? No, it's not that bad. In detail:
Yay!
This blog post is not strictly speaking news anymore - But for those who don't know it yet, three days ago Debian 5.0 Lenny was released, after 22 months of work (plus fun, plus flamewars, plus everything that makes a Free Software lover tick). And, of course, that makes us all very happy and proud. As always, upgrading is a breeze. Hats off specially to Wolfgang and everybody who worked towards the great release notes - No, it is not a simple task, by far. And I _do_ feel ashamed I didn't even beep that way :-(
So, many of us are in the middle of planning/executing our servers' migrations. So far, I'm amazed for good. Even hairy issues such as firmware removal are magically and beautifully taken care of - i.e. my firewall kindly informed me during update that I would need to install the non-free firmware for my BNX2 (Broadcom) network interfaces, and I was just a package away from absolute happiness. Lets see what happens next Friday, as I will be upgrading our storage+application server (which is _way_ more complex than the servers I've dealt with so far).
Anyway... But what good is a blog post if you are not ranting?
Many people recognize me as one of the most Debian-connected people in Mexico, and that's very good. And yes, besides being a Debian Developer, I am a co-sysadmin for the main Debian mirror in Mexico. Some people have already asked me for CD-ROMs and DVDs. Of course, if I had a BluRay drive, I'm sure I'd also get requests for it.
People: Do you really want such media? Think again... Do you really want 31 CDs or five DVDs for your favorite architecture? Ok, maybe many will say "nah, just give me the first one" - Then, do you want to limit your Debian experience to just the software that lives on the first 1/31th (or 1/5th) of it all?
Of course there are many situations where it is desirable. Low bandwidth users, or people with no regular connectivity, will be much better served by suitable media from which to install. However, most of us (computer geeks living in Mexico City - Yes, that's the people contacting me) have at least a 1Mbps connection at home. People, just get the Netinst or Businesscard (180 or 40MB) images and download whatever is left via the network. Debian is extremely network-friendly. And, believe me, even if packages are sorted by popularity (and that's why most people will be happy with the first DVD if needed), you never know if you will want precisely a package that sits towards the lonely tail of popularity.
And, yes, I did have my CD images handy for the Potato, Woody and Sarge cycles - but increasingly, it became easier for me just to ask apt-get to fetch stuff from the web (which is done without me moving from my comfy chair while I do anything else) than asking apt-get to ask me to go search for the f.*ing CD which I left dont-remember-where.
Anyway... I'm not saying I won't burn your CDs - If you want them, please tell me in advance and come to my office, I'll be glad to give you some Debian disks. But spare the environment. We don't need to burn more and more disks. Use the network, be a better human being!
So a customer of mine needs to use RedHat. It's not their choice, the
choice was forced upon them by the people who wrote the tools they need
to use.
The new version of this particular tool which they wanted to use
requires RHEL5, and they're currently running RHEL4. So I had to upgrade
their systems from RHEL4 to RHEL5. No sweat, right?
Yeah, right.
RedHat has this nice 'Red Hat Network', where you can manage your
servers, and remotely mark packages for upgrade. You can also, by way of
a command line tool, say that you want it to upgrade from one release to
another. This can't be done remotely, which sortof makes sense;
upgrading from one release to another might cause problems that you
really really don't want if you don't have an immediate shell. So you
should use 'up2date --upgrade-to-release=5' to upgrade from RHEL4 to
RHEL5.
Except that that doesn't work. For some reason, RedHat chose not to
support in-place upgrades from RedHat 4 to RedHat 5. Instead, you have
to download installation media, boot from them (thereby inducing
downtime) and select 'upgrade' in the installer. Which part of this
distribution is "Enterprise", again?
Oh well. So I download the first ISO, and start the upgrade process.
Surely that'll work, right?
Hah. No, I really need all six images. So I download them, and start
again.
Some minutes into the installation, the HP iLO session that I'm using
times out, and takes my Virtual CD device with it. As such, the
installer-in-upgrade-mode obviously can't find the CD-ROM anymore, and
produces a read error. This is totally normal. The system provides me
with a 'retry' button. That button doesn't work.
That is to say, it works, but after two or so files, the installation
goes to a grinding halt. I had to reboot, and start over.
So after rebooting, changing my iLO session settings so the timeout
is at 120 minutes (the maximum) rather than 30 minutes (what appears to
be the default), and I restart the upgrade process, making sure to click
in the iLO interface every once in a while to keep it active. When it's
somewhere at 80% and 3 hours into the upgrade process (god, why does
that have to take so long?), it suddenly finds itself out of disk
space.
Well, shit happens, of course; guess there's nothing to blame RedHat
with that one. But the way this situation is handled, is beyond my
comprehension:
The only 'recover' option is 'reboot'. There's no 'retry'. I don't
mind diving to a second console, mucking about a bit on the mounted
partition, and doing 'retry', but the installer doesn't even offer me
that option. Instead, I have to choose 'reboot'. Never mind that the
system is halfway through an installation process and might be totally
and utterly broken, and not even bootable. Well, that's what rescue
modes on installation media are for, I guess, but still.
After cleaning out some old files that aren't needed anymore and
going back to the installer, you'd suppose that the system could figure
out what it'd already done, and continue from there, right?
Well, no, it can't. It starts over from scratch, thereby forcing me
to sit and wait for another three hours.
Times like these make me remember why I'm a Debian developer, and not
a RedHat one. Why I chose not to finish that Linux From Scratch project
that I'd started after using RedHat for three years and about six months
before becoming a Debian Developer. Why I stopped hitting my computer
screen around that time.
Stupid piece of shit.
disclaimer: this is all IMAO, and you don't
have to agree with me. But what's a blog for, if not to rant?
;-)
So, I've had this plan for ages to follow up with what I did
with my nslu2, and hide a Debian box inside
a working stereo.
Finally I've started work on this little project. I bought a cheap stereo
with CD/tape/radio, mostly on the criteria:
| Tool | MB saved | Space vs. gzip | Time vs. gzip | Cost |
|---|---|---|---|---|
| gzip | 3398 | 100.00% | 100.00% | 0.15 |
| bzip2 | 3590 | 92.91% | 333.05% | 0.48 |
| pbzip2 | 3587 | 92.99% | 183.77% | 0.26 |
| lzma -1 | 3641 | 91.01% | 195.58% | 0.28 |
| lzma -2 | 3783 | 85.76% | 273.83% | 0.37 |
Like the other charts, the best area is the lower left, and worst is upper right. It s clear we have two outliers: gzip and bzip2. And a cluster of pretty similar performers.
This view somewhat magnifies the differences, though. Let s add cat to the mix:
And finally, look at the cost:
Conclusions
First off, the difference in time is far larger than the difference in space. We re talking a difference of 15% at the most in terms of space, but orders of magnitude for time.
I think this pretty definitively is a death knell for bzip2. lzma -1 can achieve better compression in significantly less time, and lzma -2 can achieve significantly better compression in a little less time.
pbzip2 can help even that out in terms of clock time on multicore machines, but 7za already has a parallel LZMA implementation, and it seems only a matter of time before /usr/bin/lzma gets it too. Also, if I were to chart CPU time, the numbers would be even less kind to pbzip2 than to bzip2.
bzip2 does have some interesting properties, such as resetting everything every 900K, which could provide marginally better safety than any other compressor here though I don t know if lzma provides similar properties, or could.
I think a strong argument remains that gzip is most suitable for backups in the general case. lzma -1 makes a good contender when space is at more of a premium. bzip2 doesn t seem to make a good contender at all now that we have lzma.
I have also made my spreadsheet (OpenOffice format) containing the raw numbers and charts available for those interested.
Update
Part 2 of this story is now available, which considers more compression tools, and looks at performance compressing files individually rather than the large tar file.
Thanks to everyone involved. Just finished my pieces of the release
process, generating 502
CD/DVD/BD images. And technically it's still February
14th, somewhere... :-)
I should go and get some (more!) sleep, but I want to see us
completely finished before I do.
Update: (15th Feb) People have been asking about the BD
images. We decided a
while back that we wouldn't ship full-size BD ISO images, simply
due to the sizes of those images. For the same reason, we didn't
generate them for all architectures, just concentrating on i386, amd64
and source. If you're looking for the BD images, you can download/make
them via jigdo.
Update #2: (16th Feb) Yes, it's possible that we
could make a multi-arch BD image containing all of i386, amd64 and
source, similar to the multi-arch DVD. Last time I built that, it
would just about fit on a dual-layer disc. That would
be a really expensive disc to burn, but let me know by email and I can
make the image for you if you really want it.
Last june, I went to Cologne to visit a friend
I'd first met Heike at Debconf7 in Edinburg, where we had much
fun playing some music together. So the next time we met, which was
at FOSDEM '08, she told me that she'd been playing in a band. As in, the
kind of people who make music profesionally. Which was really
cool. She also told me that this
band, which consists mainly of a Canadian couple, would be playing
in Cologne in early june, and that perhaps it'd be nice if I could come
over to watch.
Considering that'd be a nice excuse for a short holiday, I went, and had a great week
in Cologne. Since Heike and the others had to practice, I only saw them
in the evening; but Cologne is a great city, with interesting museums
and other things, so I would spend the day sightseeing in Cologne (and
Bonn on one day), and would be at the particular bar or whatever where
the concert would be in the evening. I had a great time. Before going
home, I bought one of their CDs, since I really liked the music.
Anyway, at this year's FOSDEM, Heike told me that there was a new CD
out (actually MP3 downloads), made from a recording that was done at one
of the concerts. So, today, I bought a copy.
Come to think of it, this is the first time I bought an album of a
concert that I actually went to, and where I did not perform
myself. After all, I don't really go to concerts all that
often unless I'll be on stage.
What's strange is that the music sounds slightly different from how I
remember it. The mind can do strange things... or is it the case that a
recording is not the real thing?
Probably. In any case, the music is great, so go check it out!
This is a followup to the earlier design of
dh. After converting many
packages to minimal rules files using dh, I find that it works very well
for the 3 line rules file case, which works for 80% of packages. But
getting from there to a slightly more complex rules file that 20% of
packages need can be non-obvious.
So, let's make it obvious.
Suppose I want to run dh_compress -Xsomefile. But my rules file as it
currently stands doesn't offer an easy place to run that command:
#!/usr/bin/make -f
%:
dh $@
To use dh in this situation you had to go look up rather a lot of
boilerplate, and to insert an explicit version of the right target, with
the right dependencies, that called dh before and after your command:
#!/usr/bin/make -f
%:
dh $@
binary: binary-indep
binary-indep:
dh $@ --before dh_compress
dh_compress -Xsomefile
dh $@ --after dh_compress
That took me half an hour to come up with, and I wrote this stuff! Also,
if I want to override a second command, I have to do it in the right
order. So, the full flexability of debhelper is there, but it's too
hard to get at.
Here's the new new thing.
#!/usr/bin/make -f
%:
dh $@
override_dh_compress:
dh_compress -Xsomefile
What this does should be obvious. These override targets can be written
for any debhelper command that you need to change the default behavior of,
or even avoid running at all.
override_dh_auto_configure:
./configure --with-kitchen-sink
override_dh_auto_test:
# The test suite for this package is busted on s390.
if [ $DEB_BUILD_ARCH != s390 ]; then dh_auto_test; fi
The overrides can also be used to run additional stuff before, or after any
debhelper command:
override_dh_clean:
dh_clean
rm -rf build_dir
So, I think that's beautiful. Simple, clean, no boilerplate, and intuitively
obvious if you are familiar with debhelper.
I took the package of blackberries from the freezer, where it had sat,
neglected since I picked them from my fecund vines in August. They had
some frost on top; it didn't seem that the wait could have improved them.
But, I figured, let's do this right. No store-bought pie crust, made my
own with lots of love, and no little trepidation, since pie crust is not
my strong suite. Put it back in the fridge to rest as I melted the
frozen berries. Added some honey, then worried I'd sweetened it too much.
Seemed too runny, so added some flour. Spent what seemed a long
time criss-crossing strips of the pastry on top. Which, now that I
look at it, doesn't seem to be quite the way it's typically done, but
whatever.
45 minutes later, it came out, and bliss, it's the most perfect pie I've
ever made. Crust acceptably flaky, berries just the right mix of tart and
sweet. But mostly, it tastes of summer and care, and the wait seems to have
been worth it.
So that's my Debian release pie.
Thanks to everyone involved. Just finished my pieces of the release
process, generating 502
CD/DVD/BD images. And technically it's still February
14th, somewhere... :-)
I should go and get some (more!) sleep, but I want to see us
completely finished before I do.
Update: People have been asking about the BD
images. We decided a
while back that we wouldn't ship full-size BD ISO images, simply
due to the sizes of those images. For the same reason, we didn't
generate them for all architectures, just concentrating on i386, amd64
and source. If you're looking for the BD images, you can download/make
them via jigdo.
Recently, several people noticed that GnuTLS behavior did not match its documentation with respect to two significant security concerns, both regarding X.509 certificate validation:
Alright, Debian GNU/Linux 5.0 AKA as Lenny has been released. Time for a Debian unstable unfreeze party!
This weekend I have mostly been investigating Common Lisp.
If you're new to the environment then you may get started via a simple:
apt-get install clispOnce you've done that the following resources will help you decide whether you're wasting your time or not: It has been a long time since I've had so much fun - even though the first thing I did was experiment with implementing a spam filter - although in my defense I was only classifying based upon the links contained in the mails. So for example:

After my entry yesterday about MySQL truncating data, several people
have pointed out that MySQL 4.1 or later gives you a warning. Yes, this is true. You
can even see it in the example I gave:
Query OK, 1 row affected, 1 warning (0.00 sec)I ignored mentioning this, but perhaps should have said something about it. I reason I didn't mention it was because I didn't feel that a warning really helped anyone. Developers have enough problems remembering to check for errors, let along remembering to check in case there was a warning as well. Plus, they'd then have to work out if the warning was something serious or something they could ignore. There's also the question of how well the language bindings present this information. Take for example, PHP. The mysqli extension gained support for checking for warnings in PHP5 and gives the following code as an example of getting warnings:
mysqli_query($link, $query);
if (mysqli_warning_count($link))
if ($result = mysqli_query($link, "SHOW WARNINGS"))
$row = mysqli_fetch_row($result);
printf("%s (%d): %s\n", $row[0], $row[1], $row[2]);
mysqli_free_result($result);
Hardly concise code. As of 5.1.0, there is also mysqli_get_warnings(),
but is undocumented beyond noting its existence. The MySQL extension
does not support getting warning information. The PDO wrapper doesn't
provide any way to get this information.
In perl, DBD::mysql has a mysql_warning_count()
function, but presumably would have to call "SHOW WARNINGS"
like in the PHP example. Seems Python's MYSQLdb module will raise an
exception on warnings in certain cases. Mostly using the Cursor
object.
In java, you can set the jdbcCompliantTruncation connection
parameter to make the driver throw java.sql.DataTruncation
exceptions, as per the JDBC spec, which makes you wonder why this isn't
set by default. Unfortunately this setting is usually outside the
programmer's control. There is also the
java.sql.Statement.getWarnings(), but once again, you need to
check this after every statement. Not sure if ORM tools like Hibernate
check this or not.
So, yes MySQL does give you a warning, but in practice is useless.
Next.