Opinions / feedback wanted - Drupal, Varnish, Docker, & Kubernetes

10/2/2018

We're starting our move from D7 to D8, and are going to be using Docker and Kubernetes (with Jenkins) to manage and deploy our D8 environments.

Since with Docker and Kubernetes deploying as many identical nodes as you want / need is trivial, I'm looking for feedback re choosing the standard one-to-many design of Varnish and Drupal nodes (each Varnish node points at multiple Drupal backends), as opposed to a one-to-one design where each Varnish node points at a single Drupal backend.

We're leaning toward a one-to-one setup since with Kubernetes we could move the health check that Varnish would execute to test a backend as healthy to the Kubernetes layer, add another check in that layer to make sure Varnish itself is healthy, and if a pairing is marked as unhealthy Kubernetes will simply send the request to the next healthy pair.

I don't think this would result in any more pages being put in one Varnish node or another, since if it was one-to-many and a backend is sick Varnish will just try to get the page from the next healthy backend, but it still goes into the same Varnish cache.

In the case of a one-to-one setup, the testing of if something is "sick" simply moves from Varnish to Kubernetes, and since Varnish itself rarely goes down, this is an unlikely occurrence.

Roughed up proof of concept diagrams are attached.

I'd be very interested to see opinions / feedback on any potential disadvantages people can think of with the 1-to-1 design.

Thanks, Pablo

One-to-Many

One-to-One

-- Pablo Gosse
docker
drupal
kubernetes

1 Answer

10/2/2018

A couple of things I can think of:

  1. Having a 1-1 mapping will couple Varnish with your Drupal backend meaning if you won't be able to add or reduce capacity for Varnish or Drupal individually.

    It may be fine if you don't care about this, but what if you feel that you need to add more capacity to the caching layer, say you have a really heavy hitter request. You will have to double your capacity for Drupal too and that will incur in more costs.

  2. If you have some sort of sticky sessions you may run into a situation where a 1-1 mapping will serve a large percentage of the traffic leaving the other 1-1 mapping somehow idle or underutilized. In other words, it could lead you to have some unbalanced traffic.

-- Rico
Source: StackOverflow