Performance Tuning ERPNext - jigneshpshah/greycube_helpmanual GitHub Wiki

To boost Speed

install cloudflare wrap app : https://one.one.one.one/

OR

change your DNS to 8.8.8.8 (from Google)

To increase HTTP timeout , to solve Request Timeout Error

Update bench config

bench config http_timeout <integer>

bench setup supervisor

bench setup nginx

Restart services (as root)

sudo supervisorctl reload

sudo service nginx reload


Gunicorn Workers

ERPNext uses Gunicorn HTTP server in production mode.

For optimal performance the number of Gunicorn workers needs to be set according to the number of CPU cores your serve has.

Recommended number is 2 * num_cores + 1.

It is specified in common_site_config.json file in frappe-bench/sites folder.

after changing gunicorn workers, you need to run:

bench setup supervisor

sudo supervisorctl reread

sudo supervisorctl update

Note : If you have installed ERPNext using easy install script, then the script will have set the appropriate number of workers already. If you have installed ERPNext manually, then you need to set it. Default value is 1. Also if you resize your VPS, you need to adjust the number of workers accordingly.


MariaDB settings

innodb_buffer_pool_size

The biggest impact is of innodb_buffer_pool_size

Check the value by running select variables like "innodb_buffer%" Default 256M is very low. Expert opinion is that it should be 70-80% of total memory

Check for mysql settings at etc/mysql/my.cnf

Change the value of the innodb_buffer_pool_size

To check the minimum required innodb_buffer_pool_size


SELECT CONCAT(CEILING(RIBPS/POWER(1024,pw)),SUBSTR(' KMGT',pw+1,1))
Recommended_InnoDB_Buffer_Pool_Size FROM
(
    SELECT RIBPS,FLOOR(LOG(RIBPS)/LOG(1024)) pw
    FROM
    (
        SELECT SUM(data_length+index_length)*1.1*growth RIBPS
        FROM information_schema.tables AAA,
        (SELECT 1.25 growth) BBB
        WHERE ENGINE='InnoDB'
    ) AA
) A;

Useful Links

  1. To check the I/O of the server : https://discuss.erpnext.com/t/maintenance-for-erpnext-performance/50412/15

wget -qO- bench.sh | bash

  1. To know server network/internet connectivity with google

https://stackoverflow.com/questions/18215389/how-do-i-measure-request-and-response-times-at-once-using-curl

a. Create a new file, curl-format.txt, and paste in:


    time_namelookup:  %{time_namelookup}s\n
       time_connect:  %{time_connect}s\n
    time_appconnect:  %{time_appconnect}s\n
   time_pretransfer:  %{time_pretransfer}s\n
      time_redirect:  %{time_redirect}s\n
 time_starttransfer:  %{time_starttransfer}s\n
                    ----------\n
         time_total:  %{time_total}s\n


b. curl -w “@curl-format.txt” -o /dev/null -s “http://google.com/

To increase speed put your IP in ignore ip list in fail2ban

path

sudo nano /etc/fail2ban/jail.conf

ex ignoreip = 127.0.0.1/8 46.152.155.81

sudo systemctl restart fail2ban.service

https://laymanclass.com/how-to-use-fail2ban-on-ubuntu-18-04/

sudo /etc/init.d/fail2ban stop

systemctl stop fail2ban sudo systemctl status -l fail2ban

⚠️ **GitHub.com Fallback** ⚠️