Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a small website with a Joomla and a Moodle set up. It seems that both of these are very slow. The server (CentOS release 5.5 (Final)) is a virtual dedicated server with about 2GB of ram. I don't expect to ever get more than 10-15 people on at the same time (and if that is high)

What settings could I change in either apache, mysql, or even the OS to increase the performance of my site?

I'm not concerned about running out of resources if I get too many visitors.

If you need more specific data leave a comment and I'll edit the question.

Database speed:

+--------------------+----------------------+------------------+
| Data Base Name     | Data Base Size in MB | Free Space in MB |
+--------------------+----------------------+------------------+
| information_schema |           0.00390625 |       0.00000000 | 
| joomla             |           0.33125496 |       0.07981014 | 
| moodle             |           7.73092937 |       0.01922131 | 
| mysql              |           0.52505302 |       0.00000000 | 
| phpmyadmin         |           0.01499939 |       0.00106049 | 
+--------------------+----------------------+------------------+
5 rows in set (0.07 sec)

Apache loaded modules:

core prefork http_core mod_so mod_auth_basic mod_auth_digest mod_authn_file mod_authn_alias mod_authn_anon mod_authn_default mod_authz_host mod_authz_user mod_authz_owner mod_authz_default mod_include mod_log_config mod_env mod_ext_filter mod_mime_magic mod_expires mod_deflate mod_headers mod_setenvif mod_mime mod_status mod_autoindex mod_info mod_negotiation mod_dir mod_alias mod_rewrite mod_cache mod_suexec mod_disk_cache mod_file_cache mod_cgi mod_version mod_php5 mod_ssl 

$ cat /etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
#don't use old password format
old_passwords=0

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
symbolic-links=0

#Alwaysuse the better InnoDB
default-storage-engine=InnoDB
innodb_buffer_pool_size=512

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

I'm looking for specific settings to change that will increase the speed of the server.

share|improve this question
    
how slow is slow? can you measure [ eg by using wget couple times ] how long does it take to server dynamically generated page, static item [ eg small image ]? run it locally and then over the net [via uncongested network connection] .maybe it's something as simple as reverse dns attempts done by mysql/apache2. –  pQd May 30 '10 at 17:07
    
@pQd: to load the home page of Joomla takes about 30-45 seconds. A static resource takes very little time which leads me to beleave that it is a SQL query or SQL Server issue –  Good Person May 30 '10 at 17:15
    
@Good Person - what's the size of your database? do you use in joomla hostname or ip address to connect to mysql? how fast is mysql when using local commandline tools? –  pQd May 30 '10 at 17:28
    
@pQd: I use a hostname to connect to the database. I just tested with phpMyAdmin and it seems to also be very slow. I'm adding the size of the DB to the question now. –  Good Person May 30 '10 at 17:51
    
the db is remote to your web server, or is it on localhost, but you connect via the hostname of your local server? you could try specifying localhost, if local, to avoid querying over a device other than loopback. if remote, try specifying the remote host's ip, instead of hostname to avoid potentially long ns queries. if that resolves the delay, you may wamt to investigate the server's nameserver configuration. –  cpbills May 30 '10 at 18:13
show 8 more comments

1 Answer

up vote 2 down vote accepted

Mysql always like RAM. Converting (at least most) of the tables (in joomla & moodle, not the others) to InnoDb format and increasing the memory that uses will help a great deal with the speed as well. innodb_buffer_pool_size is the mysql config. The default size that uses is just 8MB - if your database is really that small (and I'd frankly be a tad surprised at that little if it was actually being used at all), then giving it even 16MB would make a difference, and more likely I'd just give it 512MB for the innodb_buffer_pool_size anyway. With all the database contents in memory, it takes the disk almost out of the equation.

Installing Xdebug will allow you to find out which parts of the site are slow, function by function, line by line. Webgrind will parse the output of Xdebug to show you.

To find out more than that, you will need to collect some stats as to what the server is doing - something like running collcted ,and then viewing the graphs that are being produced. Even just looking at the output of 'top', running on the command line can help a lot to see what is going on.

share|improve this answer
    
I converted all the tables to InnoDB and made it the default for all future tables. –  Good Person May 31 '10 at 16:52
    
It looks like adding inndb_buffer_pool_size helped a lot. Are there any other settings to change in mysql or apache? –  Good Person Jun 1 '10 at 11:00
    
The innodb stuff massively increased the speed - thanks very much. –  Good Person Jun 2 '10 at 7:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.