SlideShare une entreprise Scribd logo
1  sur  37
Our Concurrent Past;
Our Distributed Future
Joe Duffy
Co-founder/CEO Pulumi
InfoQ.com: News & Community Site
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations
/concurrency-distributed-computing
• Over 1,000,000 software developers, architects and CTOs read the site world-
wide every month
• 250,000 senior developers subscribe to our weekly newsletter
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• 2 dedicated podcast channels: The InfoQ Podcast, with a focus on
Architecture and The Engineering Culture Podcast, with a focus on building
• 96 deep dives on innovative topics packed as downloadable emags and
minibooks
• Over 40 new content items per week
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Presented at QCon London
www.qconlondon.com
The world is concurrent
File and network I/O.
Servers with many users.
Multicore.
Mobile devices.
GPUs.
Clouds of machines.
All of which communicate with one another.
2
Distributed is concurrent
Concurrency: two or more things happening at once.
Parallelism is a form of concurrency: multiple workers execute
concurrently, with the goal of getting a “single” job done faster.
So too is distributed: workers simply run further apart from one another:
Different processes. Different machines.
Different racks, data centers. Different planets.
Different distances implies different assumptions/capabilities.
3
Long lost brothers
Concurrency and distributed programming share deep roots in early CS.
Many of the early pioneers of our industry -- Knuth, Lampson, Lamport,
Hoare -- cut their teeth on distributed programming.
Concurrency and parallelism broke into the mainstream first.
Now, thanks to mobile + cloud, distributed will overtake them.
By revisiting those early roots, and reflecting on concurrency, we can learn
a lot about what the future of distributed programming holds for us.
4
How we got here
5
First there was “distributed”
Early OS work modeled concurrency as distributed agents.
Dijkstra semaphores (1962).
Hoare CSPs (1977).
Lamport time clocks (1978).
Butler Lampson on system design (1983).
Even I/O devices were thought to be distributed;
asynchronous with respect to the program, and
they did not share an address space.
6
Modern concurrency roots
Many abstractions core to our concurrent systems were invented
alongside those distributed programming concepts.
Hoare and Hansen monitors (1974).
From semaphores to mutual exclusion: Dijkstra/Dekker (1965),
Lamport (1974), Peterson (1981).
Multithreading (Lamport 1979).
Most of the pioneers of concurrency are also the pioneers of distributed.
7
Beyond synchronization: communication
Furthering the distributed bent was focus on communication. Modern
synchronization is a special case that (ab)uses shared memory space.
Message passing: communication is done by sending messages.
CSPs and Actors: independent processes and state machines.
Futures and Promises: dataflow-based asynchronous communication.
Memory interconnects are just a form of hardware message passing.
The focus on structured communication was lost along the way, but is
now coming back (Akka, Thrift, Go CSPs, gRPC, …).
8
The parallel 80’s
Explosion of research into parallelism, largely driven by AI research.
The Connection Machine: up to 65,536 processors.
From this was born a “supercomputing” culture that persists to this day.
9
Parallel programming
Substantial focus on programmability.
Task parallelism: computation drives parallel division.
Data parallelism: data drives parallel division (scales with data).
Eventually, scheduling algorithms.
Work stealing (Cilk).
Nested parallelism (Cilk, NESL).
10
Parallel programming (Ex1. Connection Machine)
Programming 65,536 processors is different!
Every processor is a ~CSP.
11
(DEFUN PATH-LENGTH (A B G)
α(SETF (LABEL •G) +INF)
(SETF (LABEL A) 0)
(LOOP UNTIL (< (LABEL B) +INF)
DO α(SETF (LABEL •(REMOVE A G))
(1+ (βMIN α(LABEL •(NEIGHBORS •G))))))
(LABEL B))
Parallel programming (Ex2. Cilk)
Bringing parallelism to imperative C-like languages.
Foreshadows modern data parallel, including GPGPU and MapReduce.
12
// Task parallel:
cilk int fib(int n) {
if (n < 2) { return n; }
else {
int x = spawn fib(n - 1);
int y = spawn fib(n - 2);
sync;
return x + y;
}
}
// Data parallel:
cilk_for (int i = 0; i < n; i++) {
a[i] = f(a[i]);
}
cilk::reducer_opadd<int> result(0);
cilk_for (int i = 0; i < n; i++) {
result += foo(i);
}
Parallel programming (Ex3. OpenMP)
Eventual mainstream language adoption of these ideas (1997).
Notice similarity to Cilk; set the stage for the future (Java, .NET, CUDA, ...).
13
// Task parallel:
cilk int fib(int n) {
if (n < 2) { return n; }
else {
#pragma omp task shared(n)
int x = spawn fib(n - 1);
#pragma omp task shared(n)
int y = spawn fib(n - 2);
#pragma omp taskwait
return x + y;
}
}
// Data parallel:
#pragma omp parallel for
for (int i = 0; i < n; i++) {
a[i] = f(a[i]);
}
#pragma omp for reduction(+: result)
for (int i = 0; i < n; i++) {
result += foo(i);
}
Enter multi-core
14
Copyright © 2017 ACM
15
Moore’s Law: what happened?
Clock speed doubled every ~18mos until 2005:
“The complexity for minimum component costs has increased at a rate of roughly a factor of two per year. Certainly
over the short term this rate can be expected to continue, if not to increase. Over the longer term, ... there is no reason
to believe it will not remain nearly constant for at least 10 years.”
-- Gordon Moore, 1965
"It can't continue forever. The nature of exponentials is that you push them out and eventually disaster happens.”
-- Gordon Moore, 2005
Power wall: higher frequency requires quadratic voltage/power increase,
yielding greater leakage and inability to cool, requires new innovation.
Result: you don’t get faster processors, you just get more of them.
16
Moore’s Law: stuttering
17
The renaissance: we must program all those cores!
The 2000’s was the concurrent programming renaissance.
Java, .NET, C++ went from threads, thread pools, locks, and events
to tasks, work stealing, and structured concurrency.
GPGPU became a thing, fueled by CUDA and architecture co-design.
Borrowed the best, easiest to program, ideas from academia. These
building blocks now used as the foundation for asynchrony.
Somehow lost focus on CSPs, Actors, etc.; Erlang and Go got this right.
18
Modest progress on safety
Recognition of the importance of immutable data structures.
Short-lived industry-wide infatuation with software transactional memory.
Some success stories: Haskell, Clojure, Intel TSX instructions.
But overall, the wrong solution to the wrong problem.
Shared-nothing programming in some domains (Erlang), but mostly not.
A common theme: safety remains (mostly) elusive to this day.
19
Why did it matter, anyway?
Servers already used concurrency to serve many users.
But “typical” client code did not enjoy this (no parallelism).
It still largely doesn’t. Amdahl’s Law is cruel (1/((1-P)+(P/N))).
The beginning of the end of the Wintel Era:
No more “Andy giveth and Bill taketh away” virtuous cycle
From this was born mobile, cloud computing, and GPGPU-style
“supercomputer on every desk”. Less PC, but multi-core still matters.
20
Post multi-core era
21
The return of distributed programming
We have come full circle:
Distributed ⇒ concurrency ⇒ distributed.
Thanks to cloud, proliferation of devices (mobile + IoT).
Increasingly fine-grained distributed systems (microservices) look more
and more like concurrent systems. We learned a lot about building these.
How much applies to our distributed future?
Thankfully, a lot. Let’s look at 7 key lessons.
22
1: Think about communication first, and always
Ad-hoc communication leads to reliability and state management woes.
CSP, actors, RPC, queues are good patterns. Stateless can help but is
often difficult to achieve; most likely, ephemeral (recreatable).
Thinking about dependencies between services as “capabilities” can help
add structure and security. Better than dynamic, weak discovery.
Queuing theory: imbalanced producers/consumers will cause resource
consumption issues, stuttering, scaling issues. Think about flow control.
23
2: Schema helps; but don’t blindly trust it
Many concurrent systems use process-level “plugins” (COM, EJB, etc).
Schema is a religious topic. It helps in the same way static typing helps; if
you find static typing useful, you will probably find schema useful.
But don’t blindly trust it. The Internet works here; copy it if possible.
The server revvs at a different rate than the client.
Trust but verify. Or, as Postel said:
“Be conservative in what you do, be liberal in what you accept.”
24
3: Safety is important, but elusive
Safety comes in many forms: isolated » immutable » synchronized.
Lack of safety creates hazards: races, deadlocks, undefined behavior.
Message passing suffers from races too; just not data races.
State machine discipline can help, regardless of whether concurrent
(multithreading) or distributed (CSPs, Actors, etc).
Relaxed consistency can help, but is harder to reason about.
In a distributed system the “source of truth” is less clear (by design).
25
4: Design for failure
Things will fail; don’t fight it. Thankfully:
“The unavoidable price of reliability is simplicity.” (Tony Hoare)
Always rendezvous and deal with failures intentionally.
Avoid “fire and forget” concurrency: implies mutable state and implicit
dependencies. Complex failure modes. Think about parent/children.
Design for replication and restartability.
Error recovery is a requirement for a reliable concurrent system.
26
5: From causality follows structure
Causality is the cascade of events that leads to an
action being taken. Complex in a concurrent system.
When context flows along causality boundaries,
management becomes easier; but it isn’t automatic:
Cancellation and deadlines.
Security, identity, secrets management.
Tracing and logging.
Performance profiling (critical path).
27
6: Encode structure using concurrency patterns
Easier to understand, debug, manage context, … everything, really.
A task without a consumer is a silent error or leak waiting to happen.
Structured concurrency instills structure: fork/join, pipeline. Let dataflow
determine dependence for maximum performance (whether push or pull).
28
6: Encode structure using concurrency patterns
For example, this
and not this (even though it is “easier”)
29
results := make(chan *Result, 8)
for _, e := range … {
go crawl(url, results) // send to results as ready
}
var merged []*Result
for _, result := range results {
merged = append(merged, process(result)) // do final processing
}
for _, url := range pages {
go crawl(url) // fire and forget; crawler silently mutates some data structures
}
7: Say less, declare/react more
Declarative and reactive patterns delegate hard problems to compilers,
runtimes, and frameworks: data locality, work division, synchronization.
Reactive models the event-oriented nature of an inherently asynchronous
system. It is a declarative specification without impedance mismatch.
Push is often the best for performance, but the hardest to program.
Serverless is a specialization of this idea (single event / single action).
30
counts = text_file.flatMap(lambda line: line.split(" ")) 
.map(lambda word: (word, 1)).reduceByKey(lambda a, b: a + b)
var keyups = Rx.Observable.fromEvent($input, 'keyup')
.pluck('target', 'value').filter(text => text.length > 2);
Recap
1. Think about communication first, and always.
2. Schema helps; but don’t blindly trust it.
3. Safety is important, but elusive.
4. Design for failure.
5. From causality follows structure.
6. Encode structure using concurrency patterns.
7. Say less, declare/react more.
Future programming models will increasingly make these “built-in.”
31
In conclusion
32
Our concurrent past; our distributed future
Many design philosophies shared. Hopefully more in the future.
Expect to see more inspiration from the early distributed programming
pioneers. Shift from low-level cloud infrastructure to higher-level models.
Reading old papers seems “academic” but can lead to insights.
“Those who cannot remember the past are condemned to repeat it.”
Programming clouds of machines will become as easy as multi-core.
33
Thank you
Joe Duffy <joe@pulumi.com>
http://joeduffyblog.com
https://twitter.com/xjoeduffyx
34
Watch the video with slide synchronization on
InfoQ.com!
https://www.infoq.com/presentations/concurrency-
distributed-computing

