I am confused for my project to deploy it on the server. Should I use two server (one server for application code and another server is for database) or ONLY single server for both i.e. application and database? So that the performance may be fast.

Please suggest which is the best option and why???

Thanks in advance


2 Answers 2


It Depends

If traffic to your app is low enough, a single server will do. When you start seeing performance problems that you can't solve by fixing your code, optimizing your queries or tuning your database, a good step to take is to put the database on a separate machine.

When load goes even higher, it may be time to have multiple application servers and a loadbalancer (if load is higher on the appserver) or a replicated or sharded database setup (if load is higher on the database).

So start with one server and monitor the performance. Define what you consider good performance and make sure your application achieves it.

  • Start with one server, but write your application in a way that it is prepared to run on multiple servers (different server for DB and web).
    – Konerak
    Feb 5, 2013 at 9:50

For small application , database can be on same server and for bigger application, database server can be on separate this will provide a good performance but using two servers extra cost, dedicated network connection between the two, more maintenance, etc. can be a overhead Webservers have different hardware requirements than database servers. Database servers fare better with a lot of memory and a really fast disk array while web servers only require enough memory to cache files and frequent DB requests (depending on your setup). Regarding cost effectiveness, the two servers won't necessarily be less expensive, however performance/cost ratio should be higher since you don't have to different applications competing for resources. For this reason, you're probably going to have to spend a lot more for one server which caters to both and offers equivalent performance to 2 specialized ones. The security concern is that if the single machine is compromised, both webserver and database are vulnerable. With two servers, you have some breathing room as the 2nd server will still be secure (for a while at least).

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