38 points · by ryandvm · 16y ago · 32 comments
I've been working to decrease the mailserver backup times. Our Zimbra mailstore was taking over 8 hours to backup; I started compressing teh files before writing them to disk and it made a huge difference. I was able to bring the total time down to 3 hours.
I attributed this to two factors- The first was, as the article mentions, that the machine has so much CPU when compared to disk, that the smaller data-transfer helped more than the CPU overhead hurt. I found that this is true for gzip, but bzip2 slowed it down. An implementation of parallel-bzip I found online spreads the bzip cost over multiple cores, reduced this further, however. This leads me to believe that something closer to the OS, which would adjust the compression level dynamically with CPU load, may be a wonderful product.
The second factor was that the compressed files were in tarballs, so didn't create nearly as many files. Zimbra creates one file per message (a maildir like format), so this means hundreds of thousands of files need to be created and sized on the disk. In the archives, however, I am able to store just a few, large files, reducing the overhead of individually creating each message.
This article alludes to a claim that ZFS has fragmentation issues: http://antydba.blogspot.com/2010/02/mongodb-backup-with-zfs....
Because ZFS is a copy-on-write filesystem, Eliot Horowitz says he wouldn't use it for a database: http://groups.google.com/group/mongodb-user/msg/731111475835...
However, a controverting opinion is offered by Jason J. W. Williams, who claims that ZFS works well with large MySQL installs: http://groups.google.com/group/mongodb-user/msg/e94712bc287a...
[edit: Updated links]
IIRC, the latest Firefox (3.6) is now compressing files on-disk using HFS' built-in compression to cut ~20% off launch time.
Part of this is that even very cheap algorithms can consistently get "some" compression; as the article observes, bzip is still a net loss for many cases, but gzip-style compression has been better-than-free for a while now, as long as your CPU isn't loaded.
It's even worse on my Atom laptop. The SSD can do about 150MB/s (as I accidentally bought a really nice one), but the tiny CPU can only manage to decrypt about 20MB a second. And on a laptop, crypto is not exactly paranoia; it's the only sane thing to do.
I've been on the lookout for a fast compression algorithm that gives reasonable ratios, while having a liberal enough license. LZJB is licensed under the CDDL, which is GPL-incompatible, but it looks simple enough to be re-implemented.
Edit: Here we go, a list of compression tools ranked by speed: http://www.maximumcompression.com/data/summary_mf4.php
BriefLZ on that comparison page caught my eye, however. It uses the same license as zLib while being more than twice as fast. We'll have to test that, it would be a good starting point. (and the code is short and clear enough to be understood and reviewed; can't afford to have buffer overflow bugs in it) We can upgrade to QuickLZ or LZO later when we can afford them. Somehow, BriefLZ that seems to have been missing from all the other compression comparison pages I've looked at.
This performance seemed too good to be true until I monitored CPU utilization during a subsequent run of the same benchmarks on a compressed NTFS volume. The CPU utilization on the test jumped from an average of 10 to 18 percent on the uncompressed NTFS volume to a whopping 30 to 80 percent on the compressed NTFS volume.
And most importantly (immediately after the above, separated for extra emphasis):
In addition, performance significantly decreased when I used NTFS compression on larger volume sizes (4GB or greater) and software-based, fault-tolerant RAID volumes.
Methinks we're over the 4GB mark now. The article is too old to be considered accurate any more.
But hard drive speed does not follow Moore's law. If hard drives are the most significant bottleneck, it makes sense to reduce the amount of seeking and reading the hard drive is doing, shifting the work to the usually-idle multicore CPU+GPU.
Makes for interesting reading, since it confirms this benchmark. but on Linux and shows comparable results with Solaris ZFS benchmarks.
And SSD + linux BLOWS everything else away
You have to realize that most Apple applications make extensive use of bit-twiddling in the HFS+ filesystem. Resource Forks are used extensively in the OS X software, particularly the iSomething programs. These would all have to be extensively modified to work w/ a different FS.
Apple has religiously avoided "use of bit-twiddling in the HFS+ filesystem" for years -- everything new since 10.4 uses standard extended attributes. The only remaining uses I can think of are Finder color labels (a special bit-field in HFS), and that a bunch of the standard fonts still use resource forks (they only have a license to redistribute).
But, yes, what I truly want is to ZFS my OS X boot partition. Actually I don't care if it's ZFS - anything BUT HFS please!
Why? Corruption. HFS+ with less than 50% free space is almost guaranteed to corrupt on unsafe shutdown. And it doesn't fsck at boot, leaving you to realize it's been corrupted only when files and folders refuse to copy or spotlight acts up.
The majority of my shutdowns have been unsafe because I suspend my macbook and I don't shut it down until it crashes. I've been doing this for the 2 years I've had my machine. No problems yet.