Contenu connexe

Tendances

Ubiquitous Computing and AmI Smart Environments
Ubiquitous Computing and AmI Smart EnvironmentsUbiquitous Computing and AmI Smart Environments
Ubiquitous Computing and AmI Smart EnvironmentsJosephHowerton
 
Operating System Support for Ubiquitous Computing
Operating System Support for Ubiquitous ComputingOperating System Support for Ubiquitous Computing
Operating System Support for Ubiquitous ComputingIsuru Abeywardana
 
Forrest Iandola: How to become a full-stack deep learning engineer
Forrest Iandola: How to become a full-stack deep learning engineerForrest Iandola: How to become a full-stack deep learning engineer
Forrest Iandola: How to become a full-stack deep learning engineerForrest Iandola
 
DeepScale: Real-Time Perception for Automated Driving
DeepScale: Real-Time Perception for Automated DrivingDeepScale: Real-Time Perception for Automated Driving
DeepScale: Real-Time Perception for Automated DrivingForrest Iandola
 
The Deep Learning Glossary
The Deep Learning GlossaryThe Deep Learning Glossary
The Deep Learning GlossaryNVIDIA
 
Forrest Iandola: My Adventures in Artificial Intelligence and Entrepreneurship
Forrest Iandola: My Adventures in Artificial Intelligence and EntrepreneurshipForrest Iandola: My Adventures in Artificial Intelligence and Entrepreneurship
Forrest Iandola: My Adventures in Artificial Intelligence and EntrepreneurshipForrest Iandola
 
