这是在网上找的一个关于如何评估一个mysql服务器的硬件需求的文章,转载以备用
5 Minute DBA – Database Server Hardware Selection
So you need to purchase a new database server, and you really don’t know where to start..
Because their maybe different recommendations for different OS’s I am going to stick with Linux with these recommendations. I want to say right off the bat here… choosing the right hardware should probably not be a five minute task. I think you really need to spend time reviewing your application, it’s access patterns, the io capacity, etc. You just can’t do this in five minutes generally. But if your under the gun and asked me to spec something out today… here are some general guidelines.
As of March 10th 2009 here is what I would recommend ( This are going to change every few months potentially with new versions of MySQL & new hardware:
CPU:
Currently the scalability of Innodb beyond 8 cores is limited, in fact with the current ( unpatched ) releases you may see a performance regression with more then 8 cores. We wrote about this before. If you have the money go with the fastest CPU’s available. Avoid servers with lots of cores and a lower speeds.
Memory:
The more memory generally the better. Here I would shoot for an amount of memory that will allow 100% of your hot data to be in memory. If you do not know how much data is going to be hot, a good guess in my experience is 10-20% of the total database size , but that’s going to vary from application to application. If you can’t figure out the total host data, more is better or a 20% rule of thumb is better then nothing. Minimally plan for 2-4GB of memory to be allocated to the OS. Typically I want at least 4GB of memory for the OS, and if I have a really active database I want more ( 8GB+ ). When I say 4GB for the OS, this will also be used for the MySQL Per thread buffers/thread stack, etc. So if you have a 24GB Database and all 24GB is hot or going to be used frequently I may put in 32GB of memory in my system and allocate 24GB to innodb and reserve the other 8GB for the OS and other items.
Disk:
Disk is going to be a toughy in 5 minutes. You really have two concerns here, Disk capacity & IO Capacity (think io’s per second). Disk capacity is generally pretty easy, I need XGB of disk space… most people can estimate this no problems. Keep in mind with RAID you will lose some raw disk capacity ( I.e. 4 160GB drives in a RAID 10 setup will deliver ~320GB of usable space ). A 5 minute answer to IO capacity is a bit more of a challenge. One of the descisions yo will need to make if you can get by with internal disk or you need a SAN. Just the other day Peter Z wrote about when to choose a SAN… give it a read. Assuming your making a decision in 5 mintes I am going to make an assumption that your going to look for internal disk. Purchasing the correct SAN in my opinion requires a lot of thought. So Let assume you want to use internal disk. First If all of your data fits into memory, it lessons your disk requirements a bit but it will not eliminate disk IO ( your still going to read and write to disk, but your reads should be lessened ). I strongly urge that you keep the database and OS completely separate. So that’s 2 disks for the OS ( mirrored disks should be fine ). For the database I typically recommend RAID10 for the data ( RAID 5 maybe OK for database with fewer writes, I.e. data warehouses ) which means a minimum of 4 disks for your database. So thats 6 disks to start with. You can then scale up from there as you need more, without more analysis your going to be guessing here. In terms of the type of drives, SAS or SCSI in either 10K or 15K speeds are pretty standard. I would avoid SATA drives that are <10K rpm. Of course this can all change, because it really depends on your needs and requirements… as I said tough!
Disk Controller:
Cache on your disk controller is important and the more the better in most cases. Make sure your controller has a battery backup, otherwise its really useless.
Network Cards:
Purchase at least two network cards for your system, both full 1GBE. Typically I would bond these two nics together to give some redundancy. Also avoid dropping your new server into a 100Mb/s network as well.
A quick note on the OS… make sure you install a 64 bit OS!