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

Feature/concurrent dcopy #123

Merged
merged 12 commits into from
Oct 2, 2023
Merged

Feature/concurrent dcopy #123

merged 12 commits into from
Oct 2, 2023

Conversation

otiai10
Copy link
Owner

@otiai10 otiai10 commented Sep 3, 2023

Fix #81
Fix #120

ycombinator and others added 6 commits September 2, 2023 19:21
* Use worker pool

* Introduce Concurrency() functional option

* Collect all errors

* Simplify type of Concurrency option

* Make channels buffered

* Make input channel unbuffered

* Logging for debugging

* 10x channel capacities

* 10x concurrency

* 100x concurrency

* 100x in channel

* Make output channel 1000x

* Reducing numWorkers multiplier by 1/10

* Removing numWorkers multiplier

* Reducing in channel capacity by 1/10

* Reducing output channel capacity by 1/10

* Reducing output channel capacity by further 1/10

* Remove input channel capacity multiplier

* Removing multiplication factor for output channel capacity

* Remove debugging statement

---------

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
@otiai10 otiai10 marked this pull request as ready for review September 3, 2023 15:32
@otiai10
Copy link
Owner Author

otiai10 commented Sep 4, 2023

@ycombinator Please take a look and comment. Please try this version on your local as well if possible.

@otiai10
Copy link
Owner Author

otiai10 commented Sep 6, 2023

@ycombinator any comment on this?

@ycombinator
Copy link
Contributor

ycombinator commented Sep 6, 2023

@otiai10 I have not yet had time to look at this. My plan is to look at it tomorrow (Friday).

I took a quick glance at this PR, though, and noticed one major difference from my implementation in #120 is that in this one you are only concurrently copying directories. Whereas, in 120, all files were being copied concurrently. Any reason for this difference?

@otiai10
Copy link
Owner Author

otiai10 commented Sep 7, 2023

When we call copy.Copy, the parameter must be an entry. This is the key fact.
Let's name it a root entry.

  • If the root entry is a file, no need to be concurrent.
  • If the root entry is a pipe, a symlink, do not copy concurrently.
  • If the root entry is a directory, copy concurrently.

Thus I did like this.

But I found a critical bug of this implementation in another context, thus I'll close this.

@otiai10 otiai10 closed this Sep 7, 2023
@otiai10 otiai10 reopened this Sep 7, 2023
@otiai10 otiai10 marked this pull request as draft September 7, 2023 03:24
@otiai10 otiai10 marked this pull request as ready for review September 7, 2023 06:56
@otiai10
Copy link
Owner Author

otiai10 commented Sep 7, 2023

Fixed

README.md Show resolved Hide resolved
Copy link
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thank you!

I tested this PR with elastic/elastic-agent#3212 (comment) and updated the performance results in the table. There is definitely a speed improvement!

@otiai10
Copy link
Owner Author

otiai10 commented Sep 13, 2023

@shiwork That would be great if you can leave some comment on this PR 🙇
You can mainly check copy.go and benchmark_test.go.

@ycombinator
Copy link
Contributor

Hi @otiai10, any plans to merge this PR? We are trying to use this improvement in Elastic Agent during installation (see elastic/elastic-agent#3212). Thanks!

@otiai10
Copy link
Owner Author

otiai10 commented Oct 2, 2023

@ycombinator Thank you for pinging. I'll get back to you soon 🙇

@otiai10 otiai10 merged commit fba066a into main Oct 2, 2023
21 checks passed
@otiai10 otiai10 deleted the feature/concurrent-dcopy branch October 2, 2023 04:47
@otiai10
Copy link
Owner Author

otiai10 commented Oct 2, 2023

@ycombinator Released under v1.14.0

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.

Option to copy two or more files simultaneous
2 participants