Software and the Concurrency Revolution : Notes
Software and the Concurrency Revolution : NotesSoftware and the Concurrency Revolution : Notes
Software and the Concurrency Revolution : NotesSubhajit Sahu
 
[Thomas chamberlain] learning_om_ne_t++(z-lib.org)
[Thomas chamberlain] learning_om_ne_t++(z-lib.org)[Thomas chamberlain] learning_om_ne_t++(z-lib.org)
[Thomas chamberlain] learning_om_ne_t++(z-lib.org)wissem hammouda
 
Serguei “SB” Beloussov - Future Of Computing at SIT Insights in Technology 2019
Serguei “SB” Beloussov - Future Of Computing at SIT Insights in Technology 2019Serguei “SB” Beloussov - Future Of Computing at SIT Insights in Technology 2019
Serguei “SB” Beloussov - Future Of Computing at SIT Insights in Technology 2019Schaffhausen Institute of Technology
 

Tendances (9)

Ubiquitous Computing and AmI Smart Environments
Ubiquitous Computing and AmI Smart EnvironmentsUbiquitous Computing and AmI Smart Environments
Ubiquitous Computing and AmI Smart Environments
 
Operating System Support for Ubiquitous Computing
Operating System Support for Ubiquitous ComputingOperating System Support for Ubiquitous Computing
Operating System Support for Ubiquitous Computing
 
