General Question

HungryGuy's avatar

Is there an advantage to putting the database on a separate database server?

Asked by HungryGuy (16044points) May 13th, 2010

Is it better to have the web (Apache, PHP) server and database (MySQL) server on separate machines? Or will the network overhead and bottleneck negate any advantage to putting the database on its own server?

Observing members: 0 Composing members: 0

13 Answers

jaytkay's avatar

It depends on how much traffic you have and how data-intensive it is. Also, read-only requests are a lot lighter on resources than read-write.

At the extremes, say you are running eBay or Amazon.com – that requires separate servers.

And if you get a few thousand hits a day, it probably works just as well either way.

Obviously the distance between those extremes is immense, and you have to figure out where your application is. If your site is smaller, you could combine them and you would know pretty soon if you needed a second server.

If you make the web application modular, changing the data source later is pretty easy.

WestRiverrat's avatar

If you are borderline on whether you need 2 servers, bear in mind.

If you do go with two servers, even if you don’t really need both yet, you will have that extra layer of redundancy if either of them goes out.

HungryGuy's avatar

@jaytkay – It’s a small non-commercial niche-site. It’ll never be another Amazon, or even a Fluther :-p I’m just thinking ahead, is all…

@WestRiverrat – How is that redundant? If the web server crashes, the site goes down. If the DB server crashes, the site goes down. No offense, but your answer made me realize that having separate servers doubles the risk exposure if either server fails.

andrew's avatar

Yes! Yes! Yes!

Well, sort of.

Small sites don’t matter as much, but you definitely tune the machines differently. It also makes scaling a lot easier when you get more traffic.

andrew's avatar

@HungryGuy If you have physical boxes, run it on one. If you’re doing slices or EC2, definitely put them on separate boxes.

HungryGuy's avatar

@andrew – Right. That’s what I was thinking. Less hassle to balance the load now before the site gets busy. Better to do it now when the site is under development than when it’s busy 24/7 with hundreds of users…

WestRiverrat's avatar

@HungryGuy if you have to wait for parts to ship from Europe, you can install either the database or the web data on the other machine. If you only have one server, you may end up waiting for parts and be down for an extended period.

I know this is not as much of an issue if you live in an urban setting. But out here in the boonies it is a real possibility.

andrew's avatar

@HungryGuy Keep in mind that DB servers at scale get IO bound, where your web/app servers are memory bound, maybe CPU bound.

HungryGuy's avatar

@WestRiverrat – That’s another issue. Right now I only have one server. Is it worth springing for another server (at a few grand), especially for, basically, a hobby site?

HungryGuy's avatar

@andrew – Right. I see the point in balancing an IO bound server with a memory-bound server on the same box. But once something gets CPU bound, everything comes to a screeching halt.

jaytkay's avatar

@HungryGuy
Curious why you don’t just host it with Godaddy or somesuch? Maybe running & learning about the servers is part of the goal?

HungryGuy's avatar

@jaytkay – That’s what others have suggested before. But I like the warm-fuzzy of having my site in the corner of my dining room.

WestRiverrat's avatar

@HungryGuy You will have to answer that for yourself. I am just trying to give you some issues to consider that we dealt with where I worked. The more knowledge you have the better the decision.

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther