feat: add thread cap setting for improved stability and performance on slow storage mediums#570
Conversation
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughThis change introduces an SD card capacity optimization feature that adds a new boolean preference to control download thread count limits. The setting propagates through the preference manager and conditionally caps thread counts in the download service based on user configuration. Changes
Sequence DiagramsequenceDiagram
actor User
participant Settings as Settings UI
participant Pref as PrefManager
participant Service as SteamService
participant Downloader as DepotDownloader
User->>Settings: Toggle SD Card Cap
Settings->>Pref: Update sdCardCap
Pref->>Pref: Persist preference
Note over Settings,Pref: Preference saved
rect rgba(100, 150, 200, 0.5)
Service->>Pref: Read sdCardCap
alt Cap Enabled
Pref-->>Service: true
Service->>Service: Apply thread caps<br/>(8/16/24/32)
else Cap Disabled
Pref-->>Service: false
Service->>Service: Calculate threads<br/>from CPU cores
end
end
Service->>Downloader: Initialize with<br/>maxDownloads/maxDecompress
Downloader-->>Service: Ready to download
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi, thanks for this PR. I'll review it soon. |
|
Also the tests are failing? |
c758ce0 to
d7e2871
Compare
I added a setting to cap the decompression thread to 1, as well as significantly lowering the effect of the download speed setting on download threads. The purpose of this setting is to adapt these to the limitations of simpler storage mediums (primarily micro SD cards), and avoid I/O jams that negatively affects download performance and app stability.
Through my own testing this solves an issue where the app interface would become extremely unstable and crash frequently during downloads. The gains in stability and lowering download performance to the hardware bottleneck seem to counteract any losses to speed. And through my own testing as well as some rudimentary research into the workings of exFAT formatted SD cards I have determined that decompression threads should not exceed 1, and that download threads benefit from being higher than the decompression threads. Likely due to decompression being faster than downloads, and allowing the decompression thread a buffer to always work at full capacity.
I have decided to keep the download threads variable through the speed setting, as I believe the optimal download threads will also depend on network speeds. I have also decided not to lock the setting behind the condition of external storage being used, not force it on for external storage. As I believe there could be internal storage mediums that also benefit from this setting, and external storage mediums that don't.
P.S. This is my first ever commit/pull request to an open source repo, apologies in advance if I've done anything wrong or if my code is bad.
Summary by cubic
Added an optional “SD card cap” setting to optimize downloads on slower storage (e.g., microSD) by capping decompression to 1 thread and reducing download threads. This lowers I/O contention and improves stability during large downloads.
Written for commit d7e2871. Summary will update on new commits.
Summary by CodeRabbit