Architecture – Modular Web App Network Architecture

Architecturenetworkingweb-applications

Assuming that I am dealing with dedicated physical servers or VPSs, is it conceivable and does it make sense to have distinct servers setup with the following roles to host a web application?

  1. Reverse Proxy
  2. Web server
  3. Application server
  4. Database server

cloud diagram

Specific points of interest:

  1. I am confused how to even separate the web and application servers. My understanding was that such 3-tier architectures were feasible.

  2. It is unclear to me if the app server would reside directly between the web and database server, or if the web server could directly interact with the database as well. The app server could either do the computational heavy-lifting on behalf of the app server or it could do heavy-lifting plus control all of the business logic (as implied in the diagram above, thus denying the web server of direct database access).

  3. I am also unsure what role the reverse proxy (ex. nginx) could and should fulfill as a web server, given the above mentioned setup. I know that nginx has web server features. But I do not know if it makes sense to have the reverse proxy be its own VPS, given that the web server–in theory–would be separate from the app server.

Best Answer

Remember one key rule:

Don't worry too much about getting the architecture scalable and all in the first pass. You might need to change it several times over as your application evolves as a result of more users/traffic/features/etc.

Just get down to shipping something so that REAL users can have a go, and act on their feedback. Don't plan ahead too much because no matter what to plan, it is bound to change.

As for the quesrion, the reverse proxy and the web server can generally be the same application -- usually nginx to begin with. Then as you scale out, varnish can be a more powerful reverse proxy.

Web servers like nginx never talk to the database directly. Application servers sit between the two.

-- UPDATE --

The above does NOT mean that we do not need to think about architecture at all. It means not worrying about getting every last architectural detail right from the start.

However, we SHOULD think about the high level system shape. Interactions between components is something that must be well thought out before beginning the concrete implementation.

Related Topic