Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Containers, Serverless and Functions in a nutshell

152 views

Published on

Presentation from OracleCode Boston 2018

Published in: Software
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Containers, Serverless and Functions in a nutshell

  1. 1. Containers, Serverless and Functions in a nutshell Eugene Fedorenko
  2. 2. About me Eugene Fedorenko Senior Architect Flexagon adfpractice-fedor.blogspot.com @fisbudo
  3. 3. Agenda •Containers •Microservices •Docker •Kubernetes •Container Native Development Platform •Serverless •Functions
  4. 4. Start
  5. 5. The Idea. DEV TEST PROD
  6. 6. The Idea. Virtual Machine
  7. 7. Container •A lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings. •Containers share the host operating system rather than the hardware directly •Way more lightweight than a VM •Docker is the most popular implementation
  8. 8. Multilayered Application
  9. 9. Microservices and Containers Loans Deposits Forex
  10. 10. Microservices • An architecture pattern decomposing vertically a monolith system into loosely coupled subsystems (microservices). Nothing more. The pattern doesn't dictate how it should be done technically. • Just to highlight it: Microservices and Containers are not the same and totally independent. You can use Docker with a monolith app, and you can have several micro- services without using Docker at all.
  11. 11. Architecture patterns. Evolution •Monolith – distributed horizontally on Prem/Cloud/Hybrid – containerized horizontally •Microservices – distributed vertically and horizontally on Prem/Cloud/Hybrid – containerized vertically and horizontally
  12. 12. Players (some of them) Cloud Native Computing Foundation Player Cloud Container oriented service Serverless Project Oracle Oracle Cloud • Oracle Container Cloud Service • Oracle Container Native Application Development Platform Fn Amazon AWS • Elastic Container Service (ECS) • Elastic Container Service for Kubernetes (EKS) AWS Lambda Microsoft AZURE • Azure Container Service (AKS) Azure Functions Google Google Cloud • Google Kubernetes Engine (GKE) Google Cloud Functions
  13. 13. Open Source Platforms and Projects • Docker – Container manager – Docker Hub – Docker Cloud • Kubernetes
  14. 14. Docker Container Manager
  15. 15. Docker vs VM
  16. 16. Docker Hub •Cloud based registry – Public (free) – Private •Centralized resource for container images – Repositories – Automated Builds (based on Dockerfile) •Docker CLI provides access to Docker Hub – docker search, pull, login, push
  17. 17. Docker Cloud •Built on top of Docker Hub •Builds, Tests and Deploys Images •Manages Infrastructure – Serves as a facade – Backed up by AWS, Azure, Digital Ocean, SoftLayer, Packet •Operated with docker-cloud CLI – API (Rest, Go, Python)
  18. 18. Agenda •Containers •Microservices •Docker •Kubernetes •Container Native Development Platform •Serverless •Functions
  19. 19. Kubernetes • Open Source platform (Google born) • Orchestration engine for Ops • A level of abstraction hiding the complexity of a hybrid environment (prem/cloud) • Configuration properties • Load balancing • Scalability • Security • Visibility
  20. 20. Kubernetes Architecture • Cluster. Set of physical or VMs. Masters and workers. • Node. Worker. Minion. A physical or virtual machine. Docker is installed on it. • Kubelet. Internal service running on each worker node and managed by a master node. Makes sure that everything works according to configuration files.
  21. 21. Kubernetes Architecture • Kubectl. Kubernetes CLI. • REST API. • Dashboard.
  22. 22. Kubernetes Architecture • Pod. Logical set of containers. A smallest deployable and scalable unit • Replica set. Defines how many instances of a pod should be alive
  23. 23. Kubernetes Architecture • Service. Logical set of pods with a stable ip/access rules and name. Has a lightweight internal load balancer. • Internal, External
  24. 24. Container Native Application Development Platform
  25. 25. Oracle Cloud Infrastructure
  26. 26. Container Native Application Development Platform
  27. 27. FlexDeploy Pipeline
  28. 28. • Location – Prem -> Cloud -> Hybrid • Platform – Host -> VM -> Container • Distribution – Client -> Client/Sever -> 3-tier -> multi tier • Composition – Program + Platform -> Container • Tendency – decompose into small, independent, self-running pieces-of-work distributed across the globe Architecture patterns. Evolution
  29. 29. • Functionality – Data driven -> Process Oriented Process Oriented Architecture
  30. 30. Serverless • A unit of work consumes resources only when it is used – Function is a unit of work • stateless • serves one goal • arguments (input) and result (output) • Orchestration of independent pieces of work (functions as a service FaaS) – Carrying state of the entire flow (program) – Error handling – Transaction management
  31. 31. Serverless • Code centric paradigm. Hyde Infrastructure. – Focus on coding resolving business problems and forget about infrastructure – Everything is working on some “computing resources” • Scalability – Developers don't do anything for scaling. Scaling is handled automatically. • Billing – Don't pay for idle time – Pay for milliseconds • Utilization – Many small pieces running for short time on same VM
  32. 32. Serverless “There is no such thing as serverless computing. However, there is such a thing as dedicated serverless computing.” Lucas Jellema. Oracle ACE Director. AMIS. CTO
  33. 33. Serverless Platforms • AWS Lambda • Azure Functions • OpenWhisk – Open Source / Apache • Fn – Open Source / Oracle – container native • OpenFaaS – Open Source / Alex Ellis – container native
  34. 34. Function (modern / Container-as-a-Function view) •Static self-running piece-of-work wrapped into a container with everything it needs for its work – code + platform – stateless – single purposed – arguments (input) and result (output)
  35. 35. AWS Lambda (old generation) • One of the first Function projects on the market – The idea is: – You have your code written with one of supported languages (limited list, binaries are preconfigured by AWS) – Your code exposes some standardized API – You upload your code (in a zip file) to AWS Lambda – Basing on event (e.g. request on URL) AWS Lambda allocates resources for your code, invokes a function and releases the resource at the end – The flow is orchestrated with AWS Step Functions – Visual Flow designer
  36. 36. Fn • Fn Platform (Fn Server and CLI) – Based on Docker – Functions are packaged into Docker images – A custom Docker image can be used as a function – A container lives as long as the function is being executed • Fn FDK – Libraries, annotations for standard input/output handling, configurations, ... – Polyglot. Supports a long list of languages (Java, Node.js, Python, Ruby, Go, ...) – Interaction with functions is based on Rest over HTTP or CLI • Fn Flow – Orchestration of function graph: state, transactions, exception handling – Based on Java SE 8 API CompletionStage – It's awesome! Like a good old Lisp. – UI Dashboard visualizing flow executions
  37. 37. Fn • Fn components are Docker containers • Requires only Docker engine • Can run on Kubernetes cluster
  38. 38. Function Flow Example •Build – Build Oracle Jet application – Build a Docker Image (Nginx + Jet application) – Push image to Docker Hub •Deploy – Accept image name and cluster name as parameters – Deploy image to K8s cluster
  39. 39. Build Function • “Builder” Docker image • GIT client • Node.js • Ojet CLI fn apps create ojetpipeline fn routes create ojetpipeline /build efedorenko/ojetbuilder:latest curl http://localhost:8080/r/ojetpipeline/build efedorenko/ojetbuilder efedorenko/jetapplicationDocker Hub Automated Builds
  40. 40. Deploy Function • “Deployer” Docker image • Kubectl • K8s credentials • K8s deployment profile (yaml) fn routes create ojetpipeline /deploy efedorenko/k8sdeployer:latest curl http://localhost:8080/r/ojetpipeline/deploy -d "google-cloud-k8s-dev efedorenko/jetapplication:latest" efedorenko/k8sdeployer efedorenko/jetapplication google-cloud-k8s-dev
  41. 41. Pipeline Function Flow public class PipelineFunction { public void pipeline(String cluster) { Flow fl = Flows.currentFlow(); FlowFuture<HttpResponse> pipeline = fl.invokeFunction("./build", HttpMethod.POST, Headers.emptyHeaders(), input.getBytes()) .thenApply(HttpResponse::getBodyAsBytes) .thenCompose((image) -> fl.invokeFunction("./deploy", HttpMethod.POST, Headers.emptyHeaders(), (cluster + " " + new String(image)).getBytes())) .exceptionally((err) -> { throw new RuntimeException("Pipeline error:" + err); }); } } fn deploy -app ojetpipeline curl http://localhost:8080/r/ojetpipeline/pipeline -d "google-cloud-k8s-dev"
  42. 42. Containers and Database • Does not make sense for enterprise systems in terms of DevOps – Data and PL/SQL code should be separated • Containers are good for upper layers of the system (middleware, UI) – Configuration properties are handled by the orchestration engine (Kubernetes, Docker swarms, etc.) • Database may work in containers for benefits such as scalability, maintenance, abstraction from infrastructure, etc. • Works perfectly for sample applications and test automation
  43. 43. Containers and SOA • Containers/Kubernetes/Functions easily resolve – Small loosely coupled services – Handling of invocation traffic – Process work flow • Focus on implementing services and don't think about composing them
  44. 44. Q&A

×