|
29 | 29 | class StorageDeviceType(StrEnum): |
30 | 30 | """Classification of rootfs storage device performance tier. |
31 | 31 |
|
32 | | - L1: High-performance storage (NVMe SSD). |
33 | | - L2: Medium-performance storage (SATA SSD). |
34 | | - L3: Low-performance storage (eMMC, SATA HDD, or unknown). |
| 32 | + - L1: High-performance storage (NVMe SSD). |
| 33 | + - L2: Medium-performance storage (SATA SSD). |
| 34 | + - L3: Low-performance storage (eMMC, SATA HDD, or unknown). |
| 35 | +
|
| 36 | + Thread count ranges per storage tier (scaled by CPU count): |
| 37 | +
|
| 38 | + - L1 (NVMe SSD): 24 - 32 threads |
| 39 | + - L2 (SATA SSD): 16 - 24 threads |
| 40 | + - L3 (eMMC/HDD): 10 - 16 threads |
35 | 41 | """ |
36 | 42 |
|
37 | 43 | L1 = "L1" |
38 | 44 | L2 = "L2" |
39 | 45 | L3 = "L3" |
40 | 46 |
|
41 | 47 | def map_device_rank_to_download_threads(self) -> int: |
42 | | - """Calculate download thread count based on this storage tier and CPU count. |
43 | | -
|
44 | | - Thread count ranges per storage tier (scaled by CPU count): |
45 | | - L1 (NVMe SSD): 24 - 32 threads |
46 | | - L2 (SATA SSD): 16 - 24 threads |
47 | | - L3 (eMMC/HDD): 8 - 12 threads |
48 | | - """ |
| 48 | + """Calculate download thread count based on this storage tier and CPU count.""" |
49 | 49 | cpu_count = os.cpu_count() or 4 |
50 | 50 |
|
51 | 51 | if self == StorageDeviceType.L1: |
52 | 52 | threads = min(32, max(24, cpu_count * 4)) |
53 | 53 | elif self == StorageDeviceType.L2: |
54 | 54 | threads = min(24, max(16, cpu_count * 3)) |
55 | 55 | else: # L3 |
56 | | - threads = min(12, max(8, cpu_count * 2)) |
| 56 | + threads = min(16, max(10, cpu_count * 2)) |
57 | 57 |
|
58 | 58 | logger.info( |
59 | 59 | f"download threads calculated: {threads} " |
|
0 commit comments