Intermittent Slow Performance/Timeouts of Admin Dashboard
Symptom
After updating to 8.13, the performance of the Admin Dashboard page may take longer to load than normal or may time out.
Other pages in the Admin Area load successfully when visited eg. /admin/clients.php
.
Cause
The change WHMCS-19876 — Correct credit reconciliation for refunded invoice with multiple overpayments, has introduced complexity in a database query, which has been observed to increase load times in certain systems with large transaction and invoice datasets, certain environmental configurations or resource-constrained environments.
The issue has been logged with our development team with case reference WHMCS-22447.
Hotfix
We have created a hotfix for WHMCS 8.13.1 to correct the issue. You can download it at:
https://whmcs.community/files/file/214-prevent-admin-performance-degredation/
Workaround
1. Create the following Index on the WHMCS MySQL database:
ALTER TABLE `tblinvoiceitems` ADD INDEX `idx_type_relid` (`type`, `relid`);
Adding this index improves the performance of the query with immediate effect. Continue to step 2 if the performance issue persists.
2. Edit /modules/widgets/Billing.php and add this option flag to line 20:
protected $cacheExpiry = 86400;
This will increase the cache lifetime of the Billing Widget to 1 day, meaning only the first visit to the Admin Dashboard each day would use the query. Continue to step 3 if the performance issue persists.
3. Delete the /modules/widgets/Billing.php file.
This removes the Admin Dashboard Widget performing the query which will resolve the issue. The file will be re-created when updating WHMCS in future.