Skip to content

remove multi-threaded downloading#191

Merged
AndreyNikiforov merged 6 commits intoicloud-photos-downloader:masterfrom
AndreyNikiforov:feature/remove-mt
Oct 29, 2020
Merged

remove multi-threaded downloading#191
AndreyNikiforov merged 6 commits intoicloud-photos-downloader:masterfrom
AndreyNikiforov:feature/remove-mt

Conversation

@AndreyNikiforov
Copy link
Copy Markdown
Collaborator

feat: removed multi-threaded downloading and added deprecation notice to --threads-num parameter #180, #188

icloudpd/base.py Outdated
@click.option(
"--threads-num",
help="Number of cpu threads (default: 1)",
help="Number of cpu threads -- depricated. To be removed in future version",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

also here "deprecated"

@ndbroadbent
Copy link
Copy Markdown
Collaborator

Sure, I just saw this follow-up comment about the download times: #171 (comment)

So that sounds fine to me!

Copy link
Copy Markdown
Collaborator

@menkej menkej left a comment

Choose a reason for hiding this comment

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

Fine with me - apart from the typo, but I'm currently running some tests on multithreading, so let's wait some days before we really remove it.

@AndreyNikiforov
Copy link
Copy Markdown
Collaborator Author

Fine with me - apart from the typo, but I'm currently running some tests on multithreading, so let's wait some days before we really remove it.

Current (1.6.2) multi-threaded downloading implementation has a number of shortcomings that cause a majority of issue reported for the project since I started paying more attention to it:

  • deduplication does not work with threads > 1, we changed default to 1 to reduce chances of ppl hitting this issue
  • until_found is inconsistent (btw it forces threads == 1), causing failing tests (==false alarms); this is because current pub-sub implementation checks counter at publisher and moving this check to subscriber requires additional back pressure implementation

We did confirm in a number of tests that multi threaded downloading does not improve speed on fast and slow connections. Anybody should be able to repeat tests and validate for themselves using 1.6.2. Here are things to keep in mind while testing multi-threaded vs single-threaded:

  • iCloud account should not have any duplicates
  • test should not use --unit-found parameter

If we are to fix/re-implement parallel downloading, we'll have to keep the following in mind:

  • deduplication should take both in-flight tasks and files on disk into account
  • until-found may be really tricky to implement to avoid any unnecessary processing/downloading
  • it would be most likely more resource efficient to use event loop-based IO concurrency like asyncio

With all that in mind, I feel it would be better to release this feature as 1.7.0, continue any multi-threaded downloading testing using 1.6.2, and revisit parallel downloading if tests show any promises and we have resources to implement parallel downloading correctly. @menkej will that work for you?

@AndreyNikiforov AndreyNikiforov merged commit faf439b into icloud-photos-downloader:master Oct 29, 2020
@AndreyNikiforov AndreyNikiforov deleted the feature/remove-mt branch October 29, 2020 21:27
@jmonster
Copy link
Copy Markdown

jmonster commented Aug 5, 2022

@AndreyNikiforov was this feature re-added? The cli arg --help still advertises this feature (as does the README). I'm not asking you to put it back, but if it is is supposed to work, it doesn't seems broken

https://github.com/icloud-photos-downloader/icloud_photos_downloader/search?q=threads_num

@AndreyNikiforov
Copy link
Copy Markdown
Collaborator Author

was this feature re-added?

What makes you think so?

The cli arg --help still advertises this feature (as does the README). I'm not asking you to put it back, but if it is is supposed to work, it doesn't seems broken

What do you mean by advertising? Help in 1.7.2 says that feature is deprecated and will be removed. It is not broken, it is just noop (==does nothing).

rhoopr referenced this pull request in rhoopr/kei Feb 8, 2026
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.

4 participants