Jump to content


This topic is now archived and is closed to further replies.


Server Management

Recommended Posts

I have a question involving database and server management. I have a community website in which songs and pictures can be uploaded, and blogs can be created with mysql. Eventually if all goes well, there will be need for multiple servers. Now i need to know how to prepare in advance for an increase in servers, so when people upload files to the servers, i will know which server each file is on, and also i need to know if i would need multiple sql databases if it were to get very big?

When you go to big sites such as myspace, you will see that pictures and songs are stored on seperate servers such as imageserver1.domain.com, imageserver2.domain.com. Now i need to know how to store the pictures on different servers when i upload it with php, and when the pictures are viewed how to look at the right server to view the picture.

How do these proffesional websited do it? I want to do it in the most practicle way possible.


Share this post

Link to post
Share on other sites
Well about the how to know what server its on would be easy i think. I don't know how big sites do it, but this is how I would do it:

create a .txt file with my servers in it like so


Then I would pick a random server from that with php, so it divides up the pictures across the server:
$servers = "servers.txt";

$all_servers = file("$servers");
$ran_server = rand(0, sizeof($all_servers)-1);
$random_server = $ran_servers[$all_servers];

then $random_server would hold whatever server it chose and you could use that in your upload script and also put it into the database so you would know what server to use to link the image later.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.