Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gateway: add one more hierarchy to upload tmp/multiupload dir to reduce txn conflicts #5549

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

polyrabbit
Copy link
Contributor

In the current gateway implementation, the tmp/upload directory is a flat structure, which can easily lead to concurrency conflicts under high concurrency. These conflicts severely impact performance and prevent the gateway from scaling.

We can reduce conflicts in those large directories by adding a layer of hierarchy.

@polyrabbit polyrabbit force-pushed the upload-dir-hierarchy branch from 91c784d to fb85f23 Compare January 12, 2025 16:22
Copy link

codecov bot commented Jan 12, 2025

Codecov Report

Attention: Patch coverage is 33.33333% with 42 lines in your changes missing coverage. Please review.

Project coverage is 45.71%. Comparing base (5714660) to head (63bef7d).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
pkg/gateway/gateway.go 33.33% 38 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5549      +/-   ##
==========================================
- Coverage   50.57%   45.71%   -4.87%     
==========================================
  Files         166      164       -2     
  Lines       48152    47873     -279     
==========================================
- Hits        24353    21884    -2469     
- Misses      21076    23349    +2273     
+ Partials     2723     2640      -83     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pkg/gateway/gateway.go Outdated Show resolved Hide resolved
@polyrabbit polyrabbit force-pushed the upload-dir-hierarchy branch from fb85f23 to 08885bd Compare January 15, 2025 08:13
@davies
Copy link
Contributor

davies commented Jan 17, 2025

This is a behavior change, I think we should introduce a parameter to enable it.

@davies
Copy link
Contributor

davies commented Jan 17, 2025

The CompleteMultipartUpload should also try to lookup parts in different dirs.

@polyrabbit polyrabbit force-pushed the upload-dir-hierarchy branch 2 times, most recently from 3224407 to 4bbe479 Compare January 17, 2025 04:13
@polyrabbit
Copy link
Contributor Author

OK, updated CompleteMultipartUpload to also look up in old flat dir when part is not found in new dir. I suppose this can made CompleteMultipartUpload smooth during upgrade, and we can avoid one extra flag.

Please review:
https://github.com/juicedata/juicefs/compare/21200b52e86135325cd705138e7a20e6ab0ecd74..4bbe479feefc402a9c50fe309a5a0a680cd69e9a

pkg/gateway/gateway.go Outdated Show resolved Hide resolved
@polyrabbit polyrabbit force-pushed the upload-dir-hierarchy branch from 4bbe479 to 63bef7d Compare January 17, 2025 06:26
@davies davies merged commit c8e0516 into juicedata:main Jan 17, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants