1

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.

Good Person
  • 359
  • 6
  • 18
  • 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
  • oh woops - I mistyped my comment. I use a hostname to connect to the web server and I use _localhost_ in all the config files to connect to the database. The MySQL server and Apache are on the name box. – Good Person May 30 '10 at 18:17
  • how responsive is mysql when you use commandline tool mysql? – pQd May 30 '10 at 19:15
  • @pQd: reasonable but not fast. – Good Person May 30 '10 at 21:06
  • maybe you should check mysql settings. Coz it should be fast on terminal. try a wildcard search with count() in mysql. & also can you check apache via a php info file. and paste apache loaded modules here ? – risyasin May 30 '10 at 21:21
  • The server was moved to a different cluster since my question. The speed has gotten marginally more tolerable and the mysql cli is now reporting times of .1 seconds or less. – Good Person May 31 '10 at 07:33
  • @yasin inat: I pasted the loaded modules and some other data as well – Good Person Jun 01 '10 at 11:05
  • Do you need all those apache modules ? if not. you can remove some from apache, to improve the performance. – risyasin Jun 01 '10 at 13:13
  • @yasin inat: I removed some more modules. Are there any modules there that I probably don't need? – Good Person Jun 02 '10 at 07:32

1 Answers1

2

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.

Alister Bulman
  • 1,624
  • 13
  • 13