![]() |
|
Benchmark: Reading Directory Size - Printable Version +- Sentora Support Forums (https://senforums.mach-hosting.com) +-- Forum: General Forums - (Non-Sentora Support) (https://senforums.mach-hosting.com/forumdisplay.php?fid=1) +--- Forum: Sentora Development (https://senforums.mach-hosting.com/forumdisplay.php?fid=54) +--- Thread: Benchmark: Reading Directory Size (/showthread.php?tid=1559) |
Benchmark: Reading Directory Size - apinto - 05-09-2015 Hello, I was having trouble with the calculation of disk space taking to long (around 5min), so I decided to check what was going on. First I checked the Daemon script and found the class it uses to get the disk space, it is located here: Code: /etc/sentora/panel/dryden/fs/filehandler.class.phpReadin the file you go to the GetDirectorySize class and you can read: PHP Code: /**Its everything ok with this, it works perfectly, however I decided to benchmark ( using microtime() ) and got the following results (I do have HUGE directories...) Code: START Calculating disk Usage for all client accounts..
Disk usage for user "zadmin" is: 177763599 (173.6 MB) in: 54.743 seconds
Disk usage for user "user2" is: 135473500 (132.3 MB) in: 72.311 seconds
Disk usage for user "user3" is: 393436099 (384.2 MB) in: 90.218 seconds
END Calculating disk usage in: 217.274 seconds that would explain the 5 min wait time for each daemon to run.I decided to make a quick change, as Sentora is supporting Linux only (officially), why not use the du command? So I created a new class: PHP Code: static function GetDirectorySizeDU($directory) {Probably can be improved, however I did not spent too much time looking into it, but, lets see the results: Code: START Calculating disk Usage for all client accounts..
Disk usage for user "zadmin" is: 185160975 (180.8 MB) in:12.438 seconds
Disk usage for user "user2" is: 142506332 (139.2 MB) in:11.265 seconds
Disk usage for user "user3" is: 404528067 (395 MB) in:15.667 seconds
END Calculating disk usage in:39.372 secondsWOW!! From 217 seconds to 39 seconds!! This is a 456% better perfomance!! Any thoughts one why this might not work? I mean, this is just great
RE: Benchmark: Reading Directory Size - Me.B - 05-09-2015 That might be better for sure... @[5050] We may for sure think about it once we do some clean up in panel structure as we will try to channel some key changes. M B |