Understanding Cloudflare Load Balancing Analytics

Gain insights into traffic steering decisions through Cloudflare Load Balancing Analytics. These metrics are a feature of the Cloudflare Load Balancing add-on product.


Overview

Cloudflare Load Balancing Analytics offers multiple ways to analyze your load balancing metrics. You can evaluate traffic flow, assess the health status of origin servers in your pools, and review events that capture changes in load balancer pool and origin server pool health.

Cloudflare Load Balancing is an account-level, add-on product available to all customer plans. When enabled, Load Balancing is configurable via the Cloudflare Traffic app. For subscription information, visit Cloudflare Pricing.


Access Load Balancing Analytics

Load Balancing Analytics is available to Cloudflare Load Balancing customers in paid plans (Pro, Business, and Enterprise).

To view metrics for your load balancer:

  1. Log in to the Cloudflare dashboard.
  2. Click the appropriate Cloudflare account for your site, then pick the domain.
  3. Next, click the Traffic app.
  4. Click the Load Balancing Analytics tab.

The Load Balancing Analytics app displays a navigation bar on the left where you can access statistics under Overview, Latency, and Logs.  To understand the various metrics available, see Review your load balancing metrics below.


Review your load balancing metrics

Each metrics section features controls to fine-tune your analysis.  Below is a summary of each analytics section available.

Overview

Overview metrics  help you optimize your infrastructure based on traffic flow and distribution.  For example, you can:

  • Examine effects of adding or removing a pool to your load balancer,  
  • decide when to create new origin pools, and
  • plan for peak traffic demands and upcoming infrastructure needs.

When you click the Overview section, the form controls are loaded with defaults, these include:

  • A Load Balancer name - the first load balancer in alphabetical order
  • The time period - Last 24 hours
  • The pool - All pools

Use the Add filter control to add filters for Region and Origin.

Latency

Latency displays an interactive map to help you understand global performance. With this information, you can:

  • See regions where health checks are underperforming, and
  • take steps for ensuring that site response is fast and consistent regardless of where a request originates.

When you click the Latency section, the form controls are filled with defaults for Load Balancer and Pool, that you can change to suit your needs. Hovering over each pool on the map, represented by a colored dot, displays latency information for each origin associated with the pool. The meaning of each color is: 

  • Blue represents healthy.
  • Yellow means slow.
  • Red equals unhealthy.

Logs

Before the release of Load Balancing Analytics, Event Logs appeared as a feature under the Traffic Load Balancing tab.  This same feature now appears as the Logs section in Load Balancing Analytics.

Logs provide a history of all origin server status changes and how they affect your load balancing pools.  

When you click the Logs section, the time period defaults to the last week.  You can review up to 30 days of recorded events

You can also filter by Pool Health, Pool, Origin Health, and Origin.  Click on any entry in the events table, to see additional details.  You can also sort by any of the columns on the table.


Access load balancing analytics via the Cloudflare GraphQL Analytics API

The Cloudflare GraphQL Analytics API powers Load Balancing Analytics. Therefore, you can query load balancing metrics directly using GraphQL.

You can query for the number of requests seen by a load balancer’s pools across Cloudflare’s global network.  For example, you can issue the following query (every fifteen minutes during a full week):

{
  viewer {
    zones(filter: {zoneTag: "sample-zone-id"}){
         loadBalancingRequestsGroups( limit: 100, 
                                      filter: {	datetime_geq: "2019-11-26T00:00:00Z", 
                                                datetime_leq: "2019-11-26T03:00:00Z",
                                                lbName:"lb.example.com"}
          							  orderBy: [datetimeFifteenMinutes_DESC] ) {
          count
          dimensions {
            datetimeFifteenMinutes
            coloCode
            selectedPoolName
        }
      }
    }
  }
}
For the result, the image below shows a count of unique combinations (location and pool ID):

GraphQL example query using loadBalancingRequestsGroups

Note that this example uses the loadBalancingRequestsGroups schema, which returns aggregated results. 

You can use loadBalancingRequests for detailed information at the request level.  This is an example query using this other schema and a modified filter that specifies a data center (coloCode):

{
  viewer {
    zones(filter: {zoneTag: "sample-zone-id"}) {
         loadBalancingRequests( limit: 100, 
                                filter: { datetime_geq: "2019-11-26T00:00:00Z", 
                                          datetime_leq: "2019-11-26T03:00:00Z",
                                          lbName:"lb.example.com",
                                          coloCode: "SIN"}, 
                                orderBy: [datetime_DESC] ) {
        selectedPoolName
        pools {
          poolName
          healthy
          healthCheckEnabled
          avgRttMs
        }

      }
    }
  }
}

The image below shows the results, grouped by pools.

GraphQL example query using loadBalancingRequests

Visit the Cloudflare GraphQL Analytics API documentation portal to learn more.


Related resources

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk