Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

MySQL on a dedicated server vs increasing RAM on server with MySQL + Rails app

1

243 views

I'm running into scaling issues with a Rails app running on top of MySQL. I'm using memcached and have lots of indexes.

I'm also starting to increase values for certain my.cnf settings like tmp_table_size and innodb_buffer_pool_size.

But then that brings me to my question. Should I move the MySQL database to a second, dedicated database server (thus increasing the amount of memory MySQL can use for buffer pools and such) OR should I increase the RAM on the current server, which hosts both Rails and MySQL?

I'm assuming I an increase the RAM available to MySQL much more if I move MySQL to its own server. But I'm worried about the latency of MySQL queries sent over the network between the two servers instead of through mysql.sock.

Any advice?

asked June 25, 2011 1:43 pm CDT
dan
posted via ServerFault

1 Answer

1
 

first understand where's your bottleneck. is your app mostly reading from sql? writing? if you mostly read and your data set no longer fits in memory probably adding more ram will give you performance boost. but maybe data already fits in memory and mysql hogs the cpu [eg it does full table scans because it cannot make use of index in some circumstances like subqueries]

few advices:

  • start with monitoring what's going on with your server eg using munin.
  • enable slow query logging
  • analyze what queries do you send to sql - eg with 1mysql.com/mysqlsla" rel="nofollow" target="_blank">mysqsla - maybe after all you do unnecessary full-table scans?
  • use explain for each of most frequent querries

only after that decide weather to:

  • get more cpu power [and move mysql to another machine]
  • buy more ram
  • optimize your code
answered June 25, 2011 2:24 pm CDT
pQd

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions