NGINX Full Version

是时候迁移到四层的应用架构了

The new year is well underway and, like many others, you are probably planning upcoming projects to enhance your existing digital experiences or build completely new websites and applications. As you do so, the most critical fact to keep in mind is that “web” no longer means “web browser.” Pundits have been espousing a “mobile first approach” to application development for years, but with an annual mobile traffic growth rate of nearly 60% this is not negotiable any longer. The explosion in the number of connected devices, the shift of traffic from desktop to mobile, and the rising tide of the internet of things means that projects must now be rooted in the diversity of user experiences available on different devices.

It’s becoming increasingly obvious that the historical approach to application architecture – we’ll call it the monolithic model, due to the focus on building a single integrated application containing the majority of features and functions – starts to break down in a world where you need to tailor your experiences for specific devices and specific users or use cases. Moreover, you simply cannot achieve the agility, flexibility, and scalability demanded of today’s applications using many of the old architectural patterns and behaviors.

To build and deploy apps that effectively attract and retain customers on a range of devices, you need to embrace a new way of thinking about app design. In this blog we’ll describe why the monolithic architecture no longer works, and introduce a new model that promises to help you meet the challenges not just of today’s web, but the web of the future.

Why is the Standard for Application Architecture Changing?

Monolithic Architecture, Source: Martin Fowler

In the commonly used monolithic architecture, the application occupies the middle layer of a three‑tier design, with a presentation tier at its front end and a data tier behind it. The application delivers data to the web browser operating at the presentation tier, which provides the means for users to request information from the application, view it, and (usually) manipulate or change it. The application reads and writes information from and to the data tier, where a database or other storage device or application organizes and maintains it. The application itself consists of the logic for interacting with the other two tiers and for transforming the data as requested by the user.

The monolithic application architecture isn’t inherently flawed, it’s just out of date. It was designed before smart phones and other mobile devices existed, when applications only needed to interact with one kind of entity at the presentation tier (the web browser running on the desktop). Its drawbacks derive not from the number of layers nor how data processing is distributed across them, but from the fact that the application is written as single, unified code base. The monolithic nature makes it difficult for developers to change an application with the agility and flexibility they need to keep pace with the expectations of mobile users, and for operations teams to scale the application up and down to match demand.

A monolithic design hampers agility at several phases of the application development process. Even if application functionality is distributed in a modular fashion, a change to any module requires rebuilding and testing the entire application. This can be quite time‑consuming, which might have been acceptable when companies deployed updates only a few times a year. In today’s fast‑paced environment, an app that pushes updates only a few times a year cannot be competitive. You need to roll out incremental improvements quickly and often to keep up with users’ thirst for ever‑better performance and the latest cool new feature. And in an always‑on world, there is never a time when updating an app doesn’t inconvenience a large set of your users.

Microservices Architecture, Source: Martin Fowler

Breaking applications into modules has long been considered a best practice. More recently, the success of open source projects has made many developers more comfortable with leveraging external libraries to accomplish specific functions. These open source packages are often used for specialized functions that fall outside the developers area of expertise, or are used solely for the purpose of saving time, and the worry of security maintenance. The flexibility to choose from an array of solutions in this way isn’t available with a monolithic design, where solutions are typically built from a set of highly interdependent coupled components.

Lastly, the three‑tier architecture lacks scalability; in fact, it was designed in an era where the idea of elasticity and rapid scaling did not broadly exist. Because the functional components of the application are packaged together as a unit (the monolith), the only way you can respond to changing levels of client demand is to scale the entire application. Applications running on the three‑tier architecture are typically unable to scale specific pieces of the application independently because the entire application is coupled together. Regardless of whether you have an ecommerce store, a social media application, or a blog, a basic requirement for today’s applications is the ability to scale up and down on demand; preferably at as low cost as possible. The process of scaling your application up or down should be simple, automated, and intelligent. For example, a modern application architecture would allow you to deploy additional Node.js instances to respond to a sudden influx of user registrations.

Introducing the New Application Architecture

Over the last few years a new architectural approach has emerged that provides agility, flexibility, and scalability. Described as “The Four‑Tier Engagement Platform” by Forrester Research, this modern approach to web architecture is designed specifically for the mobile age. The Four‑Tier model is architected to create a foundation for excellent performance, device‑tailored experiences, and allows for integration of both internal services and applications as well as third‑party services and APIs. Forrester’s Four‑Tier Engagement Platform is broken into client, delivery, aggregation, and services layers.

