Distributed File Locking: A Modern P2P Solution for Remote Teams

Ilan Shamir

Ilan Shamir

Discover how Resilio's peer-to-peer architecture revolutionizes distributed file locking, delivering sub-second response times and true offline support—solving the remote work challenges that traditional solutions can't.

How Resilio Active Everywhere Revolutionizes File Locking with 100x Faster Performance and Offline Support

The Resilio Active Everywhere Platform introduces a robust file-locking feature to enhance collaboration and efficiency in distributed environments. This innovative implementation leverages peer-to-peer architecture to deliver unparalleled speed and offline work support across multiple devices. File locking has been around for a while, but current implementations suffer from performance issues and a lack of support for offline work. Resilio addresses both problems. This write-up explains the Resilio file locking implementation approach and how it differs from existing solutions.

What is Distributed File Locking?

Distributed file locking is a method that prevents multiple processes (typically multiple users) from simultaneously modifying the same file in a distributed environment. This function is essential for avoiding data corruption and ensuring consistency across different systems.

The Good Old Days…

In the good old days, people and systems were colocated and accessed centrally stored data over SMB or NFS. Both network file-sharing protocols provide file-locking capabilities and prevent multiple editors from concurrently modifying the same file or project. Most organizations used Microsoft Windows file servers for file shares and Windows desktops for employees, so file locking was a non-issue.

…Blown by the Wind

The modern work environment is quite different. Post-pandemic and post-globalization, companies have multiple offices, multiple data centers, and many remote and hybrid employees. Also, the IT stack is no longer Windows-centric.  Mac, Linux, various cloud solutions, and NAS devices are all used in the same enterprise environment. A centralized file server with numerous SMB or NFS shares is no longer a solution for file locking.

Traditional Distributed File Locking Solutions

The traditional solution involves a client-server architecture with a centralized file-locking server.  Whenever an application tries to open files for writing, a request is submitted to the centralized file-locking server to obtain the necessary locks. If the locks are available, the application is permitted to open the files.

An Example of Traditional Hub-and-Spoke File Locking Architecture
An Example of Traditional Hub-and-Spoke File Locking Architecture

Several companies offer a solution of this kind, including Panzura, Nasuni, and Peer Software. Given the architecture, these solutions have scaling limitations, and their performance is less than ideal. Many file operations require communication with the centralized file-locking server. This architecture introduces long delays in file operations and worsens when servers and caches are geographically distributed, as network latency also impacts communication with the lock server.

In addition, there is no support for offline work or efficient access to files by remote employees. The only way to access files from a desktop is to mount an SMB share on a caching gateway.

A Modern Approach

Resilio takes a different, more modern approach: lock information is always available on each server and caching gateway, and desktops and laptops can cache files locally and lock them for editing. Delivering speed, efficient remote file access, and support for offline work.

Lock availability is checked locally. Resilio maintains an in-memory index of the file system to enable fast and scalable file synchronization. This index is efficiently synchronized and merged across all systems involved. This mechanism has been part of Resilio since the early days of Resilio Sync and BitTorrent Sync. We take advantage of this infrastructure to also sync file locks across all systems involved.

Resilio issues locks almost instantly and propagates locks within a few seconds. This performance is 10 to 100(!) times better than that of competitive solutions.

With latency and communication problems out of the way, we also offer local file locking on desktops and laptops. Your user’s files can be cached locally and locked if needed. Resilio also allows desktops and laptops to go offline while maintaining the lock.

An Example of Our Modern Approach to Distributed File Locking
An Example of Our Modern Approach to Distributed File Locking

A Few More Details

Resilio lock servers are distributed. True to our peer-to-peer nature, instead of a centralized file-locking server, Resilio uses multiple systems (Agents) on the customer’s peer-to-peer network as lock servers. It ensures performance and high availability.

Locking behavior is configurable. Admins can control the timeout for offline locks and exclude files and folders from locking. They also have a centralized view of all file locks in the system, can identify lock owners, and unlock files manually whenever necessary.

Data safety is a top priority. By default, when a system cannot communicate with other systems about the state of locks, it switches to read-only mode. This default behavior can be changed to prevent any file access or allow all file access (sometimes, the ability to modify is more critical than preventing file conflicts). When file conflicts happen, Resilio maintains a complete file history in its distributed file archive.

IT productivity and ease of support are also important. File locking could be a pain for the IT team to support. With Resilio, admins can easily find and release locks by specific file name, user name, or system name without using multiple tools across multiple systems (Process Explorer, anyone?).

Summary

Resilio and Active EverywhereAlternatives
Lock SpeedSub-secondA few seconds to many minutes
Time to Open a Large ProjectSecondsMany minutes
Desktop Caching with LockingEnabledImpossible
Offline Work with LockingEnabledImpossible
ArchitectureDistributed, Peer-to-PeerHub-and-Spoke
Finding Lock OwnersAlways easyNot always easy

Resilio Active Everywhere ensures seamless file synchronization and locking across various operating systems, making it ideal for efficiently managing Word, Excel, AutoCAD, Revit, and other documents efficiently in distributed environments.

Overview

Discover how Resilio's peer-to-peer architecture revolutionizes distributed file locking, delivering sub-second response times and true offline support—solving the remote work challenges that traditional solutions can't.

Related Posts

Schedule Demo

Step 1: fill in your details

On the next step you will be able to choose date and time of the demo session

Additional Resources

Resilio Platform for Server Sync

Related Posts