Decentralized File Synchronization – Part 1

cloud7

Anyone can benefit from file synchronization. Having the most up-to-date files available from every one of your devices is a huge benefit. Imagine having quick and easy access to: your password manager database (if you still don't entrust cloud providers with your credentials, read this), your photos, resume, music, etc… The list goes on.

There are a number of approaches through which file synchronization is accomplished:

1) Manual syncing with a USB thumb-drive
For obvious reasons, this approach is not ideal when dealing with a large number of files that change often. There are automated ways to set up syncing, but it still doesn't change the fact that your data is being carried around in one place. This method also doesn't scale well with multiple devices.

2) Centralized cloud storage  

This is a very popular mechanism to ensure data is accessible from all devices. Google Drive, Apple iCloud, OneDrive, and Dropbox are some of the big players in this area, and will likely be sticking around for the foreseeable future. Some cloud storage providers do still shut up shop, which is something to note, but the ones above have shown to be relatively stable.

Other things to note with cloud storage: 1) You need a working internet connection to access it, 2) Your data is stored on servers out of your control, and 3) If you have more than one device grabbing the data, your data usage is multiplied per-device.

There are ways around these issues by self-hosting your own cloud storage locally, but it still doesn't get around the fact it doesn't scale well when using multiple devices over the internet. This is outside the fact you still need to setup and maintain a database, web server, applications, etc. And do you want to scale? Well, you'll want to get a High Availability setup of each of these pieces. While this isn't a problem for larger companies, it's not practical for your average internet user. Also, what if your phone, laptop, and tablet are all beside each other? If you upload a 1GB file from your phone to your cloud provider and your other two devices download it, that's 3GB of data used over a slow internet connection.

What if you could have all the benefit of central file storage, but also have local syncing to get LAN speeds and internet bandwidth savings? What if your internet connection is having issues, but you still want your local devices to be able to synchronize with each other? The third option helps answer these questions…

3) Decentralized file synchronization

This is still a rather new concept. Decentralized file synchronization gives great transfer rates, while also giving users the ability to control their own data (your data also doesn’t leave your own personal devices). Two popular choices in this area are BitTorrent Sync (first released in January 2013 to a select number of testers as a closed-source proprietary solution) and SyncThing (a free and open source solution released to the public in December 2013). Both have a wide range of platform support, but at this time, SyncThing does not have Apple iOS support.

Now, this method of file synchronization isn't all rainbows and butterflies. There are obviously some drawbacks as well. First off, there always has to be two nodes turned on in order for the data to be synchronized. This also technically applies to any centrally data stored. So, if your phone is the only device on and doesn't have another node to synchronize with, your updated copy is not backed up. This can be trivially worked around by installing the application on a device that's always-on, such as a desktop PC. Another downside is that each folder’s sharing setting is automatically an "all or nothing" type approach. Your device either downloads all data from a shared folder, or none at all. On the bright-side, this ensures that you have more copies of data available in case any one of your devices die or are lost.

On another downside, it is not high on the list of most efficient storage mechanisms. With smaller files such as mobile photos, password-manager databases, etc., it's generally not a problem, but for larger media content libraries, it can take up a lot of space (since all devices have every copy of every file).

BitTorent Sync has an option to alleviate this issue called Selective Sync, which is available with their annual subscription ($39US/year for personal use). This feature is currently not available on SyncThing, but may come in the future. A side project called Syncthing FUSE attempts to fill this gap by not requiring every file to be synchronized. It's a very delicate balance between ensuring there is enough redundancy, yet not being overburdened by storage requirements. This can definitely change from person-to-person and content-to-content.

With the drawbacks out of the way, it's time to talk about what makes decentralized synchronization great. These have been much written about for SyncThing, but BitTorrent Sync should be similar feature-wise.

It's scalable! Want more speed or redundancy? You can add another node to replicate your data in about two minutes.

It's tiny! The Windows installer for Syncthing is 5.4MB, and the installer for BitTorrent Sync is 8.5MB. No dependencies to manage or prerequisites to setup – just install and go. Even the agents can be setup to automatically update, so you don't need to worry about that piece.

Local discovery. Have you updated a number of files on your laptop that you also want on your phone and tablet? If they're on the same network this can happen nearly instantaneously. Since the clients can discover other nodes that are on your local network, they don't need to touch the internet to send updates between each other. I personally love being able to take photos on my phone and see them pop-up on my laptop faster than I can look at my laptop screen.

Master Copy. If you like, you can choose to have one device become the master copy of per-folder data. This device ignores any updates from other nodes. This is perfect if you want a one-way sync (i.e: photos taken with your mobile phone) or if you want to replicate your data with a friend, but don’t want them to change any of the data.

Part two of this article will be about setting up SyncThing to synchronize files between two personal nodes, and one node of a friend.