Forrest Iandola: How to become a full-stack deep learning engineer
Forrest Iandola: How to become a full-stack deep learning engineerForrest Iandola: How to become a full-stack deep learning engineer
Forrest Iandola: How to become a full-stack deep learning engineer
 
DeepScale: Real-Time Perception for Automated Driving
DeepScale: Real-Time Perception for Automated DrivingDeepScale: Real-Time Perception for Automated Driving
DeepScale: Real-Time Perception for Automated Driving
 
The Deep Learning Glossary
The Deep Learning GlossaryThe Deep Learning Glossary
The Deep Learning Glossary
 
Forrest Iandola: My Adventures in Artificial Intelligence and Entrepreneurship
Forrest Iandola: My Adventures in Artificial Intelligence and EntrepreneurshipForrest Iandola: My Adventures in Artificial Intelligence and Entrepreneurship
Forrest Iandola: My Adventures in Artificial Intelligence and Entrepreneurship
 
Software and the Concurrency Revolution : Notes
Software and the Concurrency Revolution : NotesSoftware and the Concurrency Revolution : Notes
Software and the Concurrency Revolution : Notes
 
[Thomas chamberlain] learning_om_ne_t++(z-lib.org)
[Thomas chamberlain] learning_om_ne_t++(z-lib.org)[Thomas chamberlain] learning_om_ne_t++(z-lib.org)
[Thomas chamberlain] learning_om_ne_t++(z-lib.org)
 
Serguei “SB” Beloussov - Future Of Computing at SIT Insights in Technology 2019
Serguei “SB” Beloussov - Future Of Computing at SIT Insights in Technology 2019Serguei “SB” Beloussov - Future Of Computing at SIT Insights in Technology 2019
Serguei “SB” Beloussov - Future Of Computing at SIT Insights in Technology 2019
 

Similaire à Our Concurrent Past; Our Distributed Future

How Can We Answer the Really BIG Questions?
How Can We Answer the Really BIG Questions?How Can We Answer the Really BIG Questions?
How Can We Answer the Really BIG Questions?Amazon Web Services
 
Le PC est mort. Vive le PC!
Le PC est mort. Vive le PC!Le PC est mort. Vive le PC!
Le PC est mort. Vive le PC!Giorgio Pauletto
 
BCO 117 IT Software for Business Lecture Reference Notes.docx
BCO 117 IT Software for Business Lecture Reference Notes.docxBCO 117 IT Software for Business Lecture Reference Notes.docx
BCO 117 IT Software for Business Lecture Reference Notes.docxjesuslightbody
 
Real-world Concurrency : Notes
Real-world Concurrency : NotesReal-world Concurrency : Notes
Real-world Concurrency : NotesSubhajit Sahu
 
