the why of go v2€¦ · concurrency c++ at google c10k epoll (linux) kqueue (bsd) seda java nio p4...

154
The Why of Go v2 Brave New World Edition GOTO Copenhagen 2018 @carmatrocity Carmen Andoh

Upload: others

Post on 08-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

The Why of Go v2Brave New World Edition

GOTO Copenhagen 2018

@carmatrocityCarmen Andoh

Page 2: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 3: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

“Imagine you are a software engineer from the year 1983 who happened upon a time machine and traveled to today.”

(80s Dolorian time machines are the raddest time machines)

Page 4: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Genealogy of Programming Languages 1956-1983

You are here

Page 5: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Genealogy of Programming

Languages1956-2015

Page 6: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

You are here

Page 7: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 8: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Genealogy of Programming

Languages1956-2015

Page 9: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 10: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 11: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 12: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 13: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

GNU GNU’s Not Unix Project

Started in 1983

Page 14: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 15: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 16: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 17: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 18: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 19: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 20: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

● too simple / lack of syntactic sugar● no generics● bad dependency management● stuck in 70/80's ● error handling

● no unused imports● too opinionated● too verbose● no ternary operator● no macros or

templates

https://github.com/ksimka/go-is-not-good

Criticisms of Go

Page 21: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 22: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 23: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

“Go programming language was conceived as an answer to some of the problems we were seeing developing software infrastructure at Google. The computing landscape today is almost unrelated to the environment in which the languages being used, mostly C++, Java, and Python, had been created. The problems introduced by multicore processors, networked systems, massive computation clusters, and the web programming model were being worked around rather than addressed head-on.

Page 24: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

“Go programming language was conceived as an answer to some of the problems we were seeing developing software infrastructure at Google. The computing landscape today is almost unrelated to the environment in which the languages being used, mostly C++, Java, and Python, had been created. The problems introduced by multicore processors, networked systems, massive computation clusters, and the web programming model were being worked around rather than addressed head-on.

Page 25: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

“Go programming language was conceived as an answer to some of the problems we were seeing developing software infrastructure at Google. The computing landscape today is almost unrelated to the environment in which the languages being used, mostly C++, Java, and Python, had been created. The problems introduced by multicore processors, networked systems, massive computation clusters, and the web programming model were being worked around rather than addressed head-on.

Page 26: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

“Go programming language was conceived as an answer to some of the problems we were seeing developing software infrastructure at Google. The computing landscape today is almost unrelated to the environment in which the languages being used, mostly C++, Java, and Python, had been created. The problems introduced by multicore processors, networked systems, massive computation clusters, and the web programming model were being worked around rather than addressed head-on.

Page 27: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

“Go programming language was conceived as an answer to some of the problems we were seeing developing software infrastructure at Google. The computing landscape today is almost unrelated to the environment in which the languages being used, mostly C++, Java, and Python, had been created. The problems introduced by multicore processors, networked systems, massive computation clusters, and the web programming model were being worked around rather than addressed head-on.

Page 28: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Moreover, the scale has changed: today’s server programs comprise tens of millions of lines of code, are worked on by hundreds or even thousands of programmers, and are updated literally every day. To make matters worse, build time have stretched to many minutes, even hours, even languages,on large compilation clusters,”

Page 29: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Moreover, the scale has changed: today’s server programs comprise tens of millions of lines of code, are worked on by hundreds or even thousands of programmers, and are updated literally every day. To make matters worse, build time has stretched to many minutes, even hours, on large compilation clusters”

Page 30: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Moreover, the scale has changed: today’s server programs comprise tens of millions of lines of code, are worked on by hundreds or even thousands of programmers, and are updated literally every day. To make matters worse, build time has stretched to many minutes, even hours, on large compilation clusters”

Page 31: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

● multicore processors● networked systems● massive computation

clusters● web programming model

● hundreds or even thousands of programmers

● large compilation clusters

Page 32: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Go

Page 33: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges Go

Page 34: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Go

Page 35: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Page 36: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 37: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Hard

ware

&

Com

pute

Softw

are |

La

ngua

ges

Conte

xt

20182000 2005 201090s80s

Go

UTF-8

Unix (60s)

C (68-73)

Robert Griesemer, Rob Pike, Ken Thompson

Plan 9

Page 38: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 39: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 40: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Hard

ware

&

Com

pute

Softw

are |

La

