Archived video

This video is archived and won't be updated. We're keeping it online for now as a courtesy.

Alternate resources: 

The Pantheon Stack

Video loading...

  • 0:00
    Manage Drupal Sites with Pantheon The Pantheon Stack Addison Berry
  • 0:08
    So let's talk a little bit about what's under the hood
  • 0:11
    with Pantheon, and when you are working with your environments
  • 0:15
    and running your sites, what's actually happening underneath.
  • 0:20
    In this lesson, we're going to explain
  • 0:23
    what an Application Container is and why Pantheon is using them.
  • 0:27
    And we'll talk about the tools that you have in these containers.
  • 0:31
    And as part of that discussion, we'll also talk about how caching works
  • 0:34
    on Pantheon to make sure you get the fastest delivery you can.
  • 0:38
    So, Application Containers. So an Application Container is a lightweight virtual environment
  • 0:47
    that groups and isolates processes and resources like memory, CPU,
  • 0:53
    and sort of those hardware kinds of things together.
  • 0:56
    Now each container has a number of components that work together
  • 1:00
    to end up delivering your content. So each container is a separate environment,
  • 1:04
    which is both a security and a resource allocation problem with other things
  • 1:11
    like virtual machines. So you don't have to worry about somebody else
  • 1:15
    sucking all of your resources or doing something insecure and messing up
  • 1:19
    your site. And as I said, this is not a virtual machine. These run quite differently.
  • 1:25
    Virtual machines actually have a lot more overhead.
  • 1:27
    And containers are much faster and they're easier to manage.
  • 1:31
    So each container in Pantheon is assigned an internal TCP port
  • 1:36
    and IP address, but that ends up being completely transparent to end users.
  • 1:40
    That doesn't matter, because Pantheon has a service called Styx,
  • 1:44
    which is for routing. So when a request comes in, Styx looks at it
  • 1:48
    and figures out how to make sure that it gets to the right container
  • 1:52
    or the right environment. Every environment at Pantheon—
  • 1:55
    test, dev, live, whatever it is—is going to get at least one container.
  • 2:01
    So it's your isolated environment. Depending on your plan,
  • 2:05
    you could have multiple containers. And if that's the case, then Styx will balance requests
  • 2:10
    across containers and it will retry any failed requests and make sure
  • 2:15
    that the delivery actually ends up happening.
  • 2:19
    So what's so great about containers? So in contrast to say a VPS
  • 2:25
    or a virtual machine or something like that, a container
  • 2:28
    can be added, removed, or redistributed in seconds, not minutes or hours.
  • 2:34
    It's really super fast. Containers can be scaled per process,
  • 2:39
    so it's really easy to just sort of add a new process in there.
  • 2:42
    And they are also provisioned automatically. So it's not a manual process
  • 2:47
    and so the configuration is always in sync. It's always correct across all of them.
  • 2:50
    So you don't have to figure out why things are behaving differently
  • 2:54
    in this environment versus that environment.
  • 2:57
    Along with this flexibility comes high availability, meaning that if there's a problem
  • 3:04
    you can just spin up a new container. If you need to expand,
  • 3:08
    and all of a sudden—whoa!— you're getting way too much traffic
  • 3:10
    and the resources are getting strained, just spin up another container,
  • 3:13
    and it's going to be identical and easily be able to take the load.
  • 3:17
    And as I mentioned before, they're not limited like virtual machines.
  • 3:21
    Virtual machines have sort of much deeper roots than containers do,
  • 3:26
    and so they're just a lot faster and easier to manage.
  • 3:29
    So what is in your container that you get at Pantheon?
  • 3:34
    Well, every container has NGINX for the web server,
  • 3:38
    which is a super fast web server. You also have php with apc outcode caching.
  • 3:43
    And you also have its own Git clone of the code base.
  • 3:50
    So each container has a clone of the same code base.
  • 3:53
    And then finally there are a number of service bindings
  • 3:58
    that also exist to other additional services that you would need.
  • 4:02
    So Valhalla is the name of the Pantheon file system.
  • 4:05
    You also have MySQL databases, of course. You have redis caching
  • 4:09
    and other services like that. So your container has these basic pieces
  • 4:12
    for essentially running your website. And you also have these bindings
  • 4:17
    to all the other additional services that you would need.
  • 4:21
    So speaking of speed,
  • 4:24
    the routing system, the way that your requests are coming in
  • 4:30
    and getting to your container, include built-in caching.
  • 4:35
    And Pantheon uses Varnish. And it's a really wonderful cache tool.
  • 4:39
    It's an HTTP accelerator, so what Varnish does is it serves static content
  • 4:45
    and anonymous pages just super quickly, because you don't actually have to access
  • 4:50
    the container or your Drupal site in order to deliver the page to the browser
  • 4:55
    for somebody who's requesting it. So every single request is going to go through that cache.
  • 5:01
    So if the headers say "Cache this content," then it's going to just do that
  • 5:05
    instead of hitting your main resource behind that wall.
  • 5:08
    Now if the request is uncached—so when a request comes in,
  • 5:12
    Varnish doesn't actually have a copy of that— then it's going to go
  • 5:15
    all the way back to the container to grab that and then pass it.
  • 5:18
    So that's a theoretical kind of overview here. Let's actually see how this works
  • 5:25
    with a little bit of a diagram.
  • 5:27
    So here we have a browser, shown by the little globe here.
  • 5:31
    That's the browser request coming in from the web,
  • 5:34
    so going to HTTPS mysite.com
  • 5:38
    Now as that comes in to Pantheon, it's going to—if it's HTTPS it's SSL,
  • 5:43
    so it's going to need to go through SSL first and get decrypted.
  • 5:47
    Then once it does that, it's going to go to the cache
  • 5:52
    and Varnish is going to say, "I don't know what this is. I can't give it to you."
  • 5:56
    So it passes right through the cache and goes to the routing system,
  • 6:01
    which will then find an available container to do the work,
  • 6:05
    and then your Drupal site within that container is going to give the final response
  • 6:10
    that's required and send that back through the entire process. Right?
  • 6:14
    So it's going to go back. You get the response. It goes to the cache.
  • 6:17
    This time when it gets to the cache on the way out,
  • 6:19
    it's going to get cached by Varnish if it's set up to be able to do that
  • 6:24
    so that next time someone makes this request, it would be cached.
  • 6:27
    And then it goes back to SSL for encryption, and then it heads out
  • 6:31
    to somebody's browser, and they get to see your site.
  • 6:35
    Now for a cached request, it's super fast
  • 6:38
    and simple. Right? You have a web browser. I'm going to mysite.com.
  • 6:44
    If it's SSL it's going to get decrypted and then just hits the cache.
  • 6:47
    And Varnish is like, "Hey, I know exactly what page you're looking for.
  • 6:51
    I already have a copy of that. Boom, sending it right back to you."
  • 6:54
    It responds. You get that encrypted again, back to the browser.
  • 6:58
    And if you don't have SSL, then you just hit the cache and get a response.
  • 7:01
    It's super fast so you don't have to go through the rest of that process,
  • 7:04
    and importantly you don't have to make your Drupal site generate
  • 7:08
    that page for someone to look at.
  • 7:11
    So just to sum things up,
  • 7:16
    we took a look at what an Application Container is and why Pantheon is using them
  • 7:20
    and why they are better than virtual machine. We also took a quick look
  • 7:25
    at the basic tools that you have in a container and the fact that you have
  • 7:30
    a container per environment with those tools that are identical.
  • 7:33
    And then we took a look at how caching works on Pantheon
  • 7:36
    because they have that available and built in to every environment.
  • 7:40
    So the upshot of this is the technology that's underlying your Pantheon site
  • 7:47
    is designed to be very, very fast and efficient and quickly scalable.

The Pantheon Stack

Loading...

Pantheon's hosting stack, which underlies the whole system is optimized for running fast, stable, and scalable Drupal sites. In this tutorial we'll peek behind the curtain to see how Pantheon does what it does. We'll be introduced to the application container technology they use and review what software is running on your Pantheon environments, and get an overview of how caching works there.

Sponsored by Pantheon

Downloads: 
Log in or sign up to download companion files.
Additional resources: