How to improve the file server's time-consuming problem of deleting large folders

When deleting large folders in the file server, it is often time-consuming. For example, on less fast storage, deleting a folder that contains 100,000 files may take 1 to 3 minutes. If waiting for the deletion result in the original thread synchronously, it will block the running of the original thread. If deleting the folder asynchronously in another thread, while it does not block the operation of the original thread, for those users who pay attention to the deletion result, they still need to wait for the result of asynchronous operation, so from the user's perspective, the deletion operation is still slow.

deleting large folders in the file server,

How to improve this status

Given that the folder in the file server, from a user's perspective, is invisible to the user, it has achieved the effect of being "deleted". Therefore, if we can hide the display of the folder on the premise that the server successfully deletes the file, and then respond to the user's delete request immediately, finally complete the actual deletion operation, then in the eyes of users, the deletion speed of the server has been greatly improved.

As mentioned earlier, we can rename the folder before actually deleting it, adding a specific pending deletion tag (this could be a predetermined string), and then hide the display of the folder with the pending deletion tag on the server side. Contrary to actual deletion operation, folder renaming is very fast, hence in the user's eye, we rapidly deleted the target object. Afterwards, to ensure the folder to be correctly deleted, we can set up a database, record the actual path of the renamed folder, and then actually delete the object in a specific thread.

Measures to Improve Time-Constant Deletion of Large Folders from File Servers by Raysync

Raysync is a file system based on a self-developed Raysync transfer protocol. It provides a secure and efficient file transfer and synchronization solution for users. For the issue of time consumption for users to delete large folders on the server side, Raysync has well practiced the above idea. Its practice is as follows:

 deleting large folders in the file server

Step 1: After receiving the deletion request from the user side, the server side first renames the target folder, adding a specific string starting with .delete as a pending deletion tag.

Step 2: Block the user side display of folders with a pending deletion tag.

Step 3: Respond to the user side deletion request.

Step 4: Record the actual path of the folder to be deleted into a specific database.

Step 5: In dedicated threads, read the database record regularly, completing the actual deletion operation for the folder to be deleted.

Step 6: For each successful folder deletion, delete the corresponding record in the database. For failed deletions, keep the record for the next deletion.

For a folder that contains hundreds of thousands or even millions of files, the Raysync can respond to the user's repair request quickly (usually within 1s) while ensuring the correct deletion of the folder. From a user's perspective, the speed improvement of this completely asynchronous deletion method compared to directly deleting the target folder is significant (from minutes to within 1s).

Conclusion

Deleting large folders on a file server often takes a considerably long time, which impacts the server's performance and efficiency. To address this problem, one can adopt the solution provided by the file transfer software - Raysync. Raysync is renowned for its ultra-high speed and stability, capable of achieving rapid transfer and deletion of large files or folders of several hundred GB or even TB scale.

Share This:

You might also like

Raysync News

January 24, 2024

How to solve the problem of sending UDP too fast?

The connectionless and unreliability of UDP also brings a series of challenges, especially when the data transfer speed is too fast. This article will explore these problems and introduce the solution.

Read more

Raysync News

November 17, 2023

Comparison of several tools for data synchronization 2024

Data synchronization is crucial for businesses to ensure unified and consistent data everywhere. Keep reading to learn about its importance, challenges, and best data sync software.

Read more

Raysync News

April 13, 2021

What is the best way to send large files?

What you do when someone asks you to send large files over the internet? This article lists 10 free services to send large files in 2021 that you can refer to it.

Read more

We use cookies and similar technologies to collect information about how you interact with our website and allow us to remember you. We use this information in order to improve and customize your browsing experience and for analytics and metrics about our visitors both on this website and other media. To find out more about the cookies we use, see our Cookie Policy & Privacy.

If you decline, your information won’t be tracked when you visit this website. A single cookie will be used in your browser to remember your preference not to be tracked.