Lessfs-1.6.0-beta1 has been released

This version of Lessfs contains some minor bug fixes as well as something new. Although my previous post states that no new features would be added to the 1.x series this release actually does. Lessfs now supports the LZ4 compression algorithm. Adding support for new compression methods to lessfs is not much work at all and there have been a number of votes for adding LZ4 so it can be compared with Googles snappy compression.

I did not test LZ4 on high end hardware yet. However even on my laptop it is clear that LZ4 does outperform snappy. With the hardware being the bottleneck LZ4 still manages to speed things up by 2~5%. Most likely the difference will be larger when fast hardware is used. The system that I use for performance testing has Berkeley DB stored on SSD and the data on a fast raid5 array containing 8 SATA drives.

I will post the exact performance numbers on low and high end hardware after testing has finished.

Enjoy,

Mark

Posted in Uncategorized | 8 Comments

Lessfs-1.6.0-beta0 has been released.

This version of Lessfs comes with a significant number of changes.
The multifile_io backend is now fully functional with replication.

By default Lessfs will now compile with berkeleydb instead of tokyocabinet. Lessfs requires berkeleydb >= 4.8.

Batch replication has been extensively tested and improved. Some nasty problems that could occur when either the master of the slave suffered an unclean shutdown have been solved.

In the SPEC files snappy compression is now enabled by default.

Lessfs-1.6.0 will be the last of the 1.x serie releases that introduces new features. From now on the Lessfs-1.x series will remain frozen and new releases will only contain bug fixes.

Posted in Uncategorized | 4 Comments

Garbage collection with a compressing and deduplicating filesystem

How lessfs plays tetris and wins

Introduction

Many data de-duplicating file systems or backup solutions struggle with the same thing.   Deleting data from such a file system is complicated since a single chunk of data can be used by many files.  Things become even more complicated when the file system also compresses the data. In that case the chunks no longer have a nice equal size but instead they can have any size between zero and the maximum allowed block size. This makes reusing the available space similar to playing tetris.

tetris

Solving the puzzle

The current versions of Lessfs have two ways to handle garbage collection. The file_io backend simply keeps a freelist with offsets that can be reused by the file system. It does not free up space to the underlying file system. It just no longer grows when free space can be found in the file. This strategy comes with a number of drawbacks though. One disadvantage is that finding and filling holes in the file takes time and causes the IO to become very random. Which of course is bad for the throughput. And sadly your disk will still be full with a large blockdata file, even when you have removed most of the data from the filesystem. The chunk_io backend does not have this disadvantage. When you delete the data from the file system the individual chunks are simply removed and all is well. Or is it? The disadvantage in this case is that millions of chunks will result in millions of files that have to be stored on the underlying file system. Btrfs does this pretty efficient and is therefore usable. However all file systems suffer when many millions of files have to be stored or deleted.

Problem solved : Lessfs multifile_io

Lessfs 1.6 introduces a new backend : multifile_io that addresses all the problems that where mentioned before.

Data is now stored in chunks that are rounded at 512 bytes. So a compressed chunk with a size of 4000 bytes will allocate 4096 bytes on disk. Lessfs simply opens 256 files. One file for chunks that are 512 bytes in size, one file for chunks that are 1024 bytes in size and so on. This simplifies our game of tetris quite a bit since you can now easily move a block from the top of the file to a hole somewhere at the bottom of the file. However doing so with a life file system would be rather complicated and not safe at all. Therefore Lessfs opens two sets of 256 files. The first file set is active for writing data, while the second is being optimized. When then Lessfs is done with optimizing the second file set it switches to the first file set and the writes are done to the second fileset. Since Lessfs uses transactions it switches the fileset used for writing at a moment when Lessfs is stable, the transactions are committed and no writes are done. Lessfs also waits before actually truncating the optimized files so that it is certain that this can be done safely because the databases have already been committed to disk.

To be able to relocate a chunk of data that is stored at the end of a file we need to be able to determine the hash of the data. In theory it is possible to uncompress the chunk and recalculate the hash. In this case Lessfs simply stores the hash before the data chunk. This also makes it possible to easily verify or even relocate the data with a separate program.
In fact this makes a tiered solution with data automatically migrating between SSD/SAS/SATA very simple to implement. Although data migration is even easier with the chunk_io backend.

