Containers and Serverless Computing: Selecting the Right Platform for Your Application Phil Christensen Sr. Solutions Architect, DevOps Engineer
©2017 Logicworks. All rights reserved. About Logicworks and Me 2 Phil Christensen Sr. Solutions Architect Logicworks § 15+ years of experience in software engineering and cloud § Formerly Sr. DevOps Engineer § Hold all 5 AWS Certifications Logicworks designs, builds, automates, and manages AWS clouds. Cloud Migration 24/7 Management Cloud Automation Cloud Security
The standard deployment model for applications is changing rapidly.
Containers Serverless </> </> </> </> </> </> </> </> </>
©2017 Logicworks. All rights reserved. Let’s Build Reusable Artifacts! 5 § Decrease deployment time § Leverage the power of CI/CD § Every artifact created by a specific recipe or manifest § A common interface reduces operational complexity § The exact same artifact is run in local development, production, or any other part of the SDLC
©2017 Logicworks. All rights reserved. Why Containers? 6 Docker containers provide a packaging standard and a common interface for running, deploying, and managing workloads on compute instances. SERVER APP1 Host OS APP4 APP2 APP3 SERVER Host OS APP1 APP4 APP2 APP3 DockerAPP5 APP5
©2017 Logicworks. All rights reserved. § Container runs on top of your preferred workstation OS § Run with reduced memory or CPU usage in development § Finished image moved as-in to deployment server Local Development 7 The first benefit of a containerized development approach is the ability to deploy the exact same artifact to your server that was created in development. DEV WORKSTATION Host OS APP Docker SERVER Host OS Docker APP APP APP
©2017 Logicworks. All rights reserved. § Container image behaves the same on any host § Complex dependencies are only compiled or assembled at image build time § Safely encapsulate applications requiring older Linux distributions Container Portability 8 Container portability simplifies deployment process and reduces the likelihood of deployment failure QA Host OS APP Docker APP APP APP STAGING Host OS Docker APP APP APP PRODUCTION Host OS Docker APP APP APP APP APP
Container Orchestration
©2017 Logicworks. All rights reserved. Benefits § Already deployed with Docker § Simplest configuration, integrates with Docker- Compose Considerations § Limited cloud integration § Service discovery by DNS only § One ELB per cluster Option 1: Docker Swarm Orchestration Options 10
©2017 Logicworks. All rights reserved. Benefits § Most feature-filled orchestration layer § Large community support § Many deployment options § Powerful, built-in container discovery Considerations § Most complex install/configuration process § Difficult to stay up to date Option 2: Kubernetes Orchestration Options 11 Developer / Operator API Server Controller Manager Scheduler etcd Kubernetes Master Kubelet Kubernetes Node cAdvisor Kube-Proxy Pod Pod Pod Kubelet Kubernetes Node cAdvisor Kube-Proxy Pod Pod Pod Plugin Network (eg Flannel, Weavenet, etc) Users
©2017 Logicworks. All rights reserved. Benefits § Highest capacity for scale § Deeply integrated with AWS ecosystem Considerations § Amazon cloud-only deployment § Container discovery requires third- party applications like Consul Option 3: Amazon Elastic Container Service Orchestration Options 12
©2017 Logicworks. All rights reserved. Achieving High Availability 13 Docker Swarm Kubernetes AWS ECS Management Tier A 3-5 node manager tier responds to requests on a single ELB, delegates to N worker nodes § A 3-5 node master tier responds to API calls and web requests, delegates to N minion nodes. § Services can leverage individual ELBs directly, or define NodePorts that are routed through the master tier. § Control plane fully managed by AWS § ALB and ELB route traffic to appropriate containers Management Tier Failure Manager nodes must maintain a quorum, but a failed manager will continue to run services Master nodes must maintain a quorum, and a failed master tier will cause most services to fail No single point of failure in managed control plane. Worker Nodes Replaced? Lost worker nodes automatically replaced Lost minion nodes automatically replaced Worker nodes are easily added, replaced, or removed Updates Cluster can be upgraded in- place In-place cluster upgrades still maturing, 3rd-party distributions may differ Agent upgrades can be performed in- place
©2017 Logicworks. All rights reserved. Cluster Capacity 14 Docker Swarm Kubernetes AWS ECS Optimized For Optimized for multiple smaller clusters per SDLC Optimized for a single large cluster Optimized for one cluster per SDLC Load Balancing Load balancer limitations can arise with specific SSL or DNS requirements Namespaces help organize SDLCs, or delegate access to sets of containers. § Best-in breed container AutoScaling § Native ALB support Node Support Supports 2000+ nodes Supports up to 5000 nodes Supports up to 1000 nodes Container Limit Limited to 95,000 containers Limited to 300,000 containers Limited to 500,000 containers
©2017 Logicworks. All rights reserved. How Deployments Work 15 Docker Swarm Kubernetes AWS ECS Deployment Details § Simple docker CLI commands invoked on management node. § Uses Docker-Compose for configuration Limited support for secrets § Support for rolling updates § Largest number of deployment options § Kubectl CLI can be run from anywhere with access to master tier API § Native “Deployment” type provides robust interface for updates, secrets, and infrastructure management § Deepest integration with other AWS services like CodeBuild, ECR § Best-in-breed support for ALB Target Groups § Can be invoked via the AWS API § Support for Docker-Compose manifests AWS Resources Need to be Pre- Created? Yes No, will manage and create necessary AWS resources. Yes
©2017 Logicworks. All rights reserved. Example Container Pipeline 16 § Modify the source § Commit changes § Webhook triggers build § Pull source § Compile assets § Run tests § Build container § Push container § Private image repository § AM-based authentication § CloudWatch events trigger Lambda on push event § Lambda invokes Kubernetes API to publish Deployment § Native k8s deployment process allows for seamless updates
Serverless
©2017 Logicworks. All rights reserved. You are exchanging flexibility for scale. What is Serverless? 18
©2017 Logicworks. All rights reserved. § Quick start-up times § Shared compute pool § No need for orchestration – cloud provider handles it for you § You only pay for what you use § Deploy arbitrarily many development instances at little to no cost Why Serverless? 19 § Less flexibility around development techniques § Limited to supported frameworks (Sorry Ruby fans!) § Reduced access to native functionality (binding to custom C libraries) § Limits on function execution time Benefits Considerations
©2017 Logicworks. All rights reserved. § A typical server is up to 80% idle of most of the time § Traditional development instances either need to be parked, spun down, or deleted when not in use § For bigger workloads, there’s a break-even point where below a minimum throughput, you’re still better off writing Lambda functions § Focus on the memory and execution time that a typical transaction in your app will need Cost Effectiveness of Serverless 20 Exec Time @ Memory Used m4.large Break- Even Point Requests Per Second 100ms @ 128 MB 295,000 requests 81.9 200ms @ 512 MB 64,000 requests 17.8 200ms @ 1GB 34,000 requests 9.4 1 sec @ 1GB 7,100 requests 2.0 AWS Lambda Pricing in Context, by Andy Warzon @ trek10.com
©2017 Logicworks. All rights reserved. § Limited runtime to ensure one function doesn’t dominate over others behind the scenes § More complex workflow requires an understanding of asynchronous techniques § Step Functions used to aggregate multiple functions into a larger application Asynchronous 21 Find Instances Count Instances Iterator Iterate Instances Done Select Backup Type Create SnapshotCreate AmiEnd Start
©2017 Logicworks. All rights reserved. § Lambda is dramatically less expensive § It takes a great deal of compute volume before Lambda approaches EC2 costs § TCO is greatly reduced, little to no need to manage infrastructure Good Use Cases for Serverless 22 Periodic or Light Workloads API-Only Applications Long Running or Deeply Integrated AWS Scripts or Applications § Tight integration between API Gateway and Lambda allows for easy API creation § API Gateway helpers can provide authentication and other functions § Frequently used management scripts are best created as Lambda functions § Execution time limits encourage planning ahead for large resource counts </>API
©2017 Logicworks. All rights reserved. Lowest Common Denominator 23
©2017 Logicworks. All rights reserved. Autonomous IT 24 Serverless
©2017 Logicworks. All rights reserved. Most Efficient Scaling 25 Serverless
©2017 Logicworks. All rights reserved. Best Scale for Conventional Software 26 Amazon ECS
©2017 Logicworks. All rights reserved. Exchange Simplicity for Flexibility 27
©2017 Logicworks. All rights reserved. Standard Management Layer for Undifferentiated Compute 28
©2017 Logicworks. All rights reserved. § Train your IT staff § Give expert advice about the right DevOps tools for your application § Build a new AWS environment optimized for containers § Provide 24x7 support for AWS infrastructure Logicworks can help you: Come Talk to Me! 29 www.logicworks.com info@logicworks.com (212) 625-5300 § CONTACT US
155 Avenue of the Americas, Fifth Floor | New York, NY 10013 P:212.625.5300 | www.logicworks.com Questions?

