-1

If my website is running on top of a dedicated server using PHP and MySQL. When can I know that I need a second dedicated server? and is it easy to make my website runs in two servers? will it cost me anything expects the cost of the new server? For example: will the MySQL Community Edition will handle this? and how can I span my website into two servers?

1 Answer 1

3

Woah, what a broad question! There are 1200 page books written about this topic, summarizing it to a noble little serverfault answer is hard. Let's try:

Server resource usage

Monitor it. Graph it. Watch the trends. If CPU usage etc. is not clearly growing over time, you don't need to rush. If resource usage grows steadily, buy more hardware before sh*t hits the fan; say, you see CPU usage has reached an average of 40-50% usage, it's time to start investing on new hardware. Or if memory usage starts to near comfortable limits, expand the RAM or buy more servers.

Spreading the load over more than one server

Yes, it's very much doable. Typical first step is to separate the database server and the web server; put MySQL to one server and your web server to another.

Adding more web servers is can either be very easy or very difficult, depending on your setup and software you use. If most content is server from a CMS (such as Drupal or Wordpress) and the static content (image files etc) changes only rarely, you can setup a cronjob rsyncing the files every now and then from master server to another servers and be done with that. Or have a file server and have your web servers accessing it via NFS. Or use some cluster file system (GFS, GPFS, OCFS2), though they do have their issues. Or use DRDB.

Adding more database servers can be trickier. With MySQL the most traditional way is to have one master server which handles both reads and writes, and then X number of slave servers which only handle reads. The tricky part can be configuring your application for that scenario, and also in very busy environments there can be noticiable lag in master->slave replication. In theory you can also use multimaster with MySQL, but that has its gotchas, too.

If you use just open source software, any of this does not cost you more money in addition to servers - though planning, implementing and testing all of this will take quite a lot of time.

Not the answer you're looking for? Browse other questions tagged .