Reading Time: 6 minutes

Co-authoring files is a phenomenal way to boost organizational productivity, but it can also introduce some roadblocks. The biggest one? Conflicting edits as multiple users work in the same file at once, accidentally overwriting each other's changes and not even being aware another user was in the file. 

One set of edits — whichever is saved last — wins and the other set loses. 

At best, team members lose time and get frustrated, while IT teams get pulled in to try to restore file versions. At worst, important data gets lost and incorrect files get shipped to printers, clients or partners.

So, the question becomes: how can organizations enable collaboration on datasets without sacrificing data quality and consistency? 

Most desktop apps have supported locking for years — it’s a file collision avoidance system that is as well-established as network-attached storage (NAS) itself. File locking prevents data corruption and preserves file integrity by stopping users and team members from editing the same file, or the same part of a file, at the same time so they cannot interfere with each other’s work. Most modern cloud-native applications have more granular range locking built in. For example Google Docs, Sheets, and Slides all support co-authoring with multiple users able to edit these cloud files simultaneously without colliding edits. Microsoft Office applications similarly allow range locking, with significantly better results using desktop applications. 

Global File Locking Explained

Global file locking ensures only one copy of a file is edited at a time, even when the file is on a network drive accessible to multiple users. It prevents file corruption by enabling users to collaborate on the same set of data without the risk of while preventing them from damaging or overwriting each other’s work.

Alternatives to global file locking include versioning - which allows users to open a second copy of a file that another user is currently editing. This copy is tracked as a unique file which allows both users to work simultaneously but gets messy and time-consuming when these individual copies must be manually integrated to ensure all changes are incorporated into the final version of the file. Global file locking prevents this.

But here’s the downside: real time global file locking runs into problems when you introduce distance, including a move to cloud storage. Effective collision avoidance relies on real time recognition of file opens as well as user location within files in order to prevent overwrites. Distance, latency and lack of functionality often render the file locking built into software applications unusable.

File Locking Glossary

Not all file locking is created equal and the geeks among us love to understand the different possible approaches in order to know what’s going on behind the scenes. After all, the resolution for file corruption issues often land in IT, which isn’t usually the team generating or working with the data. Here’s what you need to know.

Advisory Locking

Advisory locking doesn’t provide full protection against conflicting modifications because it relies on cooperation between users. Users can ignore an advisory lock, but that choice is strongly discouraged because it can lead to data corruption and inconsistency.

When a user requests access to a file, the advisory lock will notify that user that a lock is in place. Again, the advisory lock doesn’t prevent access; it only informs the user that they should avoid working on the file. When a user requests an advisory lock for a file, the system will check for any existing locks. If there are existing locks, it will return an error message.

Advisory locks are most effective if multiple users need to access a file simultaneously. However, those users should also communicate with each other so only one user is writing at a time. Even while an advisory lock is in place, other users can continue reading the file without causing problems.

Mandatory Locking

Mandatory locks are enforced by an operating system that prevents users from accessing or modifying a file that another user has already locked. Unlike advisory locks, users can’t choose to ignore mandatory locks. If a user requests a mandatory lock but another mandatory lock already exists, the user will be denied access to the file until the other lock is released.

Mandatory locking is useful when a company needs to keep multiple users from modifying the same file simultaneously. In that case, this type of lock ensures data consistency and prevents file corruption.

On the downside, mandatory locking can create performance overhead and result in synchronization issues if not used properly. The feature is also not available on all file types or operating systems.

Shared Locking

With shared locks, multiple users can access a file simultaneously for reading purposes only. All editing is prevented with a shared lock, which ensures consistency and integrity. Shared locks are granted to users if they don’t conflict with existing locks on a file. An exclusive lock can’t be granted until all shared locks are released.

Shared locks are excellent for companies looking to improve system performance and efficiency. However, if a file needs to be modified frequently, shared locking may not be ideal since editing is prohibited until all shared locks are released.

Exclusive Locking

Exclusive locking grants a single user exclusive access to a file and will hold that lock until released. This prevents other users from reading or writing to the file, ensuring data integrity and preventing conflicts.

Exclusive locking is ideal for sensitive or critical files that require strict control over access. It can also be useful in scenarios where a single user needs to work on a file without interruptions. However, it brings with it the all-too-common scenario in which a user accidentally leaves a file locked by leaving it open on their device. This generally requires IT intervention to break the lock by forcing a user log off.

Range Locking

Range locking allows users to lock specific portions of a file. This prevents conflicting modifications and enables multiple users to collaborate on the same file simultaneously without risking data corruption.

As users move through the file, the application recognizes their location and specifies the start and end points of a byte range, locking it for that user alone. This means users can effectively work on designated sections of a file while preventing others from editing those areas. This is particularly useful for teams collaborating on large documents, codebases, or other complex files where different team members need to work independently on specific parts.

Compared to global write locking, which locks the entire file, range locking provides a more granular level of control, allowing for efficient collaboration on various sections of a file. This more modern approach improves productivity and reduces the likelihood of conflicts, especially in scenarios where multiple users need to work on different parts of a file simultaneously. However, it’s challenging to achieve over distance, as latency means a lag in recognizing where the user has moved to in the file. 

Distributed File System Replication (DFSR) and File Locking

DFSR is a Windows feature that enables efficient file sharing and collaboration by replicating files between multiple servers. DFSR tracks changes at the block level, allowing for efficient replication of specific file modifications. It can operate in synchronous or asynchronous modes, ensuring consistency or allowing for delayed replication.

While DFSR is a powerful tool, it may not be fully compatible with certain file locking mechanisms. DFSR's conflict resolution strategies are not always be sufficient for preventing data corruption or ensuring consistency in scenarios where multiple users are actively editing the same file.

When considering DFSR, organizations should carefully evaluate its limitations and potential drawbacks. Factors to consider include performance overhead, network requirements, and the integration with existing file locking systems. In some cases, alternative replication technologies or custom solutions might be more suitable for achieving desired levels of file sharing and data integrity.

Delivering Performant File Locking in the Cloud

The developers of software applications engineer file and range locking so that it performs maximally for users of the application. And, every aspect of bat365’s hybrid cloud file platform CloudFS is engineered for maximum productivity and efficiency. That’s why CloudFS explicitly enables application-specific locking to work in the cloud and across vast distances.

That means that file locking and granular range locking work at the speed of business for applications that support it, regardless of the number of locations and users or the distance between them.

The core of bat365’s hybrid cloud file platform CloudFS is a global file system that enables an organization to use centralized cloud storage as if the data is still stored near to the user. CloudFS separates metadata from file data and moves the least amount of this lightweight informational data across the shortest possible distance, so every location that accesses cloud-stored files knows exactly what’s happening, in real time.

Locks are passed between locations as they’re requested and either granted or denied. The result from a technology perspective is the seemingly impossible — real time exchange of data around the globe, even when working on very large files and complex file models.

For the organization, the result is global file co-authoring that allows an entire organization to work as collaboratively as if everyone is under the same roof. The competitive advantage that comes with a high-performance file environment like this is exceptionally difficult for others to make up. 

Moreover, it’s largely invisible to the outside world, which leaves this advantage to savvy IT leaders who understand the business impact of enabling high performers with a file environment that supports their best work.

Only a very few solutions come close to enabling performant file and range locking over any distance at all. bat365 CloudFS stands alone in its ability to achieve real time locking globally, irrespective of the number of locations, users at each location, or the distance between them.

From LA to New York, Sydney, Australia to London, England and everywhere in between, bat365 empowers organizations with immediate data delivery that transcends the barriers of distance, network connections and time zones to allow co-authoring and collaboration that fuels business innovation and success.