The Four‑Tier Engagement Platform Makes Delivery Its Own Tier. Source: Forrester Research, Inc.

The most dramatic difference in this new model is the client tier, as modern applications need to think about the user‑facing layer as its own independent set of functionality that leverages the delivery, aggregation, and services layers beneath it to create device‑specific and highly tailored experiences.

If a user on a mobile device loads the homepage of a media website, the application should respond with content that is optimized for performance on that device and presented in the context of the user experience designed and developed by the website’s UX team. Isolating the user interface from the three tiers behind it in this way gives frontend and user‑experience designers and engineers much more control to create memorable digital experiences by tailoring them to the specific user context (device type, location, and so on), integrating with third‑party content or services, or simply redesigning them regularly to optimize for engagement and conversion, all without disrupting backend processes or engineering. Similarly, it leaves backend designers free to adopt the best technology for their tier as long as the established protocols and encoding for information delivery to the client tier are maintained.

Content Delivery Network

The delivery tier is responsible for optimizing delivery of the digital experience to the user using intelligence received from the client layer. Using intelligence‑driven solutions such as content delivery networks (CDNs) and on‑the‑fly optimization tools such as those used for compressing images to decrease bandwidth, the delivery tier is designed to handle middle and last‑mile challenges well, ensuring the best possible end‑user experience regardless of user location or quality of network connectivity. The data tier also utilizes sophisticated caching algorithms and tools that enable DevOps to monitor and resolve application performance and delivery issues in real time.

The aggregation tier is an API layer that serves as a hub for integrating internal and external services using real‑time, bidirectional communication. Composing underlying services, such as data storage and third‑party services, this layer of the application framework compiles and composes data and content for delivery to the client. The aggregation tier serves as the center of application logic, performing tasks like translating between SOAP to JSON encoding or combining third‑party and in‑house algorithms to perform complex calculations. This allows developers to easily build complex applications using business intelligence, analytics, and role‑based permissions.

The final tier of the engagement platform is the services tier, which provides the other tiers with the data and functionality they require. The services tier is designed for a microservices approach, one that is designed to be open and pluggable, and focuses on the integration and composition of existing services a company has already built as well as new open source libraries. Whether data is stored in a relational database such as MySQL or a document store database such as RethinkDB, the services tier provides the infrastructure to process application requests and workloads. This provides developers with extreme flexibility in both their internal organization of data and the choices they make when integrating with third‑party applications.

This four‑tier architecture is already the core foundation of industry‑leading applications and services like Netflix, Uber, and many others. We all know that users want experiences that are fast, responsive, and tailored to their unique needs, and that businesses need to adapt quickly to changing market conditions and scaling requirements. As a developer, engineer, or architect, you realize that this new architecture will let you meet both of these goals. But now you’re left wondering: “Do I have the right tools available to deliver on these promises?”

What Do I Need to Adopt the Four‑Tier Engagement Platform?

As Forrester Research explains, the new standard for application delivery is different from prior architectures in that it focuses on the experience of the developer just as much as the user. To adopt the four‑tier engagement platform you need a tool that links the tiers together so they can communicate, scale, and deliver. Powering over 40% of the top 10,000 websites and applications, and recognized as the fastest growing web server for 5 years in a row by W3Tech, NGINX is the fabric that binds together the modern application architecture.

NGINX is a software‑based solution designed to meet the needs of the most demanding applications, and supports the engagement platform at all tiers.

Now is the time to finalize plans for your next website or application project or upgrade. We encourage you to read more about the four‑tier application architecture. What sets great developers apart from the rest – or, more urgently, what separates winners from losers – is the ability to innovate, adapt, and build extraordinary new products and experiences faster than the competition. Get started today and join other companies in making the switch to a modern application architecture.

Contact us to learn more about how NGINX can help support your move to the new way of building and deploying applications. In addition, the four‑tier architecture is best implemented alongside a shift to microservices – an approach that breaks applications into small, nimble, and independent components. Download a free copy of O’Reilly Media’s new book, Building Microservices, courtesy of NGINX.