NGINX.COM
Web Server Load Balancing with NGINX Plus

Successful businesses understand their customers. This can be a bit easier with a physical storefront, where you have a direct connection to your customers and can visually gauge their experience. If they have to wait in line too long, you can quickly see that with your own eyes, and your customers are sure to tell you about it. Running a business digitally, however, means that you lose that face‑to‑face interaction. The challenge this poses is critical. Digital customers are quick to move on: 80% say they are less likely to come back after having a poor experience.

A poor experience online is also not just usability problems, either; a delay of even a few seconds for a screen to render, or any kind of technical hiccup during a transaction, is interpreted by many users as a breakdown in the experience, and with it their trust in your brand. With a digital business it’s even more critical to understand what your customers are experiencing.

Application performance management (APM) solutions help bridge that gap to give businesses visibility into how well their applications are performing and what the user experience is like. Engineers can take a customer complaint, such as “my checkout is slow”, and, using the APM tool, dive down to find the root cause of the problem. Vendors that offer APM solutions include AppDynamics, Dynatrace, New Relic, and Riverbed.

This blog provides an overview on APM as well as the insights NGINX provides into application performance.

A Typical Application

APM tools aim to give end‑to‑end visibility into the application. The diagram below depicts a typical three‑tier application, for example an ecommerce site. The first tier is the clients and their user interface (UI), depicted on the left. This first layer is closest to the user and covers what they see in the browser, how the images are laid out, where the text goes, and in general the overall structure of each page.

A three‑tier architecture with NGINX

The content on most pages of an ecommerce site, such as the pricing information that appears when the user clicks on a product, is dynamically generated by the second tier, the application servers. To build the pages, the application server interfaces with the third tier, the database, depicted all the way to the right of the diagram. In this example, the application server queries the database for the product description, price, and other information it needs. It then builds the page using this data and returns it to the browser to be displayed.

Sitting between the clients and application servers, NGINX load balances, caches content, and reverse proxies traffic. Software that performs these functions is sometimes called the delivery tier.

Monitoring Performance of Application Servers

At the core of APM is monitoring application servers, where the core application logic lives. They are responsible for dynamically generating the pages users see and handling user input.

To monitor an application server, an agent is typically installed on the server itself. The agent periodically polls the interpreter or virtual machine (VM) for the programming language the application uses. It collects data, such as transaction traces, and feeds that data back to a portal.

With this information the portal can provide visualizations like the one in the following screenshot from Dynatrace. Looking through the transaction trace, we can see that it took a little more than a second to check the credit card number provided by the user. Having identified this as being a potential bottleneck in the transaction, engineers can now focus their efforts on improving this piece of the application.

A transaction trace from Dynatrace

APM tools can also monitor overall call counts, error rates, and time spent on database calls to give a full picture of what is going on inside the application servers.

Monitoring Performance with NGINX and NGINX Plus

NGINX and NGINX Plus sit on the edge of a site’s internal network, between clients and the application. From this position they see most or all of the traffic that passes in and out of the application. They are responsible for packaging traffic to be sent over the Internet as well as protecting the application servers from being overwhelmed.

Monitoring NGINX performance with Datadog

The screenshot from Datadog above shows how many requests per second NGINX handled. NGINX Open Source provides other valuable statistics, such as:

  • Connections – The number of current connections as well as the number that are active vs. idle
  • Bandwidth – How much bandwidth the application is using

With NGINX Plus you get even more data on application performance:

  • Cache – How full is the cache and what percentage of requests are being served out of the cache
  • Granularity – NGINX Plus breaks down the statistics per server, so you can see how your servers are performing relative to each other
  • Health – With NGINX Plus’ active health checks, you can quickly identify any failed servers

NGINX Plus has a built‑in dashboard where you can see all of the available statistics, or they can be exported to our various partners, such as Datadog, Dynatrace, and New Relic.

Real User Monitoring

So far the monitoring has been focused in the data center, but what about the browser and the actual user? The backend services in the data center generate the pages that are loaded in the client’s web browser. Real user monitoring (RUM) attempts to quantify the experience of the actual user and where the time is being sent from the moment the user hits enter till when the page is fully rendered.

Real user monitoring works with the help of JavaScript code that is downloaded along with the rest of the elements that comprise the web page. Once the JavaScript runs, it reports back to the portal the amount of time spent in each stage of the page loading in the browser.

Real user monitoring with New Relic

In the above example we can see that the majority of the time was spent downloading and rendering the page within the browser.

Conclusion

For a digital business, gaining insight into the user experience is critical to success. APM can help provide that insight and give businesses the tools they need to be proactive in maintaining a high level of customer satisfaction. Through both the APM functionality in NGINX and NGINX Plus and our partnerships with the leading APM vendors, we committed to providing the kind of rich data that gives you the best possible visibility and control, and to helping you ensure a flawless user experience.

To try NGINX Plus, start your free 30-day trial today or contact us to discuss your use cases.

Hero image
Free O'Reilly eBook: The Complete NGINX Cookbook

Updated for 2024 – Your guide to everything NGINX



About The Author

Faisal Memon

Software Engineer

About F5 NGINX

F5, Inc. is the company behind NGINX, the popular open source project. We offer a suite of technologies for developing and delivering modern applications. Together with F5, our combined solution bridges the gap between NetOps and DevOps, with multi-cloud application services that span from code to customer.

Learn more at nginx.com or join the conversation by following @nginx on Twitter.