ngua

ges

Conte

xt

20182000 2005 201090s80s

Go

UTF-8

Unix (60s)

C (68-73)

Plan 9 OS

Hotspot JVM

Robert Griesemer, Rob Pike, Ken Thompson

Page 41: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 42: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

● Concurrency ● Distributed Systems ● Garbage Collection● Memory and Data Locality ● Readability● Simplicity

Go’s 21st Century “5th Gen” Characteristics

Page 43: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Concurrency Why Massive Concurrency?

Why goroutines (green threads) ?

Page 44: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

Page 45: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Page 46: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

Page 47: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

Python Twisted

Page 48: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Python Twisted

Page 49: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Python Twisted

Her Sutter “The Free Lunch is Over

Page 50: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 51: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Hard

ware

&

Com

pute

Softw

are |

La

ngua

ges

Conte

xt

20182000 2005 201090s80s

Go

Page 52: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Python Twisted

Her Sutter “The Free Lunch is Over

Page 53: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

Python Twisted

Her Sutter “The Free Lunch is Over

Page 54: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Hard

ware

&

Com

pute

Softw

are |

La

ngua

ges

Conte

xt

20182000 2005 201090s80s

Go

Page 55: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Hard

ware

&

Com

pute

Softw

are |

La

ngua

ges

Conte

xt

20182000 2005 201090s80s

Go

Page 56: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Predictions for the end of Moore’s Law

Page 57: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

Python Twisted

Her Sutter “The Free Lunch is Over

Concurrent SE: Preparing for Paradigm Shift

Page 58: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978) Concurrent SE: Preparing

for Paradigm Shift

Page 59: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

1

Why build concurrency on the ideas of CSP?Concurrency and multi-threaded programming have over time developed a reputation for difficulty. [...]One of the most successful models for providing high-level linguistic support for concurrency comes from Hoare’s Communicating Sequential Processes, or CSP. Occam and Erlang are two well known languages that stem from CSP. Go’s concurrency primitives derive from a different part of the family tree whose main contribution is the powerful notion of channels as first class objects. Experience with several earlier languages has shown that the CSP model fits well into a procedural language framework.

Page 60: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

Python Twisted

Her Sutter “The Free Lunch is Over

CSP Concurrent SE: Preparing for Paradigm Shift

Page 61: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

Python Twisted

Her Sutter “The Free Lunch is Over

CSP Concurrent SE: Preparing for Paradigm Shift

Page 62: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Events, Threads and Goroutines

Nginx - event loop plus state machine model

Page 63: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Events, Threads and Goroutines

Nginx - event loop plus state machine model

App logic

Page 64: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Events, Threads and Goroutines

Nginx - event loop plus state machine model

App logic

Page 65: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Events, Threads and Goroutines

Nginx - event loop plus state machine model

App

Page 66: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Events, Threads and Goroutines

Nginx - event loop plus state machine model

App

Page 67: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Events, Threads and Goroutines

Nginx - event loop plus state machine model

App

Page 68: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Events, Threads and Goroutines

Nginx - event loop plus state machine model

App

Page 69: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Events, Threads and Goroutines

Nginx - event loop plus state machine model

App

Page 70: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Events, Threads and Goroutines

Nginx - event loop plus state machine model

App

Page 71: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Concurrent SE: Preparing for Paradigm Shift

Page 72: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Concurrent SE: Preparing for Paradigm Shift

Page 73: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Concurrent SE: Preparing for Paradigm Shift

Page 74: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 75: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Concurrent SE: Preparing for Paradigm Shift

Page 76: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

Concurrency

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Java Serverlet Model

Concurrent SE: Preparing for Paradigm Shift

Page 77: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 78: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 79: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 80: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 81: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 82: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

App

Page 83: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

App

= Threads

Page 84: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 85: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 86: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 87: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

CONCURRENCY - Conclusions

● goroutines are a success: give you the same expressiveness of a traditional imperative programming language while hiding the event driven nature of their interactions with the outside world from the programmer.

● when goroutines do need to coordinate, they do so in user space, rather than being forced to use expensive kernel interactions.

Page 88: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Java Serverlet Model

The rise of containers + cloud-native+ ecosystemMicroservicesserverless

Distributed Systems Concurrent SE: Preparing for Paradigm Shift

Page 89: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Java Serverlet Model

The rise of containers + cloud-native+ ecosystemMicroservicesserverless

