Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I was wondering the best way to setup my current application. Here is the general rundown.

I have a phone application that uploads and downloads photos from a vps that will store the files statically on it.

The phone application does a webrequest to a script which queries a local database for a photo filepath which then gets returned which then after the phone makes another request back to the same server for photo.

This server is also used to house the website.

I was wondering what is the best way of splitting off the functionality. From what I understand I should get another server which just houses the database and have scripts on the vps which query the database server. Should I store the photos on the database server as well or should that be on the server that houses the database?

Also would I be needing a ec2 server or would a general vps like thrust work for something like this?

share|improve this question

migrated from Jul 18 '11 at 20:11

This question came from our site for professional and enthusiast programmers.

It depends what you want to achieve. To improve performance? To ensure scalability? For security reasons? Because the new VP read about it in Information Week? – Thilo Jul 17 '11 at 21:13
It's to ensure scalability. I am about to do a trial run which will involve roughly 600 phones and I just want to ensure it doesn't crash. – tobiko Jul 17 '11 at 21:25
To ensure scalability you should make them separate processes, and keep an eye out for storage, but there's no reason you have to have several servers from day 1, except maybe to prevent a SPOF. – Wrikken Jul 17 '11 at 21:57
up vote 0 down vote accepted

Yes, general web scalability practices use separate web, database and file servers. However, don't just blindly do it now without knowing where your performance and scalability bottlenecks are.

You need to benchmark and profile your app before you start making changes. Make it work, then make it fast.

Also, you can probably handle a reasonable load on one server with appropriate caching and tuning of each layer (web, database, file system).

share|improve this answer
Thank you for the response. What is a good method to test performance / bottle necks with php? I've only used apache bench to see what the server can handle and it seems alright. Are there any standard methods to test these things? – tobiko Jul 18 '11 at 2:48
Use xdebug and webgrind (, for PHP profiling. They will show you exactly where your code spends most of its time. – Ryan Doherty Jul 18 '11 at 5:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.