So there you have it. Lessfs now supports online space reclamation that is safe and performance efficient even though lessfs uses data compression.

Things to come

On the top of my list is now switching to the lowlevel fuse interface. This will make Lessfs much faster in combination with SAMBA or NFS. Also improving replication and support for data tiering are high on the list. When Lessfs switches to the lowlevel API support for tokyocabinet as database will most likely be dropped. Support for using TC as data store will however disappear for sure. This removes a lot of obsoleted code from the project which is always a good thing.

Enjoy,

Mark Ruijter

Lessfs-1.6.0-alpha0 is the first release that contains multifile_io. This is still alpha quality code and replication does not yet work with multifile_io.

Posted in Uncategorized | 3 Comments

Lessfs-1.5.7 has been released

This version of Lessfs adds support for Googles snappy compression.
http://code.google.com/p/snappy/

Although QuickLZ and LZO are very fast, snappy is truly amazing.

Lessfs with snappy:

time cp /tmp/Some_software_DVD.iso /fuse/

real 0m11.214s
user 0m0.021s
sys 0m2.863s

Lessfs with QuickLZ 1.5.0:

time cp /tmp/some_software_DVD.iso /fuse/

real 0m30.292s
user 0m0.027s
sys 0m3.272s

ls -alh /tmp/some_software_DVD.iso
-rw-r--r-- 1 root root 3.3G Sep 18 02:07 /tmp/some_software_DVD.iso

Other changes

Lessfs-1.5.7 comes with an important bug fix.
A bug introduced in lessfs-1.5.6 can cause deadlocks. When you use lessfs-1.5.6 then you are advised to upgrade.

Posted in Uncategorized | 29 Comments

Lessfs-1.5.6 has been released

Lessfs-1.5.6 now comes with support for forcing the rotation of a replication logfile.
echo 1 >/.lessfs/replication/rotate_replog

It also fixes a recently introduced bug that caused the replication logfile not to rotate after REPLOG_DELAY had expired.

A new feature is that lessfs_stats now shows the compression/deduplication ratio.

Last but not least a bug has been fixed that allows Lessfs IOPS to increase from approx 1000 IOPS to more then 6000 IOPS. This has been measured with Lessfs compiled with Berkeley DB and the databases stored on an Intel X25M SSD.

Posted in Uncategorized | Leave a comment

Lessfs-1.5.4 has been released

This version of lessfs contains an important bug fix. As of lessfs version 1.4.10 a bug causes lessfs not to reclaim space when used with the file_io backend.

Posted in Uncategorized | 2 Comments

Lessfs-1.5.3 is available for download

This version of lessfs improves robustness when lessfs is used with replication. Previously data corruption of the slave could occur after crashes or unclean shutdowns of either the master or the slave.

Posted in Uncategorized | Leave a comment

Lessfs-1.5.0 has been released

This release contains a number of performance improvements for the Berkeley DB backend. It also comes with an alternative to file_io, named chunk_io. chunk_io has one big advantage over file_io. Where file_io stores all the data in one big file, chunk_io stores the data as 4~128k chunks. When data is deleted from lessfs with chunk_io, it immediately results in free space for the underlying filesystem. The file_io backend only marks space in the blockdata file as being available to be reused, but does not actually shrink the file. To keep the number of files in a single directory to an acceptable maximum the depth of the directory structure can be specified with the CHUNK_DEPTH directive. By default the data will be hashed into 256 directories which is also the minimal required depth.

The chunk_io backend works well with btrfs and to some extend with reiserfs.

Enjoy,

Mark Ruijter

Posted in Uncategorized | 17 Comments

Lessfs-1.4.9 is available for download

This version add one new feature to lessfs. When configured with  –enable-filelog lessfs will log to a file instead of using syslog.

Posted in Uncategorized | 11 Comments

Lessfs-1.4.7 is available for download

This version of Lessfs contains two important bug fixes. One problem was solved with hard linking a hard linked file. In this case the name of the newly created hardlink would not be NULL terminated when lessfs was used with Hamsterdb or BDB.

A problem with the newly created block sorting routines has been solved as well.

Posted in Uncategorized | 9 Comments