Koozali.org: home of the SME Server

Moving MySql database to a separate server

Offline calisun

  • *
  • 620
  • +0/-1
Moving MySql database to a separate server
« on: March 10, 2008, 08:27:42 AM »
I am helping out a friend who has a web site that is really taking off. He has a social networking site that uses php and MySql. The site is getting busy to a point that just one server is not enough.

What we are trying to do is to have php and all files on one server and move MySql to a separate server; both servers will be connected with Gigabit ethernet.

The original server is very fast, but new server will be even faster.
My question is, what would be a better/ faster decision, to have new/ faster server for php/file server or MySql server?
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Moving MySql database to a separate server
« Reply #1 on: March 10, 2008, 10:10:33 AM »
I am helping out a friend who has a web site that is really taking off. He has a social networking site that uses php and MySql. The site is getting busy to a point that just one server is not enough.

What we are trying to do is to have php and all files on one server and move MySql to a separate server; both servers will be connected with Gigabit ethernet.

The original server is very fast, but new server will be even faster.
My question is, what would be a better/ faster decision, to have new/ faster server for php/file server or MySql server?
Although your question is not SME Server related there is no way in saying which is better, without knowing the details of your setup as well as the source code.

If your CPU and/or memory is not maxed out on the current server the only increase will be in faster CPU cycles as all instructions should be executed without delay, if your CPU is maxed out increasing CPU power could help. The same holds for memory.

Making the system distributed is not going to help you much I think as local disk access is most of the times much faster than network access (most of the times network throughput (1 Gbit = max. 125Mb/s (without error corrections, in real life it will always be lower because of error corrections and checksums being verified) is much less than local throughput to hard drives (SATA2 300 Mb/s) ).

A few more pointers though:
  • Did you already do everything to optimize your queries (correct indexes)?
  • Did you do everything to optimize MySQL (memory settings, index buffers, query buffers, etc.)?  MySQL Presentations: Optimizing MySQL
  • Did you do everything to optimize PHP (memory settings etc.)? http://www.linux-mag.com/id/2542
  • Did you do everything to optimize your webserver?

With a little Google-ing on keywords optimzie, apache/mysql/php you will find a lot of useful links.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline calisun

  • *
  • 620
  • +0/-1
Re: Moving MySql database to a separate server
« Reply #2 on: March 10, 2008, 10:13:39 PM »
Thanks Cactus,
Believe it or not, it is SME Server related question, he is using SME server for his web server.

The web site he is running is a Social networking site, which has a lot of stuff going on: friends, blogs, pictures, music, videos, instant messaging; The site relies very heavily on SQL. His site is approaching 20,000 users. According to the developer of the software he is using, 20,000 users is a point at which they recommend putting MySQL on a separate server in order to speed up processing of other stuff.
It is a common practice for for big sites to have sql on a separate server. And I have actually read several articles that recommend  to have sql on a separate server behind a router/switch to minimize risk of getting personal data hacked.

So now actually I have two questions:

* What would be more beneficial, to have a faster server for front end or for SQL server (my guess is front end)

* My other question is, should he continue using SME server for such a large site, especially that his site is located in an ibay?

SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Moving MySql database to a separate server
« Reply #3 on: March 10, 2008, 11:45:11 PM »
Believe it or not, it is SME Server related question, he is using SME server for his web server.

I don't believe it! :-)

The connection with SME server is merely coincidental. Your questions have nothing to do with SME server, and have everything to do with tuning of mysql backed clustered web applications. The expertise for mysql backed clustered web applications lies elsewhere.

Google for 'livejournal scalability" and you'll find some good references.

Offline calisun

  • *
  • 620
  • +0/-1
Re: Moving MySql database to a separate server
« Reply #4 on: March 11, 2008, 02:13:48 AM »
Thanks Charlie,
How about the question about using SME Server for a busy site like that? Should he continue with SME Server or switch to something different? He does want to use Linux, but I am not sure if SME is optimized for large loads like that.
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite