Maximising Performance

From WHMCS Documentation

If you grow to have a large client base then you might start to find page loads begin to slow down. This is to be expected, because the more data you have, the larger the database becomes, and so calculating and looping through the data will naturally take longer. However there are some things you can do to help keep things fast...

Software Related

1. Disable Sidebar Stats - The sidebar stats in WHMCS are calculated on every page load. Normally this is no problem but when you get big, it can start to take longer. So to avoid that, simply disable the "Sidebar Statistics" admin role group permission in Setup > Administrator Roles for any roles you use and then the stats won't be loaded. And all the stats can still be obtained via the actual reports section anyway when you need them.

2. Disable Ticket Counts - When you have a lot of tickets, calculating the number of tickets per status to display each time you open a ticket can slow things down. So to avoid that you can disable the ticket counts by adding the following line to your WHMCS configuration.php file:

$disable_admin_ticket_page_counts = true;

3. Logging - In WHMCS, there are quite a few things you can enable that will log things such as SQL errors, Hooks loading, Module commands, etc. You can find these under Setup >> General Settings >> Other Tab :: SQL Error Reporting | Hooks Debug, Utilities > Logs > Module Debug Log. Ensure that these are disabled when not needed for debugging errors that may occur as they can/will increase the database size exponentially.

4. Hooks/Addons - Third party customizations, while a great addition to functionality, can at times slow performance of WHMCS. Ensure that any customization that you are using is up to date and functionality wise, works with the version of WHMCS you are running.

Server Related

1. MySQL Tweaks - When it comes to performance, a lot of WHMCS performance is dependent upon MySQL being set up properly. Especially on larger databases. All changes need to be made to the server's my.cnf file under the mysqld section, usually in /etc/my.cnf (cPanel serves and most others). As a starting point, they may want to set max_connections to a low value like 50 and increase based on their available RAM. Other important setting are:

  • wait_timeout (at least 300, so MySQL doesn't drop connections too soon)
  • sort_buffer (2-4M seems to be good)
  • read_buffer (2-4M seems to be good)
  • max_allowed_packet (16M is usually fine).
In the above values for MySQL, M means megabytes

Once this has been done, restart MySQL and let it run for at least 48 hours. Then you can look into something like MySQLTuner to do an automatic check and see if it makes any suggestions on improvements:

As always with MySQL, the above are just general starting guidelines. Ultimately, the best possible performance will require a thorough review and optimization by a qualified database administrator, but this should at least be a good start.

MySQL Tuning

2. System Tweaks - As WHMCS is a PHP/MySQL script, by nature the more RAM/SWAP and raw Processing power you have at your disposal will also help with better performance from your installation. We have our System Requirements set here and do recommend using the higher set values and modules under the Recommended Settings for best results.