[PR #714] [MERGED] reduce lock contention on file open #1617

Closed
opened 2026-03-04 02:01:20 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/714
Author: @orozery
Created: 2/4/2018
Status: Merged
Merged: 3/4/2018
Merged by: @ggtakec

Base: masterHead: reduce_lock_contention


📝 Commits (1)

  • 0edf056 reduce lock contention on file open

📊 Changes

2 files changed (+65 additions, -56 deletions)

View changed files

📝 src/fdcache.cpp (+64 -55)
📝 src/fdcache.h (+1 -1)

📄 Description

Details

I found that when using use_cache and opening multiple files in parallel, you get a lock bottleneck on fd_manager_lock.

To improve the performance, I made two changes:

  1. Change OpenMirrorFile to use urandom instead of time(), in order to avoid parallel threads creating mirror files of the same name. Additionally, instead of calling time() in a for loop (time changes only every 1 second), just increment the seed.
  2. In FdManager::Open, release fd_manager_lock after fdent is found/created.

Prior to this PR, parallel open requests were served sequentially, with a 1s delay between each (because of the mirror file creation loop being stuck).
With this PR, this delays were gone, and parallel open are returning immediately.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/s3fs-fuse/s3fs-fuse/pull/714 **Author:** [@orozery](https://github.com/orozery) **Created:** 2/4/2018 **Status:** ✅ Merged **Merged:** 3/4/2018 **Merged by:** [@ggtakec](https://github.com/ggtakec) **Base:** `master` ← **Head:** `reduce_lock_contention` --- ### 📝 Commits (1) - [`0edf056`](https://github.com/s3fs-fuse/s3fs-fuse/commit/0edf056e95a240a26627c497edaff94b4370253f) reduce lock contention on file open ### 📊 Changes **2 files changed** (+65 additions, -56 deletions) <details> <summary>View changed files</summary> 📝 `src/fdcache.cpp` (+64 -55) 📝 `src/fdcache.h` (+1 -1) </details> ### 📄 Description ### Details I found that when using use_cache and opening multiple files in parallel, you get a lock bottleneck on fd_manager_lock. To improve the performance, I made two changes: 1. Change OpenMirrorFile to use urandom instead of time(), in order to avoid parallel threads creating mirror files of the same name. Additionally, instead of calling time() in a for loop (time changes only every 1 second), just increment the seed. 2. In FdManager::Open, release fd_manager_lock after fdent is found/created. Prior to this PR, parallel open requests were served sequentially, with a 1s delay between each (because of the mirror file creation loop being stuck). With this PR, this delays were gone, and parallel open are returning immediately. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 02:01:20 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#1617
No description provided.