0

I currently have an HTTP server running on a single machine (it runs Ubuntu Server Edition, if that helps). In the past that has been sufficient, but as traffic has grown I have begun to need more power and storage space. I have a second machine, and have installed Ubuntu Server Edition on it. How do I get the two to run in unison? How is this usually done in professional setups?

Thanks, your answers are appreciated.

4
  • Are you just running apache? Please list all the technologies that are being accessed over http, such as php , mysql? What does your web app do? Have you identified the bottle necks? if so, what are they? Does you webapp keep session state? if so how? Mar 19, 2010 at 23:38
  • I am running PHP, MySQL, and CGI. I don't know where the bottlenecks are. I think the best way to do this would be to set it up similar to the professional setups, but I don't know how to do this. Where would be the right way to go?
    – Robert
    Mar 19, 2010 at 23:45
  • Are there any 'write' operations involved ?
    – Dominik
    Mar 20, 2010 at 0:13
  • Is your PHP using mod_php, fastcgi, or ordinary command-line CGI?
    – PP.
    Mar 20, 2010 at 2:17

3 Answers 3

0

I no write operations are involved in your setup, you could simply use a round robin DNS setup. If that's not the case, your first option having two servers might be to use and tune 1 as a web and 1 as database server.

1
  • This will introduce an additional SPOF. Should just upgrade the first machine and optimise it for running a webserver & database. Mar 20, 2010 at 0:42
1

First you should connect them with some fast network.

  1. You may run some caching reverse proxy like nginx.
  2. You may move MySQL to the second host. You can also try to to make distributed.

Requests to the static data should be served by simpler things like nginx/lighthttpd/... on one machine or on two machines (in round-robin fashion).

Read-only complex requests should be properly cached. Cache may run on other host.

Complex write requests may be done some centralized manner (only on one machine; with roles separation (web server/database)). Alternatively, you may consider doing scalable system with multiple nodes that can handle all requests, but it is going to be more complicated and should be considered if there will be further massive growth.

If the system is mostly read-only (like a collection of movies available for download), you may set up 2 hosts responsible for parts of content. Alternatively, if the data protection against crash is more important, you may do two identical hosts with the same data and round-robin requests to them on router.

0

Before you do anything you need to better understand where your loads are and what your bottleneck is. It is very easy to throw faster hardware or more servers at the problem, but you may find a few specific software changes may yield the results you are after.

To start with you could use some very basic, command line tools like top and the sysstat package to get a basic idea of what is going on. i.e. You first need to identify if the slowdown is caused by the CPU, network, I/O or just poorly configured software.

There is plenty of information on the Web related to using these tools to identify problems (Google is your friend). Not only will this help you to understand what is going on better, it will also mean if you introduce new hardware it is actually helping to solve the problem.

You must log in to answer this question.