How Dictionary.com ensures users worldwide can access the words they need

Jeremy Lozano
Dictionary Engineering
4 min readJun 25, 2019

Co-Written by: Colin Fike

One of the not-so-secret ingredients to our infrastructure sauce

At Dictionary.com, we leverage a diverse technical tool set. Much like other organizations that serve a large worldwide audience at high frequency, we need to ensure that our content is always available and performant. In order to do so, we rely on a CDN (content delivery network) as the first layer of our infrastructure. This ensures that our content is readily available to our end users around the world.

What is a CDN?

A content delivery network is a geographically distributed network of proxy servers and their data centers. CDNs are a layer in the internet ecosystem with the goal to provide high availability and high performance by distributing the service spatially relative to end-users.

Why does this matter?

From an architecture and infrastructure standpoint, here’s a question to consider: Would it make sense to have your end users directly hit your web/application servers at a high frequency for content that will be infrequently changed?

A CDN will serve your content, with many configurable settings, to your end users by utilizing servers that are geographically located closer to them. By caching certain content, it mitigates the need for an end user to make the trip all the way to your application servers for content recently requested by another user. Some examples of this would be your homepage hero image or deterministic API results. Whenever the next 10, 100, 1,000, 10,000 geographically adjacent users visit that same content, it will be served by the CDN cache instead of taking a resource toll on your infrastructure.

What do we use?

Here at Dictionary.com, our team recently migrated to Fastly as our CDN and these are the functionalities that we leverage in order to support our end users all over the world!

Dashboards — Our team uses the Fastly dashboard frequently throughout the day. They are intuitive and offer a wide range of tools that make CDN management straightforward.

Real time metrics/monitoring — One very useful portion of the dashboard is the ability to monitor real-time metrics of traffic going to our properties. We’ve also configured real-time access logs to stream into tools like NewRelic and Kibana to empower our team to triage and reconcile events across our infrastructure.

Fast purging — Fastly provides straightforward near instant purging capabilities, whether it’s for a specific URL, tagged content (using surrogate keys), or all content.

Granular and deterministic control — We leverage the combination of VCL (Varnish Configuration Language — https://docs.fastly.com/vcl/) and Terraform. Terraform allows us to configure our Fastly infrastructure with code and VCL provides us visibility and granular control over a request as it passes through Fastly nodes.

Having control over your CDN logic via VCL is definitely a big favorite on the engineering team. What you see is what you get, you can follow a request deterministically through your logic and understand exactly what would happen in the wild. We can easily set caching rules based on path and headers, redirect requests that are non-https and non-www, set up ACLs, and return HTML in a synthetic response. We have yet to run into something we needed to implement that we could not implement in VCL.

Easy Deploys and Rollbacks — Deployment is an important aspect of any part of an infrastructure. Activating a new configuration or rolling back to an old version has been both quick and easy to do. If something goes sideways, a rollback is only a click or two away. While we do everything we can to ensure our production configurations are tested and ready to go, the ability to act quickly with our configuration updates gives us a lot of confidence when making updates.

Terraform — We also make use of Terraform in our CI/CD pipeline. Terraform allows us to worry about our CDN logic and behavior without having to worry about how to get changes from our editors into Fastly. Terraform allows us to define our domains, logging endpoints, backends, health checks, VCL, and more on a per service basis. The Fastly Terraform provider will then interface with the Fastly API to make all the changes to our services without having to use the UI or make an API interface ourselves.

Terraform will also track the state of all the current services and provide us with a diff of what services will be changing and what is changing in each service whenever we apply a Terraform plan.

Recap

A CDN can be a very simple but powerful tool to help scale most web infrastructures. Depending on your team’s infrastructure, many CDNs are flexible to accommodate straightforward all the way to complex configurations. Take it from Dictionary.com engineering that it has saved our rear ends on multiple occasions.

--

--