There is no single way to setup your server for web application but it all depends on how you are going to use it. Depending on which architecture is suitable for our environment we can select a way to setup our server where everything is on one server or we have separate database server.
Everything on one server might be perfect when you are starting. When you don’t need to worry about scalability. It is also most quick and simple to setup so if you are concentrating on your actual business and don’t want to get into all the trouble of getting a robust architecture, this is your pick. It is also cheapest of all.
Only problem with server setup of this kind is nothing is isolated here. So, for ex. If you want to scale or pin point a source of a problem it is difficult. Let’s say you went with LAMP stack setup where all Linux, Apache, MySQL, and PHP are on same server. Now, if you are getting poor performance it’s difficult to determine the source of problem because CPU, Memory, IO etc. are on same server.
Things are little more secure and isolated when we have Separate Database Server. We can more one more step further into security by removing database from public internet. This server setup also relatively simpler but it offers separate environment which eliminate resource contention. This kind of server setup can be scaled vertically as both the resources are separate.
Separate database server setup can be further broken into various levels where we add different components ex. Load balance, HTTP Accelerator etc. to make the setup more robust.
If the workload on a particular server increases we can make use of load balancers to add more servers to the environment. The way it works is – it will distribute workload around multiple servers. Horizontal scaling is a breeze when you have load balancer. Also, if one server which is part of load balancer fails, other server start handling the incoming traffic till that server is healthy again.
However, this kind of server setup comes with their own set of complexities. Ex. The whole system fails when load balancer goes down. Also, we need to have enough resources at our exposure when setting up load balancer otherwise it can create complex problems.
If we want to increase performance by reducing CPU load we can make use of HTTP Accelerator. HTTP Accelerator is a way to cache response from web or application server. This type of setup is extremely useful for the kind of website where the content is accessed frequently. It also helps when we are dealing with heavy content.
This type of setup can end-up reducing performance if the cached content is not accessed frequently. I.e. if new content is requested more than the cached content.
Performance can also is enhanced by replicating databases especially when reads are performed more than writes. This configuration have one primary node and many replica nodes. Writing is done only to primary node but when it comes to reading we can access any of the replica nodes. In this type of setup we need to keep the primary node always up. If the primary node fails, everything fails.
Of course we can and should combine multiple server setups to get a setup which is highly available and high on performance.
After setup, other factors to consider during selecting architecture include scalability, performance, cost, etc. Once the server setup is done with suitable architecture we can onboard it on InfraGuard to manage it.