Posted by xqi on April 21, 2010 at 6:07pm
I have a 1.5G database which includes cache tables. about 40k users and 40k nodes.
Right now I am hosting it with a 1.5G RAM VPS and I feel it is too slow. So I am planning to upgrade it to a dedicated serer.
Here are two choice of my server:
- Intel Pentium G6950 (Dual Core), 2xSATA Drive (no RAID), 8G RAM
- Intel Xeon X3210 (Quad Core), 2XSATA drive (no RAID), 4G RAM.
They are roughly the same price. (150$)
I know the best way to do this is to benchmark the two servers, but I can't do that, can only pick one. Could anyone of you tell me which one is better for higher MySQL performance, based on your experience? or which one will you pick if you have to pick one? Thanks
this is my current's server vmstat's output
root@server:~ # vmstat -a
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ r b swpd free inact active si so bi bo in cs us sy id wa st 1 0 7704 244240 458168 698128 0 0 3 148 3 4 6 5 87 2 0
Comments
MySQL does not scale
MySQL does not scale processor-wise; current versions are (IIRC) single threaded.
A dual-core processor would be plenty; MySQL could hog one core whilst the rest of the OS runs on the other.
MySQL loves RAM. The more you can give it, the happier it will be.
I would go with the Intel Pentium G6950 (Dual Core) and 8G RAM.
and I would software-RAID 1 (mirror) the two SATA HDDs as I wouldn't want to loose that data!
Find your bottleneck first
I would suggest to find out what exactly slows you down. It may be not a database or memory problem at all.
Install xdebug with KCachegrind and profile your slow pages.
Dedicated server selection also depends on what you will be running on it.
I would go with more cores if you want to run both web server and mysql server on the same box + you can always add more ram.
But again - find your bottleneck first before upgrading.
here is my iostat output
here is my iostat output
root@server:~ # iostat -m Linux 2.6.28.3-linode17 (mail.viscosolutions.com) 04/21/2010 avg-cpu: %user %nice %system %iowait %steal %idle 5.95 0.00 4.66 2.17 0.03 87.18 Device: tps MB_read/s MB_wrtn/s MB_read MB_wrtn xvda 66.78 0.02 1.06 33821 1671072 xvdb 0.01 0.00 0.00 89 141it has been a lot of writing to disk operation. i think it is mysql tmp table related. my site isn't a very high traffic site, but i always suspect the VPS's disk IO is pretty bad.
btw, it seems the disk has much more write than read, is this normal for drupal site?
Measure
Use iostat -dx 5 to get extended statistics.
Then you can calculate number of concurrent requests the device is serving:
concurrency = (r/s + w/s) * (svctm/1000)
CPU bound machine shows high number in vmstat 5 us column + big CPU queue (r column)
Note also that vmstat and iostat displays averages since server was booted in the first row, so you need to wait to see actual data which will be displayed every 5 seconds in our case.
I/O bound machine usually spend a lot of time waiting for I/O requests to complete. In this case expect many processes in uninterpretable sleep (vmstat b column)
Usually you also want your si and so (swap activity) columns in vmstat to be 0 most of the time.
Analyze your data carefully to get an idea of what your system currently doing.
how does this look to
how does this look to you?
Active Data Set
There is a number of things you can do to speed up the website, many (if not all) of them were discussed in this group.
If your traffic mostly anonymous users, then you may want to check Boost module, or look into Revers Proxy like Squid or Varnish
For authenticated users you may want to use Memcached
Your output looks good to me
Your output looks good to me for that sampling period. Looks like your OS successfully merge requests and group them for writing.
Are you running just MySQL on this server?
Could you also paste vmstat 5 output?
What makes you think there is something wrong with your I/O?
my server is Xen VPS and
my server is Xen VPS and known as bad IO.
each time I cleared my cache, all the http requests will be queued. once the server is running out memory, it is dead. so normally whenever i clear the cache, I have to shutdown apache first, then manually run php index.php, wait for 10-15 seconds until the output begins, finally restart the apache, which was really a pain.
see my vmstat
I'd highly recommend
I'd highly recommend @gansbrest's original post of finding the cause of your problems first:
If you don't know what the problem is then it's highly probable that bigger hardware won't make an ounce of difference.
--
Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his
Oh and run a MySQL tuning
Oh and run a MySQL tuning script like mysqltunner2.
https://launchpad.net/mysqltuner
But don't implement any of the suggestions until you know what each of the parameters does and if it will really fix your problem.
--
Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his
Are you running both web
Are you running both web server and mysql on the same box?
It sounds to me that you might have a high value MaxClients in your Apache configuration file, so when you clear cache for example, you got requests queued up (for example if your website pages have too many database requests or external requestst, which is not uncommon in Drupal world) waiting for a data from your database, and new Apache processes will be forking at higher rate.. Eventually it will eat all your RAM and crash the server since PHP scirpts can be demanding, and each process can eat 50 - 100 Mb of memory..
To calculate appropriate to your system number of MaxClients you should take into consideration OS memory and DB memory + leave some RAM just in case.
plus keep in mind that when Apache completes request it return most of it memory to OS, but not all of it and next time when request is coming for a static file (CSS or image) you'll wind up with a big fat process serving simple request. You may want to set up some kind Reverse Proxy or recompile php to use Worker instead Prefork.. It may significantly reduce your memory footprint..
All of it is just assumptions, so you have to profile and measure to find the root of your problems.