Forum Moderators: open
With some recent outages due to high load, I am considering upgrading the hardware (along with software optimisation). I am stuck between the options of having a new single more powerful box or to split the database server and webserver. If I go for the latter I am considering using the current box as database server and getting a new cheap webserver.
My current box is Dual AMD Opteron 244 with 4 GB RAM and SCSI drives in RAID 0.
Any advice would be much appreciated.
Have you done any tuning of the O/S, Apache and MySQL? (assumed this is what you have)
Out of the box those apps are not efficient. You may need to adjust parameters for best effect.
There are many simple things you can do such as turning off atime for the disks. This is often on by default and is a damn crazy thing to have.
Have a secondary disk in there for all your temp and log files. If a database is reading from the same disk that it creates temp files and / or apache is writing log files this is another crazy situation.
Assuming PHP where are your session files stored? The disk? Again - crazy! Set the sessions to use /dev/shm.
Presumably you have looked at your indexes and caching of MySQL?
So much could be done via tuning before the need to upgrade. I'm not saying you don't need to upgrade just that you need to ensure your server is set up efficiently first.
Can you be sure if the hardware box is dropping out or is it the network?
I am with a very reliable host with well connected datacenter, so network should not be a problem.
Have you done any tuning of the O/S, Apache and MySQL?
I am running php as an apache module with MMcache and zend optimiser. I might replace MMCache with eaccelerator as MMcache is no longer supported, though I am not sure whether it would give me any extra speed advantages. I am also using second level cache system for the html output. Most of the dynamic pages in my website are served from this html cache. Without it the site would just freeze under the load.
There are many simple things you can do such as turning off atime for the disks. This is often on by default and is a damn crazy thing to have.
Thanks for the suggestion. I am quite naive in hardware issues. This is the first time I am hearing about this. Perhaps I should ask my host about it.
Have a secondary disk in there for all your temp and log files. If a database is reading from the same disk that it creates temp files and / or apache is writing log files this is another crazy situation.Assuming PHP where are your session files stored? The disk? Again - crazy! Set the sessions to use /dev/shm.
Interesting suggestions. I don't think I am doing this. May be this is something I should be looking into straight away.
Presumably you have looked at your indexes and caching of MySQL?
Thats the first thing I did as my CMS generates a lot of select queries and it did result in a noticeable improvement in server load.
e.g.
/secondary/var/log/syslog
/secondary/var/log/secure
/secondary/var/log/messages
/secondary/var/log/httpd/access_log
/secondary/var/log/httpd/error_log
create /secondary/temp and /secondary/tmp directories
in your my.cnf file set mysql to use the /secondary/tmp dir Note that you may have to ensure the dirs have the correct rights else mysql will stop.
eaccelerator is fine but again don't let it create it's caches on disk - use shm. In php.ini set
eaccelerator.shm_only="1"
Google for articles such as
optimizing linux
In particular you want to make sure your file system is not slowing you down doing things like recording atime. Previously it was advantageous to check the results of hdparm to see if your disk could be tuned but with more modern disks, motherboards and recent O/S's this has already been done.
optimizing php, apache, mysql etc.
Most of these will be concerned with memory. The tendancy is to to give MySQL all the memory but that then reduces the amount of memory Linux has for caching which can cause too much swapping.
Install MySysop available from forge.mysql.com This is a great app which shows your main variable and suggests how they should be tweaked.
I'm pretty sure you will see performance gains just by adding the ancillary disk and by these simple tweaks. You still may need to upgrade in the future but at least you will know that your hardware is working more efficiently for you.
[edited by: Frank_Rizzo at 10:49 am (utc) on Dec. 18, 2006]
Highly tuned, mysql optimised loads (this makes the most difference in my opinion).
Ben