Difference between revisions of "Maximising Performance"

From WHMCS Documentation

Line 1: Line 1:
If you grow to have a large client base, page loads may begin to slow down. This is 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:
+
If you grow to have a large client base, page loads may become slower. This is because the more data you have, the larger the database becomes, and so calculating and looping through the data will naturally take longer.  
 +
 
 +
The following steps can help you maintain faster speeds:
  
 
==Software Related==
 
==Software Related==
  
*'''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. To avoid that, disable the ticket counts by adding the following line to your WHMCS <tt>configuration.php</tt> file:<div class="source-cli">$disable_admin_ticket_page_counts = true;</div>
+
=== Disable Ticket Counts ===
*'''Logging''' — In WHMCS, you can enable logging for, for example, SQL errors, hooks loading, or module commands. You can find these under '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings > Other''' as ''SQL Error Reporting'' or ''Hooks Debug'', or under '''System Settings (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Logs > Module Debug Log''' ('''Utilities > Logs > Module Debug Log''' in WHMCS 7.x and earlier). Make sure to disable these for debugging errors that may occur, since they can and will increase the database size exponentially.
+
 
*'''Hooks/Addons''' — Third party customizations can slow the performance of WHMCS.  Ensure that any customization that you are using is up-to-date and works with the version of WHMCS you are running.
+
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.  
*'''Database Backups''' — The database backup process can be CPU, memory and disk intensive - whilst the entire database is exported, compressed and uploaded/emailed. If performance issues are observed at the same time every day during the database backup process, this could be a potential cause. Refer to the [[Backups#Limitations|Backups documentation]] for more information.
+
 
 +
To avoid that, disable the ticket counts by adding the following line to your WHMCS <tt>configuration.php</tt> file:
 +
 
 +
<div class="source-cli">
 +
$disable_admin_ticket_page_counts = true;
 +
</div>
 +
 
 +
=== Logging ===
 +
 
 +
In WHMCS, you can enable logging for, for example, SQL errors, hooks loading, or module commands.  
 +
 
 +
The following settings control debug logging:
 +
 
 +
* '''SQL Error Reporting''' in the '''[[Other Tab|Other]]''' tab at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings''' or, prior to WHMCS 8.0, '''Setup > General Settings'''.
 +
* '''Hooks Debug''' in the '''[[Other Tab|Other]]''' tab at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings''' or, prior to WHMCS 8.0, '''Setup > General Settings'''.
 +
* '''Module Debug Log''' at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > [[System Logs]]''' or, prior to WHMCS 8.0, '''Utilities > Logs > Module Debug Log'''.
 +
 
 +
Make sure to disable these when you are not actively debugging an issue, since they can and will increase the database size exponentially.
 +
 
 +
=== Customizations ===
 +
 
 +
Third party customizations can slow the performance of WHMCS.  Ensure that any customization (for example, hooks and addons) that you are using is up-to-date and works with the version of WHMCS you are running.
 +
 
 +
=== Database Backups ===
 +
 
 +
The database backup process can be CPU, memory, and disk intensive while the entire database is exported, compressed, and uploaded or emailed. If performance issues are observed at the same time every day during the database backup process, this could be a potential cause.  
 +
 
 +
For more information, see [[Backups#Limitations|Backups]].
  
 
==Server Related==
 
==Server Related==
  
*'''Email Provider''' — Long loading times when performing an action which involves the sending of an email (placing an order, opening or replying to a support ticket, publishing an invoice etc.) are often caused by connection issues to the chosen email provider. To diagnose and resolve please refer to [https://help.whmcs.com/m/troubleshooting/l/1261469-troubleshooting-email-sending-problems Troubleshooting Email Problems].
+
=== Email Provider ===
*'''MySQL Tweaks''' — WHMCS performance is largely dependent on a correct MySQL® configuration, especially for larger databases. Make any changes to the server's <tt>my.cnf</ttt> file under the <tt>mysqld</tt> section, usually in <tt>/etc/my.cnf</tt> (cPanel servers and most others). As a starting point, they may want to set <tt>max_connections</tt> to a low value like <tt>50</tt> and increase based on their available RAM. When you are done configuring this and the following other important settings, restart MySQL and let it run for 48 hours:
+
 
 +
Long loading times when performing an action involving sending an email (for example, placing an order, opening or replying to a support ticket, or publishing an invoice) are often caused by connection issues to the chosen email provider.  
 +
 
 +
To diagnose and resolve this, see [https://help.whmcs.com/m/troubleshooting/l/1261469-troubleshooting-email-sending-problems Troubleshooting Email Problems].
 +
 
 +
=== MySQL® ===
 +
 
 +
WHMCS performance is largely dependent on a correct MySQL® configuration, especially for larger databases. Make any changes to the server's <tt>my.cnf</ttt> file under the <tt>mysqld</tt> section, usually in <tt>/etc/my.cnf</tt> (cPanel servers and most others).  
 +
 
 +
* As a starting point, set <tt>max_connections</tt> to a low value like <tt>50</tt> and increase based on the available RAM.  
 +
* When you are configuring this and the following other important settings, restart MySQL and let it run for 48 hours:
 
** <tt>wait_timeout</tt> (at least 300, so MySQL doesn't drop connections too soon)
 
** <tt>wait_timeout</tt> (at least 300, so MySQL doesn't drop connections too soon)
 
** <tt>sort_buffer_size</tt> (2–4 MB)
 
** <tt>sort_buffer_size</tt> (2–4 MB)
Line 17: Line 56:
 
** <tt>max_allowed_packet</tt> (16 MB)
 
** <tt>max_allowed_packet</tt> (16 MB)
  
*'''System Tweaks''' — WHMCS is a PHP MySQL script, and so the more RAM or SWAP memory and raw processing power you have at your disposal, the better the performance from your installation.  For more information, see our [[System Requirements]]. We recommend using the higher set values and modules under the '''Recommended Settings''' for best results.
+
=== System Tweaks ===
 +
 
 +
WHMCS is a PHP MySQL script, and so the more RAM or SWAP memory and raw processing power you have at your disposal, the better the performance from your installation.   
 +
 
 +
* For more information, see [[System Requirements]].  
 +
* We recommend using the higher set values and modules under the '''Recommended Settings''' for best results.

Revision as of 18:13, 26 April 2022

If you grow to have a large client base, page loads may become slower. This is because the more data you have, the larger the database becomes, and so calculating and looping through the data will naturally take longer.

The following steps can help you maintain faster speeds:

Software Related

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.

To avoid that, disable the ticket counts by adding the following line to your WHMCS configuration.php file:

$disable_admin_ticket_page_counts = true;

Logging

In WHMCS, you can enable logging for, for example, SQL errors, hooks loading, or module commands.

The following settings control debug logging:

  • SQL Error Reporting in the Other tab at Configuration () > System Settings > General Settings or, prior to WHMCS 8.0, Setup > General Settings.
  • Hooks Debug in the Other tab at Configuration () > System Settings > General Settings or, prior to WHMCS 8.0, Setup > General Settings.
  • Module Debug Log at Configuration () > System Logs or, prior to WHMCS 8.0, Utilities > Logs > Module Debug Log.

Make sure to disable these when you are not actively debugging an issue, since they can and will increase the database size exponentially.

Customizations

Third party customizations can slow the performance of WHMCS. Ensure that any customization (for example, hooks and addons) that you are using is up-to-date and works with the version of WHMCS you are running.

Database Backups

The database backup process can be CPU, memory, and disk intensive while the entire database is exported, compressed, and uploaded or emailed. If performance issues are observed at the same time every day during the database backup process, this could be a potential cause.

For more information, see Backups.

Server Related

Email Provider

Long loading times when performing an action involving sending an email (for example, placing an order, opening or replying to a support ticket, or publishing an invoice) are often caused by connection issues to the chosen email provider.

To diagnose and resolve this, see Troubleshooting Email Problems.

MySQL®

WHMCS performance is largely dependent on a correct MySQL® configuration, especially for larger databases. Make any changes to the server's my.cnf</ttt> file under the <tt>mysqld section, usually in /etc/my.cnf (cPanel servers and most others).

  • As a starting point, set max_connections to a low value like 50 and increase based on the available RAM.
  • When you are configuring this and the following other important settings, restart MySQL and let it run for 48 hours:
    • wait_timeout (at least 300, so MySQL doesn't drop connections too soon)
    • sort_buffer_size (2–4 MB)
    • read_buffer_size (2–4 MB)
    • max_allowed_packet (16 MB)

System Tweaks

WHMCS is a PHP MySQL script, and so the more RAM or SWAP memory and raw processing power you have at your disposal, the better the performance from your installation.

  • For more information, see System Requirements.
  • We recommend using the higher set values and modules under the Recommended Settings for best results.