-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Improve performance in ActiveStorage::Service::MirrorService
#51740
base: main
Are you sure you want to change the base?
Conversation
@@ -30,6 +30,13 @@ def self.build(primary:, mirrors:, name:, configurator:, **options) # :nodoc: | |||
|
|||
def initialize(primary:, mirrors:) | |||
@primary, @mirrors = primary, mirrors | |||
@executor = Concurrent::ThreadPoolExecutor.new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you do a performance benchmarking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I'll add performance benchmark and request review to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akhilgkrishnan
This is performance benchmark using GCS. In my opinion, there is a performance improvement when looking at real time.
-
repeat time: 10
-
Used service: Google Cloud Storage (region: ap-northeast-3)
-
Used image size: 512kb
-
primary: 1, mirrors: 2
Task | Real Time | User Time | System Time | Total Time |
---|---|---|---|---|
Parallel | 0.453 | 0.055 | 0.015 | 0.070 |
Sequential | 0.979 | 0.045 | 0.011 | 0.056 |
- primary: 1, mirrors: 1
Task | Real Time | User Time | System Time | Total Time |
---|---|---|---|---|
Parallel | 0.380 | 0.053 | 0.020 | 0.074 |
Sequential | 0.624 | 0.033 | 0.008 | 0.041 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akhilgkrishnan Could you please review when you get a chance? 😄
00febe1
to
ecfbb5e
Compare
…ervice#delete` and `ActiveStorage::Service::MirrorService#delete_prefixed`
ecfbb5e
to
3f2258a
Compare
Motivation / Background
This Pull Request has been created to remove
FIXME
comment ofActiveStorage::Service::MirrorService
.Detail
This Pull Request use thread pool to parallelize
delete
anddelete_prefixed
inActiveStorage::Service::MirrorService
.Additional information
If this is a nit performance boost than complexity, how about remove comment?
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]