August 19, 2021
2 min read time

Understanding Multi-Tenant Web Traffic with Fine-Grained Statistics

It’s not unusual for companies to want to understand their web traffic in greater depth. Being able to collect fine-grained statistics provides valuable insight into web performance and potential improvements. 

But it can also be business-critical in that you may need to keep track of traffic statistics to invoice your own customers. Many Varnish users have multiple tenants, such as CDN providers or large resource-intensive IT departments. With these different users of a single set of caching resources,  there has to be a way to account for individual tenants’ use statistics in order to bill them accurately and split their specific use stats accurately from the rest of the herd.

VMOD to the rescue

Varnish Enterprise lets you do this granular accounting with the accounting VMOD. The accounting VMOD lets you get customizable statistics and metrics from your traffic.

A broad application of accounting VMOD is simply being able to find out how much traffic is running through Varnish at any given time, even in single-tenant setups. For example, you can see traffic data in detail, such as how many requests are made, how many bytes, how many cache hits and bytes, cache misses, passes, etc. You can also see errors of different kinds, which can help you understand your traffic, troubleshoot problems, and even to create dashboards.

Multi-tenant accounting

The primary use case for the accounting VMOD, though, is managing multi-tenant billing and pulling individual sets of statistics to get insight into those individual tenants' use and performance. Examples include: when a company has one CDN but each department is a different tenant, or a web service hosts multiple domains on each server. Also, video services that split their workloads across live, VoD, and live channel statistics can examine data from each tenant separately. Ultimately these separate services need to be billed - and understood - individually, and the accounting VMOD makes this possible. It can provide metrics per tenant in varnishstat, for use in dashboards and monitoring, and is ideal for more complex multi-tenancy situations.

With the accounting VMOD a multi-tenant setup is relatively easy and flexible. You can create separate Varnish Configuration Language (VCL) configuration for each tenant. You can design your own key scheme, tagging traffic in and out of Varnish, and read statistics for each key. For example you can have separate keys for HTML, CSS, images and video, and, at the same time, have one key for each users’ preferred language. You’ll be able to split your traffic into multiple slices in multiple ways, and get metrics on each slice. And with a couple of extra steps beyond that, you can easily create dashboards for visibility into performance and billing. 

 

New call-to-action