Integrating Magento with Section's CDN for Performance Metrics

Magento loves Varnish Cache, and Magento 2 especially loves Varnish Cache.

Also, Magento developers love agile, and continuous integration. Section’s new model for Content Delivery Networks is the only CDN that supports continuous integration, one of the backbone technical processes that support high speed Magento development.

Section’s CDN facilitates this because we allow every developer to launch an instance of the CDN point of presence, or POP, directly on their own computer. This means you can work with Magento like you normally do, and when the time is right, test your Magento setup with the CDN in place for you commit your code to git.

Not only does Section give you the fastest feedback loop during the development cycle, but our belief that all things should be easy, open and controllable goes beyond our reverse proxies that run in the CDN point of presence. It extends into our real time CDN logs, real time CDN log analytics, and our real-time CDN metrics.

We have been working with our friends at Customer Paradigm to develop Magento CDN integration for CDN metrics. Today, I want to share with you how the open-source, DevOps friendly approach to Graphite metrics enables operational visibility for Magento teams.

Why?

Content Delivery Networks, especially those like Section that goes beyond static file caching into whole-site acceleration, are an important piece of a mission critical Magento implementation.

That said, CDN’s are very techie tools for developers and operations teams. Knowing that they are doing their job is critical, and development and operations teams need to work together to make that happen.

But there are other people that are interested in knowing that the CDN is working well, and they probably don’t want to be logging into a CDN console to check up on what’s going on.

So, we worked with Customer Paradigm to build a Magento Extension that brings the essential data, metrics and information into the Magento admin reports, so that everyone can understand that the CDN is working well.

Now, if you are in a development or operations role, you don’t need to spend any time explaining to a stakeholder that the CDN investment is living up to its duties. Those stakeholders can directly look in the Magento admin reports getting up-to-the-minute information on the CDN performance.

How?

Section provides unprecedented access to real-time CDN behaviour because we extensively log every HTTP request as it passes through our network. We leverage a bunch of tools to get that done, and the data arrives in a few places.

We provide all CDN logs into ElasticSearch, and ever site we run gets their own Dockerized Kibana container. This isn’t a topic for today, but if you’d like to know more you might be interested in learning about that here.

We also push all HTTP logs into statsd, and then into graphite. We love Etsy’s engineering principles, “if it moves, measure it”. As we do with Kibana, we also provide Dockerized graphite instances to all sites. We don’t just run Graphite and hide all the details from you, we provide direct HTTP access to the Graphite HTTP endpoints. This means you can consume graphite data in your own dashboards, continuous integration systems, and continuous delivery/deployment pipelines.

In order to show real time CDN metrics in the Magento admin, Customer Paradigm helped us to build a Magento Extension for Magento 2 that shows these Graphite charts directly in Magento.

Really, How?

Once the Magento Extension for CDN metrics is installed, Magento queries the Section API to determine what website you want to show CDN metrics for. Once Magento has that information, we are able to construct a clean URL that lets Magento query directly into Graphite.

Because we don’t want to make any Magento admin log into the Section Console to see the reports, Magento then proxies the images generated by Graphite and shows them to the user.

I don’t use Magento, but this is cool.

Of course, because Section is easy, open and controlled, you can use these techniques with any operations system you have in place. For example, if you have a Grafana instance that you use for operations dashboards, you can add your Graphite endpoint into your Grafana data sources. Then you can develop all the beautiful charts that you need for proper, real-time visibility into your CDN, without needing to reprocess laggy log files or dive into two operations consoles.

I want this, show me more.

We will be releasing the extension into the Magento Marketplace shortly. In the meantime, you can get going on Section.