Docker vs. Kubernetes vs. Serverless

  • 1.
    Containers and ServerlessComputing: Selecting the Right Platform for Your Application Phil Christensen Sr. Solutions Architect, DevOps Engineer
  • 2.
    ©2017 Logicworks. Allrights reserved. About Logicworks and Me 2 Phil Christensen Sr. Solutions Architect Logicworks § 15+ years of experience in software engineering and cloud § Formerly Sr. DevOps Engineer § Hold all 5 AWS Certifications Logicworks designs, builds, automates, and manages AWS clouds. Cloud Migration 24/7 Management Cloud Automation Cloud Security
  • 3.
    The standard deploymentmodel for applications is changing rapidly.
  • 4.
    Containers Serverless </> </></> </> </> </> </> </> </>
  • 5.
    ©2017 Logicworks. Allrights reserved. Let’s Build Reusable Artifacts! 5 § Decrease deployment time § Leverage the power of CI/CD § Every artifact created by a specific recipe or manifest § A common interface reduces operational complexity § The exact same artifact is run in local development, production, or any other part of the SDLC
  • 6.
    ©2017 Logicworks. Allrights reserved. Why Containers? 6 Docker containers provide a packaging standard and a common interface for running, deploying, and managing workloads on compute instances. SERVER APP1 Host OS APP4 APP2 APP3 SERVER Host OS APP1 APP4 APP2 APP3 DockerAPP5 APP5
  • 7.
    ©2017 Logicworks. Allrights reserved. § Container runs on top of your preferred workstation OS § Run with reduced memory or CPU usage in development § Finished image moved as-in to deployment server Local Development 7 The first benefit of a containerized development approach is the ability to deploy the exact same artifact to your server that was created in development. DEV WORKSTATION Host OS APP Docker SERVER Host OS Docker APP APP APP
  • 8.
    ©2017 Logicworks. Allrights reserved. § Container image behaves the same on any host § Complex dependencies are only compiled or assembled at image build time § Safely encapsulate applications requiring older Linux distributions Container Portability 8 Container portability simplifies deployment process and reduces the likelihood of deployment failure QA Host OS APP Docker APP APP APP STAGING Host OS Docker APP APP APP PRODUCTION Host OS Docker APP APP APP APP APP
  • 9.
  • 10.
    ©2017 Logicworks. Allrights reserved. Benefits § Already deployed with Docker § Simplest configuration, integrates with Docker- Compose Considerations § Limited cloud integration § Service discovery by DNS only § One ELB per cluster Option 1: Docker Swarm Orchestration Options 10
  • 11.
    ©2017 Logicworks. Allrights reserved. Benefits § Most feature-filled orchestration layer § Large community support § Many deployment options § Powerful, built-in container discovery Considerations § Most complex install/configuration process § Difficult to stay up to date Option 2: Kubernetes Orchestration Options 11 Developer / Operator API Server Controller Manager Scheduler etcd Kubernetes Master Kubelet Kubernetes Node cAdvisor Kube-Proxy Pod Pod Pod Kubelet Kubernetes Node cAdvisor Kube-Proxy Pod Pod Pod Plugin Network (eg Flannel, Weavenet, etc) Users
  • 12.
    ©2017 Logicworks. Allrights reserved. Benefits § Highest capacity for scale § Deeply integrated with AWS ecosystem Considerations § Amazon cloud-only deployment § Container discovery requires third- party applications like Consul Option 3: Amazon Elastic Container Service Orchestration Options 12
  • 13.
    ©2017 Logicworks. Allrights reserved. Achieving High Availability 13 Docker Swarm Kubernetes AWS ECS Management Tier A 3-5 node manager tier responds to requests on a single ELB, delegates to N worker nodes § A 3-5 node master tier responds to API calls and web requests, delegates to N minion nodes. § Services can leverage individual ELBs directly, or define NodePorts that are routed through the master tier. § Control plane fully managed by AWS § ALB and ELB route traffic to appropriate containers Management Tier Failure Manager nodes must maintain a quorum, but a failed manager will continue to run services Master nodes must maintain a quorum, and a failed master tier will cause most services to fail No single point of failure in managed control plane. Worker Nodes Replaced? Lost worker nodes automatically replaced Lost minion nodes automatically replaced Worker nodes are easily added, replaced, or removed Updates Cluster can be upgraded in- place In-place cluster upgrades still maturing, 3rd-party distributions may differ Agent upgrades can be performed in- place
  • 14.
    ©2017 Logicworks. Allrights reserved. Cluster Capacity 14 Docker Swarm Kubernetes AWS ECS Optimized For Optimized for multiple smaller clusters per SDLC Optimized for a single large cluster Optimized for one cluster per SDLC Load Balancing Load balancer limitations can arise with specific SSL or DNS requirements Namespaces help organize SDLCs, or delegate access to sets of containers. § Best-in breed container AutoScaling § Native ALB support Node Support Supports 2000+ nodes Supports up to 5000 nodes Supports up to 1000 nodes Container Limit Limited to 95,000 containers Limited to 300,000 containers Limited to 500,000 containers
  • 15.
    ©2017 Logicworks. Allrights reserved. How Deployments Work 15 Docker Swarm Kubernetes AWS ECS Deployment Details § Simple docker CLI commands invoked on management node. § Uses Docker-Compose for configuration Limited support for secrets § Support for rolling updates § Largest number of deployment options § Kubectl CLI can be run from anywhere with access to master tier API § Native “Deployment” type provides robust interface for updates, secrets, and infrastructure management § Deepest integration with other AWS services like CodeBuild, ECR § Best-in-breed support for ALB Target Groups § Can be invoked via the AWS API § Support for Docker-Compose manifests AWS Resources Need to be Pre- Created? Yes No, will manage and create necessary AWS resources. Yes
  • 16.
    ©2017 Logicworks. Allrights reserved. Example Container Pipeline 16 § Modify the source § Commit changes § Webhook triggers build § Pull source § Compile assets § Run tests § Build container § Push container § Private image repository § AM-based authentication § CloudWatch events trigger Lambda on push event § Lambda invokes Kubernetes API to publish Deployment § Native k8s deployment process allows for seamless updates
  • 17.
  • 18.
    ©2017 Logicworks. Allrights reserved. You are exchanging flexibility for scale. What is Serverless? 18
  • 19.
    ©2017 Logicworks. Allrights reserved. § Quick start-up times § Shared compute pool § No need for orchestration – cloud provider handles it for you § You only pay for what you use § Deploy arbitrarily many development instances at little to no cost Why Serverless? 19 § Less flexibility around development techniques § Limited to supported frameworks (Sorry Ruby fans!) § Reduced access to native functionality (binding to custom C libraries) § Limits on function execution time Benefits Considerations
  • 20.
    ©2017 Logicworks. Allrights reserved. § A typical server is up to 80% idle of most of the time § Traditional development instances either need to be parked, spun down, or deleted when not in use § For bigger workloads, there’s a break-even point where below a minimum throughput, you’re still better off writing Lambda functions § Focus on the memory and execution time that a typical transaction in your app will need Cost Effectiveness of Serverless 20 Exec Time @ Memory Used m4.large Break- Even Point Requests Per Second 100ms @ 128 MB 295,000 requests 81.9 200ms @ 512 MB 64,000 requests 17.8 200ms @ 1GB 34,000 requests 9.4 1 sec @ 1GB 7,100 requests 2.0 AWS Lambda Pricing in Context, by Andy Warzon @ trek10.com
  • 21.
    ©2017 Logicworks. Allrights reserved. § Limited runtime to ensure one function doesn’t dominate over others behind the scenes § More complex workflow requires an understanding of asynchronous techniques § Step Functions used to aggregate multiple functions into a larger application Asynchronous 21 Find Instances Count Instances Iterator Iterate Instances Done Select Backup Type Create SnapshotCreate AmiEnd Start
  • 22.
    ©2017 Logicworks. Allrights reserved. § Lambda is dramatically less expensive § It takes a great deal of compute volume before Lambda approaches EC2 costs § TCO is greatly reduced, little to no need to manage infrastructure Good Use Cases for Serverless 22 Periodic or Light Workloads API-Only Applications Long Running or Deeply Integrated AWS Scripts or Applications § Tight integration between API Gateway and Lambda allows for easy API creation § API Gateway helpers can provide authentication and other functions § Frequently used management scripts are best created as Lambda functions § Execution time limits encourage planning ahead for large resource counts </>API
  • 23.
    ©2017 Logicworks. Allrights reserved. Lowest Common Denominator 23
  • 24.
    ©2017 Logicworks. Allrights reserved. Autonomous IT 24 Serverless
  • 25.
    ©2017 Logicworks. Allrights reserved. Most Efficient Scaling 25 Serverless
  • 26.
    ©2017 Logicworks. Allrights reserved. Best Scale for Conventional Software 26 Amazon ECS
  • 27.
    ©2017 Logicworks. Allrights reserved. Exchange Simplicity for Flexibility 27
  • 28.
    ©2017 Logicworks. Allrights reserved. Standard Management Layer for Undifferentiated Compute 28
  • 29.
    ©2017 Logicworks. Allrights reserved. § Train your IT staff § Give expert advice about the right DevOps tools for your application § Build a new AWS environment optimized for containers § Provide 24x7 support for AWS infrastructure Logicworks can help you: Come Talk to Me! 29 www.logicworks.com info@logicworks.com (212) 625-5300 § CONTACT US
  • 30.
    155 Avenue ofthe Americas, Fifth Floor | New York, NY 10013 P:212.625.5300 | www.logicworks.com Questions?