mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #58153
[Bug 1864760] Re: Disk usage calculation is very slow with NFS
** Changed in: mahara
Status: New => In Progress
** Changed in: mahara
Importance: Undecided => Medium
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1864760
Title:
Disk usage calculation is very slow with NFS
Status in Mahara:
In Progress
Bug description:
https://mahara.org/interaction/forum/topic.php?id=8585&offset=0&limit=10#post34233
We experienced a very strange issue while upgrading from Mahara
18.10.3 to 19.10.1. It was stuck at cron_site_data_daily() in the
htdocs\lib\db\upgrade.php, taking forever to calculate disk usage and
failing the upgrade process after 10 minutes. It was opening the
database transaction and waiting forever for dirsize function to
finish.
if ($oldversion < 2019011500) {
log_debug('run cron_site_data_daily function to update data
with new chartjs structure');
cron_site_data_daily();
}
The cron job call the same function and it is stuck for a very long
time due to the same reasons.
We believe this is an NFS file locking issue. The data root is mounted
on an NFS volume, and it is around 500 GB. Even the Linux du utility
takes around 20 minutes to calculate the size of this NFS mount point.
We fixed this issue by swapping the dirsize function
(htdocs\lib\function.dirsize.php) with a custom function which
utilizes disk_total_space and disk_free_space.
function usqdirsize($path) {
$disktotalspace = disk_total_space($path);
$diskfreespace = disk_free_space($path);
$diskusage = $disktotalspace - $diskfreespace;
return $diskusage;
}
Question: do we need to calculate the size of a directory by iterating
its contents? If not happy to commit this patch with a bug report.
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1864760/+subscriptions
References