Go Circuit: Distributing the Go Language and Runtime. Petar Maymounkov

Similar documents
Building Microservices with the 12 Factor App Pattern

Knit, Chisel, Hack: Crafting with Guile Scheme. Andy Wingo ~ wingolog.org

CSci Introduction to Distributed Systems. Communication: RPC

Debugging and Profiling

Remote Invocation. Today. Next time. l Indirect communication. l Request-reply, RPC, RMI

416 Distributed Systems. RPC Day 2 Jan 12, 2018

What are some common categories of system calls? What are common ways of structuring an OS? What are the principles behind OS design and

Embedded type method, overriding, Error handling, Full-fledged web framework, 208 Function defer, 31 panic, 32 recover, 32 33

for Multi-Services Gateways

Go Forth and Code. Jonathan Gertig. CSC 415: Programing Languages. Dr. Lyle

Using DC/OS for Continuous Delivery

The benefits and costs of writing a POSIX kernel in a high-level language

Knative: Building serverless platforms on top of Kubernetes

OS Virtualization. Linux Containers (LXC)

System support for adaptation and composition of applications

Introduzione a Go e RPC in Go

Erlang 101. Google Doc

Exam Questions. Give an example network topology where GPSR cannot find a way from a source to a sink. Explain your answer.

OpenShift Roadmap Enterprise Kubernetes for Developers. Clayton Coleman, Architect, OpenShift

416 Distributed Systems. RPC Day 2 Jan 11, 2017

Overview. This Lecture. Interrupts and exceptions Source: ULK ch 4, ELDD ch1, ch2 & ch4. COSC440 Lecture 3: Interrupts 1

Smashing Node.JS: JavaScript Everywhere

Implementing the Twelve-Factor App Methodology for Developing Cloud- Native Applications

Heroku. Rimantas Kybartas

Santiago Documentation

Lessons learnt building Kubernetes controllers. David Cheney - Heptio

You can also launch the instances on different machines by supplying IPv4 addresses and port numbers in the format :3410

Beyond 1001 Dedicated Data Service Instances

Building a Data-Friendly Platform for a Data- Driven Future

