What is the benefit of having separate web servers and application servers?

Most of the web applications that I have seen developed in my organisation , have the following components :

JS App (from browser) -> Web server -> Service(s)/Application server(s) -> Database

Each of these components typically does the following:

JS App – The interface (UI) for users to interact with the application from their browsers, typically a single page app.
Web server – Listens to HTTP requests and constructs the response by calling various services (application servers).
Application server – Fetches data by calling a database, and other services and processes the data based on some business logic and returns a response.
Database – Stores data.

Let’s say my organization runs a hotel booking website, and is planning to provide a new functionality of travel packages, think of a package as consisting of multiple bookings at multiple hotels, travel (trains, flights etc) bookings, etc., this new ‘Packages’ application would be made up of the following components :

PackagesFrontEnd – JS App
PackagesWebApp – Web server
PackagesService – Application server/service
PackagesDB – Database

The PackagesWebApp would communicate with the PackagesService, and various services that handle bookings for hotels, travel etc., to serve its requests. The PackagesService is pretty much a wrapper on top of the PackagesDB, containing some business logic.

My question is, why do the web and application servers need to be separate here ? in my example, what is the problem with having PackagesWebApp and PackagesService as a single thing ? I have tried asking co workers, and searching online, but could not find a convincing answer for this, heard and read the following reasons:

Separation of concerns: Separating presentation logic and business logic (Why can’t this be done at a module level ? with interfaces in between the classes for the layers ? Also, a side effect of this is that people duplicate some business logic like validation for example, in both the components to ‘fail fast’ but this sometimes comes back to bite when a change was done in one but missed in the other)

Availability: If one component has a bug and it misbehaves, it might bring down both the components (The web app wouldn’t be useable anyways if either of the servers is down, even when they are separated, so what is the additional benefit here ? And, even if there is a benefit to this, then, by extension the same thing might happen, where, a bug in the code for feature ‘X’ thats unrelated to features ‘Y’ and ‘Z’ brings down all of them, so why not separate them also ? where do you draw a line for this ?)

On the other hand, there are definitely some overheads that come with having multiple components, like maintaining codebases, integrating components, maintaining infrastructure resources, debugging/finding root cause for issues is more complicated. In such a situation, doesn’t separation only make sense if it solves some problem thats worth taking on these additional things ?

Can someone please help me in understanding the reason why this is needed ?

The main benefit is that your application servers don’t have to think about stuff like:

  • Load balancing.
  • Request / Traffic Routing.
  • Hacking – understand things like Denial of Service attack
  • Upgrades – lets say you want to incrementaly upgrade your application.
  • Logging and filtering of traffic.
  • Specialized HTTP servers for Ajax, Websocket(Async Http server) communication GraphQL (Appolo server) etc…

It should also be noted that the line between HTTP server and Api Gateway is rather weak. Api Gateway can potentialy be realized via webserver.

Here is an example article about NGNIX deployed as Api Gateway https://www.nginx.com/blog/deploying-nginx-plus-as-an-api-gateway-part-1/

4

To add another reason, many application servers are not as good as web servers at serving static files (frontend JS, CSS). At least some of them (I know of Flask and node) explicitly stated in their deployment documentation that you should use a separate dedicated web server software (commonly nginx, or Apache) to serve those in a production environment.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật