Complete
Details
Details
Assignee
Caleb
CalebReporter
Bug Clerk
Bug ClerkLabels
Time remaining
0m
Components
Fix versions
Priority
Katalon Platform
Katalon Platform
Created May 26, 2022 at 1:37 PM
Updated June 16, 2022 at 3:45 PM
Resolved May 31, 2022 at 2:16 PM
PR: https://github.com/truenas/middleware/pull/9033
This optimizes retrieving disk information on SCALE. On a system with 439 disks, `device.get_disks` was taking `0.867` seconds. After my changes it takes `0.439` seconds which is ~66% decrease in time it takes to get disk information.
My changes do roughly the following:
1. remove a call to `lsblk -OJdb` when querying disks. `lsblk` gets the same disk information that `pyudev` gets
2. There was a `self.logger` crash in `get_disks()` method
3. Stop doing `self.disk_default.copy()` for each disk. Every little thing adds up when we're dealing with a system with many hundreds (or more) disks.
4. Remove the extra `subprocess` calls to `sg_vpd`. If udev doesn't have the information, `sg_vpd` isn't going to get it either since the kernel asks the disks for the same information using the same requests....
5. we had overly complicated logic to calculate the `number` key which isn't necessary when we can get a unique number from udev (device_number)