September 15th, Finagle + Java. A love story (

Best Practices for Developing & Deploying Java Applications with Docker

dbdeployer the future of MySQL sandboxes Giuseppe Maxia Software explorer

Oracle NoSQL Database 3.0

CMPSC 311- Introduction to Systems Programming Module: Systems Programming

Using Industry Standards to Exploit the Advantages and Resolve the Challenges of Multicore Technology

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams.

Making Cloud Easy: Components of a Distributed. Design Considerations and First. Operating System for Cloud

Agile CI/CD with Jenkins and/at ZeroStack. Kiran Bondalapati CTO, Co-Founder & Jenkins Admin ZeroStack, Inc. (

Chapter 4: Threads. Chapter 4: Threads

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

WHITE PAPER. RedHat OpenShift Container Platform. Benefits: Abstract. 1.1 Introduction

Leveraging the Serverless Architecture for Securing Linux Containers

Who is Docker and how he can help us? Heino Talvik

Systems I: Programming Abstractions

Kubernetes Integration with Virtuozzo Storage

OPERATING SYSTEM. Chapter 4: Threads

Erlang and Go (CS262a, Berkeley Fall 2016) Philipp Moritz

Exercise (could be a quiz) Solution. Concurrent Programming. Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - IV Threads

Go Cheat Sheet. Operators. Go in a Nutshell. Declarations. Basic Syntax. Hello World. Functions. Comparison. Arithmetic. Credits

Pontoon An Enterprise grade serverless framework using Kubernetes Kumar Gaurav, Director R&D, VMware Mageshwaran R, Staff Engineer R&D, VMware

TDDI04, K. Arvidsson, IDA, Linköpings universitet Operating System Structures. Operating System Structures Overview. Operating System Services

Lessons learnt building Kubernetes controllers. David Cheney - Heptio

Remote Invocation. To do. Request-reply, RPC, RMI. q Today q. q Next time: Indirect communication

Operating System. Operating System Overview. Structure of a Computer System. Structure of a Computer System. Structure of a Computer System

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

70-532: Developing Microsoft Azure Solutions

InterSystems Cloud Manager & Containers for InterSystems Technologies. Luca Ravazzolo Product Manager

" Qué me estás container?" Docker for dummies

Operating Systems. Lecture 4. Nachos Appetizer

CHAPTER 2: SYSTEM STRUCTURES. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Allowing Users to Run Services at the OLCF with Kubernetes

GFS: The Google File System

Problem Set: Processes

CSCC24 Functional Programming Scheme Part 2

Demystifying the Cloud With a Look at Hybrid Hosting and OpenStack

Introduction to pthreads

An introduction to Docker

go get my/vulnerabilities Green threads are not eco friendly threads

Rio-2 Hybrid Backup Server

Disclaimer This presentation may contain product features that are currently under development. This overview of new technology represents no commitme

Last class: Today: Thread Background. Thread Systems

unitrends.com MYTH VS. REALITY What you need to know about Microsoft Office 365 Backup

Operating Systems (2INC0) 2018/19. Introduction (01) Dr. Tanir Ozcelebi. Courtesy of Prof. Dr. Johan Lukkien. System Architecture and Networking Group

Application Centric Microservices Ken Owens, CTO Cisco Intercloud Services. Redhat Summit 2015

Multithreading and Interactive Programs

Container Adoption for NFV Challenges & Opportunities. Sriram Natarajan, T-Labs Silicon Valley Innovation Center

Running Databases in Containers.

Go for Java Developers

Serverless in the Java ecosystem

Merging Enterprise Applications with Docker* Container Technology

CMPE-655 Fall 2013 Assignment 2: Parallel Implementation of a Ray Tracer

Chapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads

Remote Procedure Call

Armon HASHICORP

CNA1699BU Running Docker on your Existing Infrastructure with vsphere Integrated Containers Martijn Baecke Patrick Daigle VMworld 2017 Content: Not fo

Pluggable Rule Engine Architecture

Achieving Horizontal Scalability. Alain Houf Sales Engineer

Remote Procedure Calls (RPC)

Logging, Monitoring, and Alerting

Go Tutorial. To do. A brief, gentle intro to Go. Next Networking. q Today

Chapter 4: Threads. Chapter 4: Threads. Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues

Chapter 2: Operating-System Structures

Distributed Systems. How do regular procedure calls work in programming languages? Problems with sockets RPC. Regular procedure calls

Object Interaction. Object Interaction. Introduction. Object Interaction vs. RPCs (2)

GFS: The Google File System. Dr. Yingwu Zhu

Professional Multicore Programming. Design and Implementation for C++ Developers

pblk the OCSSD FTL Linux FAST Summit 18 Javier González Copyright 2018 CNEX Labs

Four times Microservices: REST, Kubernetes, UI Integration, Async. Eberhard Fellow

Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Transcription:

Go Circuit: Distributing the Go Language and Runtime Petar Maymounkov p@gocircuit.org

Problem: DEV OPS isolation

App complexity vs manual involvement Distribute cloud apps How to describe complex deploy topologies Elastic apps Admin manual included? Yes. Not elastic then. Cognitive load grows Every app requires attention Job control Visibility into process ecosystem. Abstract map of available hosts. Provision negotiation Universal code format Write once, run on any cluster Provides for cluster-specific operations Adopt incrementally Co-habitable, minimal Don t solve any app problems Just abstract underlying capabilities

Too much humans in the stack. SaaS? APP NET MON APP OS HOST DPLY CFG FAIL BKP RPL OS HOST DPLY CFG FAIL BKP RPL Key operations (like re-shard, replicate, etc.) should be in the app if you want consistency and automation Generic apps cannot provision hosts or self-deploy remotely Frameworks usually suffer: Heavy-weight, cross-integration External technologies (Catch 22)

True division of responsibilities USER APP OPS ENG Networking Job execution Hardware negotiation & provision

Solution concept

Overview Universal distribution format = Go source Open source executables Control app exposure to libraries Easy source-to-source transform for instrumentation Tiny source footprint for hard apps OPS vs APP isolation OPS need not understand how app works (black box) OPS controls networking, execution, provisioning, failure response, etc. Elementary to deploy Compile entire solution into one smart binary Deploy sloppily App self-organizes at runtime

Minimal Single System Image (MSSI) APP APP Abstraction Stack Level SSI Interface Linux POSIX Binary OS HOST OS HOST OS HOST Goal: Abstract away and standardize capabilities/resources and behaviors (failures) of system. Not: Conceal failures, add scheduling, provide reliability, etc. The circuit is just a tool for building reliable systems efficiently and portably. OpenSSI, etc. monolithic Plan9 modular Erlang/OTP monolithic Go Circuit modular minimal POSIX File Protocol, 9P CSP Functional Language CSP Imperative Language OS Network Language Language

Concurrency inside, concurrency outside Non-CSP CSP PROCESS THREAD Comm Exec Protocols (DEV stack) Framework (OPS stack) Sync Libraries Thread Async Libraries Lang Lang Go Language * No cognitive switch * Imperative * Meaningful stack traces * Debug, trace UI unchanged Concurrent Sequentially-communicating Processes (CSP)

Solution stack MSSI Circuit Language Go Process Networking & Authentication Dial, Listen, Spawn,... DRIVER APP CIRCUIT TRANSLATOR RUNTIME DRIVER DRIVER OPS interacts only with CIRCUIT Debug, profile, trace, monitor,... OPS ENG OS OS OS HOST HOST HOST

Solution translates language thru net High-level Linguistic Communication APP APP APP package main import circuit circuit.spawn( Low-level Networking ops CIR DRIVER CIR DRIVER CIR DRIVER package circuit import drv/n import drv/job OS OS OS HOST HOST HOST

Example: Circuit + Docker = SSI Linux Legacy Linux binaries Within containers instrumented with consistent view of whole cluster MSSI Circuit Language Process Networking & Authentication Dial, Listen, Spawn,... P DRIVER P P APP DRIVER P CIRCUIT TRANSLATOR RUNTIME P DRIVER OPS ENG SSI Linux, POSIX, Plan9 OS OS OS HOST HOST HOST

Circuit Programming

Circuitizing a Go app and build Add circuit runtime to any legacy Go program package main import _ circuit/load func main() { } Build ~/gopath/src/app/cmd$ go build

Go + spawn = distributed Go Circuit Go slow.host HOST PROCESS WORKER slow.host GOROUTINE GOROUTINE

Spawn Run a function in this process Compute(arg) Run a function in a new process on a negotiated host Spawn( locus, []string{ /db/shard, /critical }, SpawnCompute{}, arg, ) Declare spawn-able functions type SpawnCompute struct{} func (SpawnCompute) Compute(arg Arg) { }

Anchor file system (side note) Global file system of live workers, arranged by the user $ 4ls /... / /critical /critical/r1a4124aa276f4a4e /db /db/shard /db/shard/r1a4124aa276f4a4e /db/shard/r8efd95a09bcde325 More on this later.

Spawn semantics Returns RETURN VALUES WORKER ADDRESS ERROR func Spawn( ) ([]interface{}, n.addr, error) Worker dies as soon as function exits... func (SpawnCompute) Compute(arg Arg) (r1, r2 ReturnType) { return } unless, we defer its death to the end of another goroutine. func (SpawnCompute) Compute(arg Arg) { ExitAfter(func() { return }) return }

Values vs cross-interfaces Communicate by value or cross-interface func Compute(int, Struct, *T, []byte, map[key]value, interface{}, X) type T struct { Cross X Value float64 } Create a cross-interface to a local receiver x := Ref(r) Use a cross-interface: call its methods reply = x.call( MethodName, arg1, arg2) // Returns []interface{}

Cross-worker garbage collection Cross-interfaces func (SpawnCompute) Compute(X) (X, error) { return Ref(v), nil } Permanent cross-interfaces func (SpawnCompute) Compute(XPerm) (XPerm, error) { return PermRef(v), nil } Spawn( host, nil, SpawnCompute{}, Ref(v), ) Spawn( host, nil, SpawnCompute{}, PermRef(v), )

Cross-call semantics Cross-calls are not RPC They return out-of-order, just like Go function calls do var x X // Cross-interface go func() { ch < x.call( Find, needle ) }() go func() { ch < x.call( Find, haystack ) }() < ch // Wait for whoever returns first

Error propagation Retain natural method signature func (s *Server) ServeHTML(url string) (string, error) { } Decouple application and system errors at call site var x X // x is a cross-interface to a remote *Server instance defer recover() // Catch system errors as panics result := x.call( ServerHTML, url) // Get app errors in return

Worker services Expose a cross-interface to a worker object Listen( ingest, r) Recall that spawn returns a worker address result, addr, err := Spawn() Dial a worker and obtain an exposed cross-interface x := Dial(addr, ingest )

Circuit Architecture

The circuit translates Go + Spawn import _ circuit/load CIRCUIT Network + Spawn Instructions type S struct { A float64 B []X } func (R) F(s *S, x X) (X, error) { return Ref(v), nil } defer recover() result := x.call( F, s1, y) Reflect on in/out types of F Recurse within composite types to find all cross-interface fields Read input arguments Check type safety Dial remote worker address Encode and send cross-call request Read response or error etc.

Modules decouple. Universal code. OPS USER CODE import ( use/circuit use/afs _ load/petar ) APP DEV load/petar use/circuit use/afs import ( _ sys/lang _ sys/zafs ) sys/lang sys/zafs import ( use/n use/afs ) func init() { afs.bind() } CIRCUIT DEV

Circuit Facilities

Anchor FS + cli tools = debug, profile, Global file system of live workers, arranged by the user $ 4ls /... / /critical /critical/r1a4124aa276f4a4e /db /db/shard /db/shard/r1a4124aa276f4a4e /db/shard/r8efd95a09bcde325 Kill $ 4kill /critical/... Profile for 30 sec $ 4cpu /critical/ 30 Stack traces $ 4ls /db/shard/ xargs 4stk Monitor worker vitals (mem, cpu, ) $ 4top /critical/

The end. Disclaimer. Talk describes soon-to-be-released R2. Skipped Teleport Transport. See github.com/petar/goteleport Twitter @gocircuit gocircuit.org

Appendix

Historical perspective on CSP systems Servers + Hierarchy of exported channels Workers + Crossinterfaces Cluster Level Plan9 Interfaces are more general than channels. Channels are interfaces with Send and Receive. Go Circuit Process Level Go Lang Goroutines + Channels