Garbage Collection Concurrent SE: Preparing for Paradigm Shift

Page 90: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Java Serverlet Model

The rise of containers + cloud-native+ ecosystemMicroservicesserverless

Garbage Collection Concurrent SE: Preparing for Paradigm Shift

Page 91: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Java Serverlet Model

The rise of containers + cloud-native+ ecosystemMicroservicesserverless

Memory Locality Concurrent SE: Preparing for Paradigm Shift

Page 92: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Java Serverlet Model

The rise of containers + cloud-native+ ecosystemMicroservicesserverless

Memory Locality Concurrent SE: Preparing for Paradigm Shift

Hotspot JVM

Page 93: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory & Data Locality

Page 94: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory & Data Locality

Page 95: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory & Data Locality

Page 96: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory & Data Locality

Page 97: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Java Serverlet Model

The rise of containers + cloud-native+ ecosystemMicroservicesserverless

Memory Locality Concurrent SE: Preparing for Paradigm Shift

Hotspot JVM

Page 98: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory Locality

Java

Page 99: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory Locality

Java

No value types

Everything Allocated

Page 100: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory Locality

Java

No value types

Everything Allocated

Go

Page 101: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory Locality

Java

No value types

Everything Allocated

Go

Structs

True Value types

Page 102: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory Locality

Java

No value types

Everything Allocated

Can’t return multiple values (until 2018)

Go

Structs

True Value types

Page 103: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Java Serverlet Model

The rise of containers + cloud-native+ ecosystemMicroservicesserverless

Memory Locality Concurrent SE: Preparing for Paradigm Shift

Hotspot JVM

Page 104: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

When the three of us [Ken Thompson, Rob Pike, and Robert Griesemer] got started, it was pure research. The three of us got together and decided that we hated C++. [laughter] ... [Returning to Go,] we started off with the idea that all three of us had to be talked into every feature in the language, so there was no extraneous garbage put into the language for any reason.

Page 105: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory Locality

Java

No value types

Everything Allocated

Can’t return multiple values

Go

Structs

True Value types

Page 106: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory Locality

Java

No value types

Everything Allocated

Can’t return multiple values

Go

Structs

True Value types

compact object layout

No object headers

Page 107: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory Locality

Java

No value types

Everything Allocated

Can’t return multiple values

Go

Structs

True Value types

compact object layout

No object headers

Page 108: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory Locality

Java

No value types

Everything Allocated

Can’t return multiple values

Go

StructsTrue Value typesCompact object layoutNo object headersLazy initialization of collections

UTF-8UTF-16

Page 109: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory and Data Locality (conclusion)

Page 110: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory Locality (conclusion)

● Go gives programmers the tools to talk about memory efficiently if they need it.

Page 111: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory Locality (conclusion)

● Go gives programmers the tools to talk about memory efficiently if they need it.

● Flexible

Page 112: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Memory Locality (conclusion)

● Go gives programmers the tools to talk about memory efficiently if they need it.

● Flexible● Memory management (not an all-or-nothing like in C++ or

Rust)

Page 113: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

Readability is paramount — Rob Pike

Page 114: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

“ Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. ” — Brian Kernighan

Page 115: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Java Serverlet Model

The rise of containers + cloud-native+ ecosystemMicroservicesserverless

ReadabilityConcurrent SE: Preparing for Paradigm Shift

Hotspot JVM

# of google employees in 2007: 16,805

Page 116: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20172000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Java Serverlet Model

The rise of containers + cloud-native+ ecosystemMicroservicesserverless

Readability Concurrent SE: Preparing for Paradigm Shift

Hotspot JVM

# of google employees in 2010: 24440

Page 117: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Java Serverlet Model

Readability Concurrent SE: Preparing for Paradigm Shift

Hotspot JVM

# of google employees in 2018:

~93,500

Page 118: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

simplicity

Page 119: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

simplicity

“simple is better”

Page 120: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

simplicity

“simple is better” “this is an insult to intelligent programmers”

Page 121: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

simplicity

“simple is better”

“you’re trying to commodify programming and create a situation where our bosses can replace us at will”

Page 122: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

“You’re not paid to program, you’re not even paid to maintain someone else’s program, you’re paid to deliver solutions to the business.”

- Dave Cheney

Page 123: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

Programs which cannot be maintained will be rewritten