Final Draft of IT 402 Presentation
Final Draft of IT 402 PresentationFinal Draft of IT 402 Presentation
Final Draft of IT 402 Presentationmonacofamily
 
But is it Art(ificial Intelligence)?
But is it Art(ificial Intelligence)? But is it Art(ificial Intelligence)?
But is it Art(ificial Intelligence)? Alan Sardella
 
Sc10 slide share
Sc10 slide shareSc10 slide share
Sc10 slide shareGuy Tel-Zur
 
HP Labs: Titan DB on LDBC SNB interactive by Tomer Sagi (HP)
HP Labs: Titan DB on LDBC SNB interactive by Tomer Sagi (HP)HP Labs: Titan DB on LDBC SNB interactive by Tomer Sagi (HP)
HP Labs: Titan DB on LDBC SNB interactive by Tomer Sagi (HP)Ioan Toma
 
Software engineering
Software engineeringSoftware engineering
Software engineeringFahe Em
 
Software engineering
Software engineeringSoftware engineering
Software engineeringFahe Em
 
Running containers in production, the ING story
Running containers in production, the ING storyRunning containers in production, the ING story
Running containers in production, the ING storyThijs Ebbers
 
onur-comparch-fall2018-lecture3a-whycomparch-afterlecture.pptx
onur-comparch-fall2018-lecture3a-whycomparch-afterlecture.pptxonur-comparch-fall2018-lecture3a-whycomparch-afterlecture.pptx
onur-comparch-fall2018-lecture3a-whycomparch-afterlecture.pptxsivasubramanianManic2
 
At the Crossroads of HPC and Cloud Computing with Openstack
At the Crossroads of HPC and Cloud Computing with OpenstackAt the Crossroads of HPC and Cloud Computing with Openstack
At the Crossroads of HPC and Cloud Computing with OpenstackRyan Aydelott
 
High performance computing
High performance computingHigh performance computing
High performance computingGuy Tel-Zur
 

Similaire à Our Concurrent Past; Our Distributed Future (20)

How Can We Answer the Really BIG Questions?
How Can We Answer the Really BIG Questions?How Can We Answer the Really BIG Questions?
How Can We Answer the Really BIG Questions?
 
Multicore computing
Multicore computingMulticore computing
Multicore computing
 
Le PC est mort. Vive le PC!
Le PC est mort. Vive le PC!Le PC est mort. Vive le PC!
Le PC est mort. Vive le PC!
 
Microsoft Dryad
Microsoft DryadMicrosoft Dryad
Microsoft Dryad
 
BCO 117 IT Software for Business Lecture Reference Notes.docx
BCO 117 IT Software for Business Lecture Reference Notes.docxBCO 117 IT Software for Business Lecture Reference Notes.docx
BCO 117 IT Software for Business Lecture Reference Notes.docx
 
Real-world Concurrency : Notes
Real-world Concurrency : NotesReal-world Concurrency : Notes
Real-world Concurrency : Notes
 
Final Draft of IT 402 Presentation
Final Draft of IT 402 PresentationFinal Draft of IT 402 Presentation
Final Draft of IT 402 Presentation
 
But is it Art(ificial Intelligence)?
But is it Art(ificial Intelligence)? But is it Art(ificial Intelligence)?
But is it Art(ificial Intelligence)?
 
Sc10 slide share
Sc10 slide shareSc10 slide share
Sc10 slide share
 
An Optics Life
An Optics LifeAn Optics Life
An Optics Life
 
HP Labs: Titan DB on LDBC SNB interactive by Tomer Sagi (HP)
HP Labs: Titan DB on LDBC SNB interactive by Tomer Sagi (HP)HP Labs: Titan DB on LDBC SNB interactive by Tomer Sagi (HP)
HP Labs: Titan DB on LDBC SNB interactive by Tomer Sagi (HP)
 
Reproducible Science and Deep Software Variability
Reproducible Science and Deep Software VariabilityReproducible Science and Deep Software Variability
Reproducible Science and Deep Software Variability
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
Running containers in production, the ING story
Running containers in production, the ING storyRunning containers in production, the ING story
Running containers in production, the ING story
 
Ch01lect1 et
Ch01lect1 etCh01lect1 et
Ch01lect1 et
 
onur-comparch-fall2018-lecture3a-whycomparch-afterlecture.pptx
onur-comparch-fall2018-lecture3a-whycomparch-afterlecture.pptxonur-comparch-fall2018-lecture3a-whycomparch-afterlecture.pptx
onur-comparch-fall2018-lecture3a-whycomparch-afterlecture.pptx
 
Serguei Beloussov - Future of computing
Serguei Beloussov - Future of computingSerguei Beloussov - Future of computing
Serguei Beloussov - Future of computing
 
At the Crossroads of HPC and Cloud Computing with Openstack
At the Crossroads of HPC and Cloud Computing with OpenstackAt the Crossroads of HPC and Cloud Computing with Openstack
At the Crossroads of HPC and Cloud Computing with Openstack
 
High performance computing
High performance computingHigh performance computing
High performance computing
 

Plus de C4Media

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoC4Media
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileC4Media
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020C4Media
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsC4Media
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No KeeperC4Media
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like OwnersC4Media
 
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaC4Media
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideC4Media
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDC4Media
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine LearningC4Media
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at SpeedC4Media
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsC4Media
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsC4Media
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerC4Media
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleC4Media
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeC4Media
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereC4Media
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing ForC4Media
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data EngineeringC4Media
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreC4Media
 

Plus de C4Media (20)

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy Mobile
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java Applications
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No Keeper
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like Owners
 
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate Guide
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CD
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine Learning
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at Speed
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep Systems
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.js
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix Scale
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's Edge
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home Everywhere
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing For
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data Engineering
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 

Dernier

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 

