Version 11 (modified by AlexT, 14 years ago) (diff)

--

Hosting Server Setup Recommendations

It was noticed that many server's default setup is very inefficient. It leads to poor script performance and in some cases hosting can terminate your account due to heavy load. This document covers very basic recommendations on how to improve your site performance by slightly changing your server configuration.

This recommendations are for dedicated or VPS server owners, however if you are on shared hosting and notice that your server configuration is inefficient you can ask your hosting support to change this settings on the server, so whole server will run faster.

You need root access to the server and have some skills on how to connect to the server using SSH terminal and know some basic command line tools, like navigating through directories and editing files.

Remember, making wrong changes can bring your server down '''

Before Start

Always backup old data, so you can always return to original configuration.

Before starting optimization it is better to monitor your server performance before starting optimization and after, to see how things are changing, if it becomes better or worth. I suggest to install "Munin" server monitor, it is available as WHM plugin, you can install it from WHM panel -> cPanel -> Manage Plugins -> click "Install and Keep Updated" near Munin logo and press "Save" button at the bottom of the page. After installing link to Munin appears in "Plugins" section of WHM panel, please allow up to 10 minutes until it generates pages with graphs for you.

MySQL

First you need to check if "query_cache" is enabled on your server. It was noticed that 80% of all SELECT queries are taken from "query_cache" when it is enabled, so if it is disabled on your server - mysql performance is 5 times slower !

To check this go to phpMysqlAdmin tool (in most cases it is in your WHM panel -> SQL Services -> phpMyAdmin). Then click "Variables" tab. "query cache size" must be at lesat 16M, "query cache type" must be ON and "query cache limit" value should be around 1M. Example of good configuration:

After you realized that you need to change these settings you need to edit "my.cnf" file on your server (in most cases it in in "/etc" folder) and add the foollowing lines in "[mysqld]" section of the file, if the same configuration options already exists it is better to comment out old ones (with hash # symbol ) and add new ones near them:

[mysqld]
query_cache_limit = 1M
query_cache_size = 32M

You need to restart MySQL server to apply the changes, you can do it from WHM panel or from command line, most common command line for linux servers is:

/etc/init.s/mysql restart

This most critical configuration options. Other useful options should be enabled too - "key buffer size", "max heap table size", "tmp table size", "thread cache" are some of them. But exact values varies from server from server, for example for dedicated or VPS server with 1Gb RAM and one dolphin site, these values maybe like this:

[mysqld]

query_cache_limit = 1M
query_cache_size = 32M

key_buffer_size = 64M

max_heap_table_size = 256M
tmp_table_size = 256M

thread_cache = 128

There is already a tool in phpMyAdmin which can help you with deciding what configuration values need to be changed. Go to phpMyAdmin and open "Status" tab, look through this page and pay attention to red values. There is a comment near each value you can use as a guide in changing particular MySQL option. During changing remember that memory is always limited, so you need to increase the values adequately to your available RAM. Keep in mind that these values are collected during some time, so if you change some value it is better to wait at least 1 day until new data is collected for analysis. After MySQL restarted this data is collected from the scratch.

This is an example on how many queries becomes cached after introducing "query cache":

1 day is showed on the graph, in the beginning cache was disabled, then cache was enabled - pink zone shows SELECT queries which are taken from cache. So, benefits are obvious !

PHP

There are many setups options here, there are advantages and disadvantages between all of them. So choose most suitable for your situation. PHP is a part of webserver and it is difficult to describe PHP without webserver or related to different webservers, so Apache is considered as webserver in this section. Most common setups are described, there maybe more complex setups available.

mod_php (dso module)

PHP is working as module for webserver.

CGI/suPHP

PHP is working in CGI mode (suPHP is the same CGI with exception that php script is running under particular user).

FastCGI

PHP is working as separate server/process.

Attachments (12)

Download all attachments as: .zip

 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.
Fork me on GitHub