How to tweak the server to speed up the website

How to tweak the server to speed up the website

 

Are you experiencing slow site loading and slowness? You can tweak the server speed by enabling some settings on server like MySQL query cache. Let’s discuss about some of the settings, which will increase the server performance.

 

Enable MySQL Query Caching

We know, caching is used to improve our website performance. For MySQL, there is a general query cache which can help tremendously. The MySQL is one of the important feature in MySQL and an inevitable part of query optimization. After the caching, results will be set in a memory cache like memcached or cassandra.

1) You can enable MySQL Query cache by editing my.cnf file.

Before making any changes on configuration file you need to take a backup of the my.cnf file.

$ cp /etc/my.cnf /etc/my.cnf.old

2) Open my.cnf file using your favorite text editor. Here I am using ‘vi’ text editor.

$ vi /etc/my.cnf

3) Then add the following contents to the file.

[mysqld]

default-storage-engine=MYISAM

local-infile=0

innodb_file_per_table=1

max_allowed_packet=64M

query_cache_limit=4M

query_cache_size=128M

query_cache_type=1

innodb_flush_log_at_trx_commit=2

innodb_lock_wait_timeout=200

max_connections=500

max_user_connections=45

open_files_limit = 100000

4) Restart the MySQL service.

$ service restart mysql

For more details please visit our tutorial >>  https://www.interserver.net/tips/kb/mysql-query-caching/

 

Enable OPcache

The OPcache is a PHP extension. This extension is a good solution to the performance issues of your website. OPcache improves the PHP performance by storing compiled script byte code in shared memory. Thus, it removes the need for PHP to load and parse scripts on each request. This feature affects the performance positively. It brings the loading time of the website down by increasing the processing speed of the request by the webserver. To an extent, OPcache also helps to avoid load on the server. The OPcache is bundled with PHP from the PHP 5.5.0 and later. OPcache is also available in PECL. In short, the caching engine that comes with the PHP 5.5 is called the Opcache. Please follow the below steps to know how to enable opcache from your cPanel interface.

1) Login to cPanel account.

2) Go to the option ‘Select PHP Version’ under the section ‘Software’. A page of PHP Selector | extensions will be opened.

3) Look for the ‘Current PHP version’. If it is native, please change it to some other version. You could keep the version same without the native option.

4) Check the checkbox near to the ‘opcache’.

5) Click on the button ‘Save’.

6) You have successfully installed the OPcache extension now.

For more details please visit our documentation: https://www.interserver.net/tips/kb/enable-opcache-cpanel/

 

PHP-fpm

PHP-fpm stands for PHP-Fast CGI Process Manager. Which is useful for websites of any size. Following are the steps to enable php-fpm.

1) Login to WHM

2) Select the icon ‘Software’ from the panel.

How to tweak the server to speed up the website

 

3) On the next page click on the icon ‘MultiPHP Manager’.

How to tweak the server to speed up the website

 

4) Select the domain you want to activate PHP-FPM and select the option ’On’ from the dropdown box in the PHP-FPM filed.

How to tweak the server to speed up the website

 

5) Finally click on the ‘Apply’ button.

 

If you need any further help please do reach our support department.

 

 

Leave a Reply