Dernier (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

Our Concurrent Past; Our Distributed Future

  • 1. Our Concurrent Past; Our Distributed Future Joe Duffy Co-founder/CEO Pulumi
  • 2. InfoQ.com: News & Community Site Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations /concurrency-distributed-computing • Over 1,000,000 software developers, architects and CTOs read the site world- wide every month • 250,000 senior developers subscribe to our weekly newsletter • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • 2 dedicated podcast channels: The InfoQ Podcast, with a focus on Architecture and The Engineering Culture Podcast, with a focus on building • 96 deep dives on innovative topics packed as downloadable emags and minibooks • Over 40 new content items per week
  • 3. Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide Presented at QCon London www.qconlondon.com
  • 4. The world is concurrent File and network I/O. Servers with many users. Multicore. Mobile devices. GPUs. Clouds of machines. All of which communicate with one another. 2
  • 5. Distributed is concurrent Concurrency: two or more things happening at once. Parallelism is a form of concurrency: multiple workers execute concurrently, with the goal of getting a “single” job done faster. So too is distributed: workers simply run further apart from one another: Different processes. Different machines. Different racks, data centers. Different planets. Different distances implies different assumptions/capabilities. 3
  • 6. Long lost brothers Concurrency and distributed programming share deep roots in early CS. Many of the early pioneers of our industry -- Knuth, Lampson, Lamport, Hoare -- cut their teeth on distributed programming. Concurrency and parallelism broke into the mainstream first. Now, thanks to mobile + cloud, distributed will overtake them. By revisiting those early roots, and reflecting on concurrency, we can learn a lot about what the future of distributed programming holds for us. 4
  • 7. How we got here 5
  • 8. First there was “distributed” Early OS work modeled concurrency as distributed agents. Dijkstra semaphores (1962). Hoare CSPs (1977). Lamport time clocks (1978). Butler Lampson on system design (1983). Even I/O devices were thought to be distributed; asynchronous with respect to the program, and they did not share an address space. 6
  • 9. Modern concurrency roots Many abstractions core to our concurrent systems were invented alongside those distributed programming concepts. Hoare and Hansen monitors (1974). From semaphores to mutual exclusion: Dijkstra/Dekker (1965), Lamport (1974), Peterson (1981). Multithreading (Lamport 1979). Most of the pioneers of concurrency are also the pioneers of distributed. 7
  • 10. Beyond synchronization: communication Furthering the distributed bent was focus on communication. Modern synchronization is a special case that (ab)uses shared memory space. Message passing: communication is done by sending messages. CSPs and Actors: independent processes and state machines. Futures and Promises: dataflow-based asynchronous communication. Memory interconnects are just a form of hardware message passing. The focus on structured communication was lost along the way, but is now coming back (Akka, Thrift, Go CSPs, gRPC, …). 8
  • 11. The parallel 80’s Explosion of research into parallelism, largely driven by AI research. The Connection Machine: up to 65,536 processors. From this was born a “supercomputing” culture that persists to this day. 9
  • 12. Parallel programming Substantial focus on programmability. Task parallelism: computation drives parallel division. Data parallelism: data drives parallel division (scales with data). Eventually, scheduling algorithms. Work stealing (Cilk). Nested parallelism (Cilk, NESL). 10
  • 13. Parallel programming (Ex1. Connection Machine) Programming 65,536 processors is different! Every processor is a ~CSP. 11 (DEFUN PATH-LENGTH (A B G) α(SETF (LABEL •G) +INF) (SETF (LABEL A) 0) (LOOP UNTIL (< (LABEL B) +INF) DO α(SETF (LABEL •(REMOVE A G)) (1+ (βMIN α(LABEL •(NEIGHBORS •G)))))) (LABEL B))
  • 14. Parallel programming (Ex2. Cilk) Bringing parallelism to imperative C-like languages. Foreshadows modern data parallel, including GPGPU and MapReduce. 12 // Task parallel: cilk int fib(int n) { if (n < 2) { return n; } else { int x = spawn fib(n - 1); int y = spawn fib(n - 2); sync; return x + y; } } // Data parallel: cilk_for (int i = 0; i < n; i++) { a[i] = f(a[i]); } cilk::reducer_opadd<int> result(0); cilk_for (int i = 0; i < n; i++) { result += foo(i); }
  • 15. Parallel programming (Ex3. OpenMP) Eventual mainstream language adoption of these ideas (1997). Notice similarity to Cilk; set the stage for the future (Java, .NET, CUDA, ...). 13 // Task parallel: cilk int fib(int n) { if (n < 2) { return n; } else { #pragma omp task shared(n) int x = spawn fib(n - 1); #pragma omp task shared(n) int y = spawn fib(n - 2); #pragma omp taskwait return x + y; } } // Data parallel: #pragma omp parallel for for (int i = 0; i < n; i++) { a[i] = f(a[i]); } #pragma omp for reduction(+: result) for (int i = 0; i < n; i++) { result += foo(i); }
  • 18. Moore’s Law: what happened? Clock speed doubled every ~18mos until 2005: “The complexity for minimum component costs has increased at a rate of roughly a factor of two per year. Certainly over the short term this rate can be expected to continue, if not to increase. Over the longer term, ... there is no reason to believe it will not remain nearly constant for at least 10 years.” -- Gordon Moore, 1965 "It can't continue forever. The nature of exponentials is that you push them out and eventually disaster happens.” -- Gordon Moore, 2005 Power wall: higher frequency requires quadratic voltage/power increase, yielding greater leakage and inability to cool, requires new innovation. Result: you don’t get faster processors, you just get more of them. 16
  • 20. The renaissance: we must program all those cores! The 2000’s was the concurrent programming renaissance. Java, .NET, C++ went from threads, thread pools, locks, and events to tasks, work stealing, and structured concurrency. GPGPU became a thing, fueled by CUDA and architecture co-design. Borrowed the best, easiest to program, ideas from academia. These building blocks now used as the foundation for asynchrony. Somehow lost focus on CSPs, Actors, etc.; Erlang and Go got this right. 18
  • 21. Modest progress on safety Recognition of the importance of immutable data structures. Short-lived industry-wide infatuation with software transactional memory. Some success stories: Haskell, Clojure, Intel TSX instructions. But overall, the wrong solution to the wrong problem. Shared-nothing programming in some domains (Erlang), but mostly not. A common theme: safety remains (mostly) elusive to this day. 19
  • 22. Why did it matter, anyway? Servers already used concurrency to serve many users. But “typical” client code did not enjoy this (no parallelism). It still largely doesn’t. Amdahl’s Law is cruel (1/((1-P)+(P/N))). The beginning of the end of the Wintel Era: No more “Andy giveth and Bill taketh away” virtuous cycle From this was born mobile, cloud computing, and GPGPU-style “supercomputer on every desk”. Less PC, but multi-core still matters. 20
  • 24. The return of distributed programming We have come full circle: Distributed ⇒ concurrency ⇒ distributed. Thanks to cloud, proliferation of devices (mobile + IoT). Increasingly fine-grained distributed systems (microservices) look more and more like concurrent systems. We learned a lot about building these. How much applies to our distributed future? Thankfully, a lot. Let’s look at 7 key lessons. 22
  • 25. 1: Think about communication first, and always Ad-hoc communication leads to reliability and state management woes. CSP, actors, RPC, queues are good patterns. Stateless can help but is often difficult to achieve; most likely, ephemeral (recreatable). Thinking about dependencies between services as “capabilities” can help add structure and security. Better than dynamic, weak discovery. Queuing theory: imbalanced producers/consumers will cause resource consumption issues, stuttering, scaling issues. Think about flow control. 23
  • 26. 2: Schema helps; but don’t blindly trust it Many concurrent systems use process-level “plugins” (COM, EJB, etc). Schema is a religious topic. It helps in the same way static typing helps; if you find static typing useful, you will probably find schema useful. But don’t blindly trust it. The Internet works here; copy it if possible. The server revvs at a different rate than the client. Trust but verify. Or, as Postel said: “Be conservative in what you do, be liberal in what you accept.” 24
  • 27. 3: Safety is important, but elusive Safety comes in many forms: isolated » immutable » synchronized. Lack of safety creates hazards: races, deadlocks, undefined behavior. Message passing suffers from races too; just not data races. State machine discipline can help, regardless of whether concurrent (multithreading) or distributed (CSPs, Actors, etc). Relaxed consistency can help, but is harder to reason about. In a distributed system the “source of truth” is less clear (by design). 25
  • 28. 4: Design for failure Things will fail; don’t fight it. Thankfully: “The unavoidable price of reliability is simplicity.” (Tony Hoare) Always rendezvous and deal with failures intentionally. Avoid “fire and forget” concurrency: implies mutable state and implicit dependencies. Complex failure modes. Think about parent/children. Design for replication and restartability. Error recovery is a requirement for a reliable concurrent system. 26
  • 29. 5: From causality follows structure Causality is the cascade of events that leads to an action being taken. Complex in a concurrent system. When context flows along causality boundaries, management becomes easier; but it isn’t automatic: Cancellation and deadlines. Security, identity, secrets management. Tracing and logging. Performance profiling (critical path). 27
  • 30. 6: Encode structure using concurrency patterns Easier to understand, debug, manage context, … everything, really. A task without a consumer is a silent error or leak waiting to happen. Structured concurrency instills structure: fork/join, pipeline. Let dataflow determine dependence for maximum performance (whether push or pull). 28
  • 31. 6: Encode structure using concurrency patterns For example, this and not this (even though it is “easier”) 29 results := make(chan *Result, 8) for _, e := range … { go crawl(url, results) // send to results as ready } var merged []*Result for _, result := range results { merged = append(merged, process(result)) // do final processing } for _, url := range pages { go crawl(url) // fire and forget; crawler silently mutates some data structures }
  • 32. 7: Say less, declare/react more Declarative and reactive patterns delegate hard problems to compilers, runtimes, and frameworks: data locality, work division, synchronization. Reactive models the event-oriented nature of an inherently asynchronous system. It is a declarative specification without impedance mismatch. Push is often the best for performance, but the hardest to program. Serverless is a specialization of this idea (single event / single action). 30 counts = text_file.flatMap(lambda line: line.split(" ")) .map(lambda word: (word, 1)).reduceByKey(lambda a, b: a + b) var keyups = Rx.Observable.fromEvent($input, 'keyup') .pluck('target', 'value').filter(text => text.length > 2);
  • 33. Recap 1. Think about communication first, and always. 2. Schema helps; but don’t blindly trust it. 3. Safety is important, but elusive. 4. Design for failure. 5. From causality follows structure. 6. Encode structure using concurrency patterns. 7. Say less, declare/react more. Future programming models will increasingly make these “built-in.” 31
  • 35. Our concurrent past; our distributed future Many design philosophies shared. Hopefully more in the future. Expect to see more inspiration from the early distributed programming pioneers. Shift from low-level cloud infrastructure to higher-level models. Reading old papers seems “academic” but can lead to insights. “Those who cannot remember the past are condemned to repeat it.” Programming clouds of machines will become as easy as multi-core. 33
  • 36. Thank you Joe Duffy <joe@pulumi.com> http://joeduffyblog.com https://twitter.com/xjoeduffyx 34
  • 37. Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations/concurrency- distributed-computing