General Question

haegenschlatt's avatar

What takes more computing power, serving HTTP or MySQL?

Asked by haegenschlatt (122points) March 21st, 2010

Here’s the question for the sysadmins out there:

I’ve got two servers, one is about 20% faster than the other. I’m planning to use one as a dedicated HTTP (apache) server, and the other as a dedicated database (MySQL) server. Which program should get the faster machine?

Observing members: 0 Composing members: 0

10 Answers

poisonedantidote's avatar

this is not exactly my field, but i would say http has much more to do that mysql. with http you are loading everything, where mysql is just loading data. i guess it could depend on the site and whats on it, but for the most part http will be doing most the work.

Vincentt's avatar

@poisonedantidote One HTTP request could (and often will) trigger multiple MySQL queries.

jaytkay's avatar

It depends on your application. There is no single answer.

If you have a low volume site, you will never notice a difference

A high-volume site, with a small read-only database, will put more load on the Apache server

Are real-time data manipulations done largely on the web server (PHP/Python/whatever) or is MySQL doing the work?

Does the database have other interfaces than the web? For example, it might perform extract, transform, and load (ETL) functions, importing data that will later be served via the web.

Is apache serving audio/video?

malevolentbutticklish's avatar

Filling in lots of blanks here but since the database will likely be io-bound anyway you should put it on the slower machine.

andrew's avatar

And they’re both possibly going to be memory-bound.

malevolentbutticklish's avatar

@andrew: If I am allowed to say this here. Please add real-time edit-update support (it should be trivial). This morning someone posted a response without a link. I responded and they said I was rude for not having read the link. Turns out they added the link in an edit but my page did not reflect this.

noyesa's avatar

A database heavy website is going to be limited by the database. Most web servers can even process PHP/Python/Ruby scripts with a full-stack framework more quickly than the supporting database lookup.

HTTP is much quicker, so if your website makes use of a database the MySQL server is going to be the bottleneck.

As other have mentioned, database access will largely be memory or drive I/O limited, so it might not run any faster on the faster machine that it would on the slower.

malevolentbutticklish's avatar

@haegenschlatt: There is one more option which is outside the scope of your request but you should consider it. If possible, run the site on both machines at once as a cluster. In this way your site availability will increase. Hardware failures do happen from time to time.

haegenschlatt's avatar

@malevolentbutticklish How would I run it as a cluster? Any recommendations or pointers?

Thanks everyone.

malevolentbutticklish's avatar

@haegenschlatt: This is a big question. There are many options. For ease you may choose to rely on any of the many frameworks which supports clustering out of the box.

Example:
“The JBoss Application Server (AS) comes with clustering support out of the box.” http://docs.jboss.org/jbossas/jboss4guide/r4/html/cluster.chapt.html

You may also home-grow your cluster. This works for large companies like Google but is probably more effort than you want to put forward (although I have done it in the past).

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