[GH-ISSUE #1711] FR: Multithreaded library synchronization #937

Open
opened 2026-02-26 02:34:41 +03:00 by kerem · 1 comment
Owner

Originally created by @maevii on GitHub (Sep 30, 2023).
Original GitHub issue: https://github.com/koel/koel/issues/1711

Description
At the moment, php artisan koel:sync uses a simple foreach loop to iterate through all songs and add them to the database, occasionally stopping to update the progress bar. This can take quite a long time on large libraries no matter the hardware involved (my 50k FLAC song library takes upwards of 40 minutes to scan for the first time with a 7950X3D, even when stored on a Samsung 980 PRO with memory_limit set to 8192M). I think this could be improved if the work was split up into multiple threads that run simultaneously.

Making 1 thread per song would probably be excessive for large libraries, and since the CPU usage while scanning is very low I don't think 1 thread per CPU core would make much sense either, though that can only really be verified by testing.

Example
N/A

Originally created by @maevii on GitHub (Sep 30, 2023). Original GitHub issue: https://github.com/koel/koel/issues/1711 **Description** At the moment, `php artisan koel:sync` uses a simple foreach loop to iterate through all songs and add them to the database, occasionally stopping to update the progress bar. This can take quite a long time on large libraries no matter the hardware involved (my 50k FLAC song library takes upwards of 40 minutes to scan for the first time with a 7950X3D, even when stored on a Samsung 980 PRO with `memory_limit` set to 8192M). I think this could be improved if the work was split up into multiple threads that run simultaneously. Making 1 thread per song would probably be excessive for large libraries, and since the CPU usage while scanning is very low I don't think 1 thread per CPU core would make much sense either, though that can only really be verified by testing. **Example** N/A
Author
Owner

@phanan commented on GitHub (Dec 28, 2023):

PR welcomed.

<!-- gh-comment-id:1871118006 --> @phanan commented on GitHub (Dec 28, 2023): PR welcomed.
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/koel-koel#937
No description provided.