Page 124: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

Programs which cannot be maintained will be rewritten

“If you can’t be replaced, you cannot be promoted”

Page 125: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

Her Sutter “The Free Lunch is Over

CSP (1978)

Java Serverlet Model

Readability Concurrent SE: Preparing for Paradigm Shift

Hotspot JVM

# of google employees in 2018:

~93,500

Page 126: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

CSP (1978)

Java Serverlet Model

Readability

Hotspot JVM

# of google employees in 2018:

~93,500

Average length of stay at $COMPANY

Page 127: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

CSP (1978)

Java Serverlet Model

Readability

Hotspot JVM

# of google employees in 2018:

~93,500

Average length of stay at $COMPANY

Page 128: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

CSP (1978)

Java Serverlet Model

Readability

Hotspot JVM

# of google employees in 2018:

~93,500

Average length of stay at $COMPANY

Page 129: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 130: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 131: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

N+1 different opinions on what makes readability.

Familiarity - Go’s small language footprint (25 keywords)

Page 132: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

Familiarity - Go’s small language footprint (25 keywords)

Ingroup knowledge

Page 133: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

Familiarity - Go’s small language footprint (25 keywords)

Ingroup knowledge

Learners perspectives - First time seeing code

No “magic” - easy vs. Simple

Page 134: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

Familiarity - Go’s small language footprint (25 keywords)

Ingroup knowledge

Learners perspectives - First time seeing code

No “magic” - easy vs. Simple

HTML w3org: 3.2. Priority of Constituencies: User > Author > Implementor

Page 135: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

Personal Convenience.

Convention over Configuration

Page 136: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

Personal Convenience.

Convention over Configuration

Page 137: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Readability

Personal Convenience.

Convention over Configuration

Page 138: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Simplicity

Page 139: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Software Engineering

Software Engineering vs Programming

Page 140: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Software Engineering

Software Engineering vs Programming

Software Engineering = Programming integrated over time.

Page 141: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Software Engineering

Software Engineering vs Programming

Software Engineering = Programming integrated over time.

Engineering is what happens when things need to live longer and influence of time starts creeping in. -Titus Winters

Page 142: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Software Engineering

Software Engineering vs Programming

Software Engineering = Programming integrated over time.

Engineering is what happens when things need to live longer and influence of time starts creeping in. -Titus Winters

All this complexity is fundamentally a different flavor than programming.

Page 143: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Software Engineering

focus on sustaining engineering (readability)

Page 144: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Software Engineering

TIME TRAVELING EVERYWHERE

CI

Unit Tests

Refactoring

Design Patterns

Dependency Management

Page 145: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Software Engineering

focus on sustaining engineering (readability)

continuance of many different engineers over a long period of time

clear module boundaries

keeping import dependencies between packages linear, thus keeping compile times down.

Page 146: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Simplicity and the Greater Good

Page 147: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free
Page 148: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

“Simplicity is a great virtue but it requires hard work to achieve it and education to appreciate it. And to make matters worse: complexity sells better.”

― Edsger W. Dijkstra

Page 149: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

The Future

Page 150: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

20182000 2005 201090s80s

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

Go

C++ at Google

C10K

Epoll (linux)

Kqueue (BSD)

SEDA

Java NIO

P4 Core 2

Ruby Mongrel

Gunicorn (Python)

NodeJS

Python Twisted

CSP (1978)

Java Serverlet Model

Readability

Hotspot JVM

# of google employees in 2018:

~93,500

Average length of stay at $COMPANY

Page 151: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

20402025 2030 20352017 2020

The Future?

The problems we have today were not there 20 years ago, nor will be problems we face 20 years from now.

Page 152: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

20402015 2020 20252003 2010

The Future?

FuschiaOS

Serverless/FaaS

AI/MLonCodeTersorflow

Kubernetes

“Big Data”

Page 153: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Softw

are |

La

ngua

ges

Hard

ware

&

Com

pute

Conte

xt

20402025 2030 20352017 2020

The Future?

...hang on for the ride

Page 154: The Why of Go v2€¦ · Concurrency C++ at Google C10K Epoll (linux) Kqueue (BSD) SEDA Java NIO P4 Core 2 Ruby Mongrel Gunicorn (Python) NodeJS Python Twisted Her Sutter “The Free

Thank you!

Carmen Andoh @carmatrocityGOTO Copenhagen

November 2018