SlideShare une entreprise Scribd logo
1  sur  43
InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
http://www.infoq.com/presentations
/reactive-cloud-scale
Presented at QCon New York
www.qconnewyork.com
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

 Tesla

 mid 2000s





 LINQ to Events
Nikola Tesla
www.knowledgeoftoday.org

 Tier-splitting
 metadata







 asynchronous
www.Wikipedia.org



 Events are not first-class objects

[RunOnClient]
public event EventHandler<MouseEventArgs> MouseMoved;
// Runs in cloud
public void CloudCanvas()
{
MouseMoved += (o, e) => { /* do stuff */ };
}
An electric eel…

 delegates

Action a = new Action(Foo); // explicit creation of delegate instance
Action b = Foo; // method group conversion
Action c = () => { … }; // creates anonymous method
void Foo() { … }
event Action Bar // metadata that refers to …
{
add { … } // add accessor
remove { … } // remove accessor
}
http://en.wikipedia.org/wiki/First-class_citizen

 duality enumerator

interface IObservable<out T>
{
IDisposable Subscribe(IObserver<T> observer);
}
interface IObserver<in T>
{
void OnNext(T value);
void OnError(Exception error);
void OnCompleted();
}
Notification grammar
OnNext* (OnError | OnCompleted)?
“Gang of four” book
Addison-Wesley

 Composition
 Composition
interface IScheduler
{
IDisposable Schedule(Action work);
…
}
static class Observable
{
static IObservable<T> Where<T>(this IObservable<T> source, Func<T, bool> f);
static IObservable<R> Select<T, R>(this IObservable<T> source, Func<T, R> p);
…
}
Function composition
www.Wikipedia.org
 Function composition
www.Wikipedia.org
public static class Observable
{
public static IObservable<T> Merge<T>(this IObservable<T> xs, IObservable<T> ys)
{
return Create<T>(observer =>
{
var gate = new object();
return new CompositeDisposable
{
xs.Subscribe(x => { lock (gate) { observer.OnNext(x); } }, …),
ys.Subscribe(y => { lock (gate) { observer.OnNext(y); } }, …),
};
});
}
}
First-class: can build
extension methods
Composition of
resource management
 layering


 asynchrony and time


 virtual time historical time
public static IObservable<T> Return<T>(T value, IScheduler scheduler)
{
return Create<T>(obs => scheduler.Schedule(() => { obs.OnNext(value);
obs.OnCompleted(); }));
}
Space-time
www.Wikipedia.org

 push pull

Category theory
www.Wikipedia.org
interface IObservable<out T>
{
IDisposable Subscribe(IObserver<T> observer);
}
interface IObserver<in T>
{
void OnNext(T value);
void OnError(Exception error);
void OnCompleted();
}
interface IEnumerable<out T>
{
IEnumerator<T> GetEnumerator();
}
interface IEnumerator<out T> : IDisposable
{
bool MoveNext() throws Exception;
T Current { get; }
void Reset();
}


 Await Stephen Kleene
Kleene star (closure)
www.Wikipedia.org
Func<T> f
var x = wait f();
IEnumerable<T> xs
foreach (var x in xs) {
f(x);
}
Task<T> t
var x = await t;
IObservable<T> xs
xs.Subscribe(x => {
f(x);
});
OneMany
Synchronous Asynchronous

 Code-as-data


Alan Kay
Homoiconicity, 1969
www.Wikipedia.org
IEnumerable<T> xs
from x in xs where f(x) …
IQueryable<T> xs
from x in xs where f(x) …
IObservable<T> xs
from x in xs where f(x) …
IQbservable<T> xs
from x in xs where f(x) …
CodeData
Pull Push
 Events




 scalable abstraction



Satya Nadella
“Cloud-first, mobile-first”
www.businessinsider.com

 Bing


 Cortana


 Cloud and device


 Optimization



 Reliability






Richard Feynman
Westview Press
from w in weather
where w.City == “Seattle”
select w
flights
.Where(f => f.Code == “BA49”)
.DelaySubscription(departure – 24 * H)
.TakeUntil(arrival + 24 * H)
.Select(f => f.Status)
userLocation
.Sample(1 * M)
.DistinctUntilChanged()
.Select(here =>
traffic(here, meetingLocation)
.TakeUntil(meeting – minimumTime)
.Select(t => Timer(meeting – t.EstimatedTime))
.StartWith(Timer(meeting – estimatedTime))
.Switch())
.Switch()
.Select(_ => “Leave now for ” + subject)
.DelaySubscription(meeting – estimatedTime)
Temporal query
operators
Device-side
event stream
// Insert cloud-side observable sequence
// of time-to-leave timer here
Cloud-side
event stream
Higher-order
query operators
Remember
tier-splitting?
 IReactiveProcessing



Bing cloud
IRP
Partner1 cloud
IRP
Partner2 cloud
IRP
Tablet
IRP
Phone
IRP
Node
IRP
Node
IRP Node
IRP
 Rx



 distributed







 Proxies
 Definitions
 Metadata


 Hyper-cube





Sync Async
IntrinsicExtrinsic
Higher dimensions
Calabi-Yau manifold
www.Wikipedia.org

 Proxies
 Definitions
 Metadata


 Hyper-cube
 Synchronous versus asynchronous
 Extrinsic versus intrinsic identities
 Code-as-data versus code
 Reliable versus non-reliable
 Etc.
Higher dimensions
Calabi-Yau manifold
www.Wikipedia.org
Async
Extrinsic
E.g. this is the
client-side API
Need string theory

 context




 proxies

var conn = new ReactiveServiceConnection(endpoint);
var ctx = new ClientContext(conn);
var traffic = ctx.GetObservable<TrafficInfo>(trafficUri);
var http = ctx.GetObserver<HttpData>(httpUri);
Explicit identifiers
provided for artifacts


 extrinsic identifiers
 Async


var traffic = ctx.GetObservable<TrafficInfo>(trafficUri);
var http = ctx.GetObserver<HttpData>(httpUri);
var subscription = await traffic.Where(t => t.Road == “I-90”)
.Select(t => new HttpData { Uri = myService,
Body = t.ToString() })
.SubscribeAsync(http, mySubUri);
Explicit identifiers
provided for artifacts
 SubscribeAsync
 expression tree



 serialized



 IRP
var traffic = ctx.GetObservable<TrafficInfo>(trafficUri);
var http = ctx.GetObserver<HttpData>(httpUri);
var subscription = await traffic.Where(t => t.Road == “I-90”)
.Select(t => new HttpData { Uri = …, Body = … })
.SubscribeAsync(http, mySubUri);
Invoke
rx://subscribe Invoke
rx://select Invoke
rx://where trafficUri
httpUri
λ
t => new { bing://http/uri = …,
bing://http/body = … }
λ t => t.Road == “I-90”
Unbound parameters
processed by binder
Structural typing to
reduce coupling
 definition of artifacts



var traffic = ctx.GetObservable<TrafficInfo>(trafficUri);
// Define
await ctx.DefineObservableAsync<string, TrafficInfo>(
trafficByRoadUri,
road => traffic.Where(t => t.Road == road));
// Proxies
var trafficByRoad = ctx.GetObservable<string, TrafficInfo>(trafficByRoadUri);
trafficByRoad(“I-90”).…

 parameterized observables



var xs = ctx.GetObservable<int>(xsUri);
var iv = ctx.GetObserver<int>(ivUri);
await xs.Where(x => x > 0).Select(x => x * x).SubscribeAsync(iv, …);
var xs = ctx.GetObservable<int>(xsUri);
var iv = ctx.GetObserver<int>(ivUri);
var where = ctx.GetObservable<IARQ<int>, Expr<Func<int, bool>>, int>(whereUri);
var select = ctx.GetObservable<IARQ<int>, Expr<Func<int, int>>, int>(selectUri);
await select(where(xs, x => x > 0), x => x * x).SubscribeAsync(iv, …);
 [KnownResource] attributes can be used everywhere
 Provide shorthand syntax for Get* operations
 Enable code generation using the Metadata facilities
 What’s IAsyncReactiveQbservable<T>?
 Async because it’s client-side (cf. SubscribeAsync)
 Reactive because we had to disambiguate with Rx concepts
 Qbservable because it’s expression tree based
static class AsyncReactiveQbservable
{
[KnownResource(whereUri)]
static IAsyncReactiveQbservable<T> Where<T>(this IAsyncReactiveQbservable<T> xs,
Expression<Func<T, bool>> filter) {…}
}
 properties


 tooling


 delegation




 recovery
 density
 reliability
 Scalable

 checkpointing
 Acknowledge / replay


 Coordinator engines

Event Processing
Execution Engine Node1
Rx
IRP
Event Processing
Execution Engine Node2
Rx
IRP
Checkpoint
storage
Save
Load
Checkpoint
storage
Save
Load
Reliable
messaging
OnNext
Replay
Ack
 traverse the operator tree






 ISubscribable<T>

interface ISubscribable<out T>
{
ISubscription Subscribe(ISubscriber<T> subscriber);
}
interface ISubscription : IDisposable
{
void Accept(ISubscriptionVisitor v);
}




 Physical schedulers


 logical schedulers

 Unit of pausing


 onion




 GitHub




 bartde@microsoft.com
Service
Host
Data model
Query engine
Operators
Watch the video with slide synchronization on
InfoQ.com!
http://www.infoq.com/presentations/reactive-
cloud-scale

Contenu connexe

Tendances

Manipulating object-behavior-at-runtime
Manipulating object-behavior-at-runtimeManipulating object-behavior-at-runtime
Manipulating object-behavior-at-runtime
Andrei Ursan
 
Poor Man's Functional Programming
Poor Man's Functional ProgrammingPoor Man's Functional Programming
Poor Man's Functional Programming
Dmitry Buzdin
 

Tendances (20)

Quill - 一個 Scala 的資料庫存取利器
Quill - 一個 Scala 的資料庫存取利器Quill - 一個 Scala 的資料庫存取利器
Quill - 一個 Scala 的資料庫存取利器
 
Kotlin and Domain-Driven Design: A perfect match - Kotlin Meetup Munich
Kotlin and Domain-Driven Design: A perfect match - Kotlin Meetup MunichKotlin and Domain-Driven Design: A perfect match - Kotlin Meetup Munich
Kotlin and Domain-Driven Design: A perfect match - Kotlin Meetup Munich
 
Time Series Meetup: Virtual Edition | July 2020
Time Series Meetup: Virtual Edition | July 2020Time Series Meetup: Virtual Edition | July 2020
Time Series Meetup: Virtual Edition | July 2020
 
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
 
UIKonf App & Data Driven Design @swift.berlin
UIKonf App & Data Driven Design @swift.berlinUIKonf App & Data Driven Design @swift.berlin
UIKonf App & Data Driven Design @swift.berlin
 
Async Microservices with Twitter's Finagle
Async Microservices with Twitter's FinagleAsync Microservices with Twitter's Finagle
Async Microservices with Twitter's Finagle
 
Cheep microservices
Cheep microservicesCheep microservices
Cheep microservices
 
Cascadia.js: Don't Cross the Streams
Cascadia.js: Don't Cross the StreamsCascadia.js: Don't Cross the Streams
Cascadia.js: Don't Cross the Streams
 
Finch + Finagle OAuth2
Finch + Finagle OAuth2Finch + Finagle OAuth2
Finch + Finagle OAuth2
 
Ernst kuilder (Nelen & Schuurmans) - De waterkaart van Nederland: technisch g...
Ernst kuilder (Nelen & Schuurmans) - De waterkaart van Nederland: technisch g...Ernst kuilder (Nelen & Schuurmans) - De waterkaart van Nederland: technisch g...
Ernst kuilder (Nelen & Schuurmans) - De waterkaart van Nederland: technisch g...
 
RxJS Evolved
RxJS EvolvedRxJS Evolved
RxJS Evolved
 
ECMAScript 5: Новое в JavaScript
ECMAScript 5: Новое в JavaScriptECMAScript 5: Новое в JavaScript
ECMAScript 5: Новое в JavaScript
 
The Ring programming language version 1.8 book - Part 39 of 202
The Ring programming language version 1.8 book - Part 39 of 202The Ring programming language version 1.8 book - Part 39 of 202
The Ring programming language version 1.8 book - Part 39 of 202
 
Manipulating object-behavior-at-runtime
Manipulating object-behavior-at-runtimeManipulating object-behavior-at-runtime
Manipulating object-behavior-at-runtime
 
Poor Man's Functional Programming
Poor Man's Functional ProgrammingPoor Man's Functional Programming
Poor Man's Functional Programming
 
For mobile 5/13'
For mobile 5/13'For mobile 5/13'
For mobile 5/13'
 
Building a Tagless Final DSL for WebGL
Building a Tagless Final DSL for WebGLBuilding a Tagless Final DSL for WebGL
Building a Tagless Final DSL for WebGL
 
C# console programms
C# console programmsC# console programms
C# console programms
 
Luis Atencio on RxJS
Luis Atencio on RxJSLuis Atencio on RxJS
Luis Atencio on RxJS
 
CR17 - Designing a database like an archaeologist
CR17 - Designing a database like an archaeologistCR17 - Designing a database like an archaeologist
CR17 - Designing a database like an archaeologist
 

Similaire à Reactive Programming at Cloud-Scale and Beyond

Ft10 de smet
Ft10 de smetFt10 de smet
Ft10 de smet
nkaluva
 

Similaire à Reactive Programming at Cloud-Scale and Beyond (20)

Reactive Programming with Rx
 Reactive Programming with Rx Reactive Programming with Rx
Reactive Programming with Rx
 
Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every day
 
Building a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & SlickBuilding a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & Slick
 
Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) DataCategory theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Data
 
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
 
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiMonitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
 
Programming Languages: some news for the last N years
Programming Languages: some news for the last N yearsProgramming Languages: some news for the last N years
Programming Languages: some news for the last N years
 
Spark Streaming - Meetup Data Analysis
Spark Streaming - Meetup Data AnalysisSpark Streaming - Meetup Data Analysis
Spark Streaming - Meetup Data Analysis
 
Vertx SouJava
Vertx SouJavaVertx SouJava
Vertx SouJava
 
Vertx daitan
Vertx daitanVertx daitan
Vertx daitan
 
Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30)
 
Apache Spark Side of Funnels
Apache Spark Side of FunnelsApache Spark Side of Funnels
Apache Spark Side of Funnels
 
Stream Processing with Ballerina
Stream Processing with BallerinaStream Processing with Ballerina
Stream Processing with Ballerina
 
Time for Functions
Time for FunctionsTime for Functions
Time for Functions
 
Reactive Extensions: classic Observer in .NET
Reactive Extensions: classic Observer in .NETReactive Extensions: classic Observer in .NET
Reactive Extensions: classic Observer in .NET
 
Fabric - Realtime stream processing framework
Fabric - Realtime stream processing frameworkFabric - Realtime stream processing framework
Fabric - Realtime stream processing framework
 
Intro to Akka Streams
Intro to Akka StreamsIntro to Akka Streams
Intro to Akka Streams
 
Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...
 
Ft10 de smet
Ft10 de smetFt10 de smet
Ft10 de smet
 

Plus de C4Media

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

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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, ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Reactive Programming at Cloud-Scale and Beyond

  • 1.
  • 2. InfoQ.com: News & Community Site • 750,000 unique visitors/month • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • News 15-20 / week • Articles 3-4 / week • Presentations (videos) 12-15 / week • Interviews 2-3 / week • Books 1 / month Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations /reactive-cloud-scale
  • 3. Presented at QCon New York www.qconnewyork.com 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
  • 4.
  • 5.   Tesla   mid 2000s       LINQ to Events Nikola Tesla www.knowledgeoftoday.org
  • 7.     Events are not first-class objects  [RunOnClient] public event EventHandler<MouseEventArgs> MouseMoved; // Runs in cloud public void CloudCanvas() { MouseMoved += (o, e) => { /* do stuff */ }; } An electric eel…
  • 8.   delegates  Action a = new Action(Foo); // explicit creation of delegate instance Action b = Foo; // method group conversion Action c = () => { … }; // creates anonymous method void Foo() { … } event Action Bar // metadata that refers to … { add { … } // add accessor remove { … } // remove accessor } http://en.wikipedia.org/wiki/First-class_citizen
  • 9.   duality enumerator  interface IObservable<out T> { IDisposable Subscribe(IObserver<T> observer); } interface IObserver<in T> { void OnNext(T value); void OnError(Exception error); void OnCompleted(); } Notification grammar OnNext* (OnError | OnCompleted)? “Gang of four” book Addison-Wesley
  • 10.   Composition  Composition interface IScheduler { IDisposable Schedule(Action work); … } static class Observable { static IObservable<T> Where<T>(this IObservable<T> source, Func<T, bool> f); static IObservable<R> Select<T, R>(this IObservable<T> source, Func<T, R> p); … } Function composition www.Wikipedia.org
  • 11.  Function composition www.Wikipedia.org public static class Observable { public static IObservable<T> Merge<T>(this IObservable<T> xs, IObservable<T> ys) { return Create<T>(observer => { var gate = new object(); return new CompositeDisposable { xs.Subscribe(x => { lock (gate) { observer.OnNext(x); } }, …), ys.Subscribe(y => { lock (gate) { observer.OnNext(y); } }, …), }; }); } } First-class: can build extension methods Composition of resource management
  • 12.  layering    asynchrony and time    virtual time historical time public static IObservable<T> Return<T>(T value, IScheduler scheduler) { return Create<T>(obs => scheduler.Schedule(() => { obs.OnNext(value); obs.OnCompleted(); })); } Space-time www.Wikipedia.org
  • 13.   push pull  Category theory www.Wikipedia.org interface IObservable<out T> { IDisposable Subscribe(IObserver<T> observer); } interface IObserver<in T> { void OnNext(T value); void OnError(Exception error); void OnCompleted(); } interface IEnumerable<out T> { IEnumerator<T> GetEnumerator(); } interface IEnumerator<out T> : IDisposable { bool MoveNext() throws Exception; T Current { get; } void Reset(); }
  • 14.    Await Stephen Kleene Kleene star (closure) www.Wikipedia.org Func<T> f var x = wait f(); IEnumerable<T> xs foreach (var x in xs) { f(x); } Task<T> t var x = await t; IObservable<T> xs xs.Subscribe(x => { f(x); }); OneMany Synchronous Asynchronous
  • 15.   Code-as-data   Alan Kay Homoiconicity, 1969 www.Wikipedia.org IEnumerable<T> xs from x in xs where f(x) … IQueryable<T> xs from x in xs where f(x) … IObservable<T> xs from x in xs where f(x) … IQbservable<T> xs from x in xs where f(x) … CodeData Pull Push
  • 16.
  • 17.
  • 18.  Events      scalable abstraction    Satya Nadella “Cloud-first, mobile-first” www.businessinsider.com
  • 21. from w in weather where w.City == “Seattle” select w flights .Where(f => f.Code == “BA49”) .DelaySubscription(departure – 24 * H) .TakeUntil(arrival + 24 * H) .Select(f => f.Status) userLocation .Sample(1 * M) .DistinctUntilChanged() .Select(here => traffic(here, meetingLocation) .TakeUntil(meeting – minimumTime) .Select(t => Timer(meeting – t.EstimatedTime)) .StartWith(Timer(meeting – estimatedTime)) .Switch()) .Switch() .Select(_ => “Leave now for ” + subject) .DelaySubscription(meeting – estimatedTime) Temporal query operators Device-side event stream // Insert cloud-side observable sequence // of time-to-leave timer here Cloud-side event stream Higher-order query operators Remember tier-splitting?
  • 22.  IReactiveProcessing    Bing cloud IRP Partner1 cloud IRP Partner2 cloud IRP Tablet IRP Phone IRP Node IRP Node IRP Node IRP
  • 24.
  • 25.   Proxies  Definitions  Metadata    Hyper-cube      Sync Async IntrinsicExtrinsic Higher dimensions Calabi-Yau manifold www.Wikipedia.org
  • 26.   Proxies  Definitions  Metadata    Hyper-cube  Synchronous versus asynchronous  Extrinsic versus intrinsic identities  Code-as-data versus code  Reliable versus non-reliable  Etc. Higher dimensions Calabi-Yau manifold www.Wikipedia.org Async Extrinsic E.g. this is the client-side API Need string theory 
  • 27.  context      proxies  var conn = new ReactiveServiceConnection(endpoint); var ctx = new ClientContext(conn); var traffic = ctx.GetObservable<TrafficInfo>(trafficUri); var http = ctx.GetObserver<HttpData>(httpUri); Explicit identifiers provided for artifacts
  • 28.    extrinsic identifiers  Async   var traffic = ctx.GetObservable<TrafficInfo>(trafficUri); var http = ctx.GetObserver<HttpData>(httpUri); var subscription = await traffic.Where(t => t.Road == “I-90”) .Select(t => new HttpData { Uri = myService, Body = t.ToString() }) .SubscribeAsync(http, mySubUri); Explicit identifiers provided for artifacts
  • 29.  SubscribeAsync  expression tree     serialized     IRP
  • 30. var traffic = ctx.GetObservable<TrafficInfo>(trafficUri); var http = ctx.GetObserver<HttpData>(httpUri); var subscription = await traffic.Where(t => t.Road == “I-90”) .Select(t => new HttpData { Uri = …, Body = … }) .SubscribeAsync(http, mySubUri); Invoke rx://subscribe Invoke rx://select Invoke rx://where trafficUri httpUri λ t => new { bing://http/uri = …, bing://http/body = … } λ t => t.Road == “I-90” Unbound parameters processed by binder Structural typing to reduce coupling
  • 31.  definition of artifacts    var traffic = ctx.GetObservable<TrafficInfo>(trafficUri); // Define await ctx.DefineObservableAsync<string, TrafficInfo>( trafficByRoadUri, road => traffic.Where(t => t.Road == road)); // Proxies var trafficByRoad = ctx.GetObservable<string, TrafficInfo>(trafficByRoadUri); trafficByRoad(“I-90”).…
  • 32.   parameterized observables    var xs = ctx.GetObservable<int>(xsUri); var iv = ctx.GetObserver<int>(ivUri); await xs.Where(x => x > 0).Select(x => x * x).SubscribeAsync(iv, …); var xs = ctx.GetObservable<int>(xsUri); var iv = ctx.GetObserver<int>(ivUri); var where = ctx.GetObservable<IARQ<int>, Expr<Func<int, bool>>, int>(whereUri); var select = ctx.GetObservable<IARQ<int>, Expr<Func<int, int>>, int>(selectUri); await select(where(xs, x => x > 0), x => x * x).SubscribeAsync(iv, …);
  • 33.  [KnownResource] attributes can be used everywhere  Provide shorthand syntax for Get* operations  Enable code generation using the Metadata facilities  What’s IAsyncReactiveQbservable<T>?  Async because it’s client-side (cf. SubscribeAsync)  Reactive because we had to disambiguate with Rx concepts  Qbservable because it’s expression tree based static class AsyncReactiveQbservable { [KnownResource(whereUri)] static IAsyncReactiveQbservable<T> Where<T>(this IAsyncReactiveQbservable<T> xs, Expression<Func<T, bool>> filter) {…} }
  • 35.
  • 36.
  • 37.     recovery  density  reliability  Scalable   checkpointing  Acknowledge / replay  
  • 38.  Coordinator engines  Event Processing Execution Engine Node1 Rx IRP Event Processing Execution Engine Node2 Rx IRP Checkpoint storage Save Load Checkpoint storage Save Load Reliable messaging OnNext Replay Ack
  • 39.  traverse the operator tree        ISubscribable<T>  interface ISubscribable<out T> { ISubscription Subscribe(ISubscriber<T> subscriber); } interface ISubscription : IDisposable { void Accept(ISubscriptionVisitor v); }
  • 40.      Physical schedulers    logical schedulers   Unit of pausing  
  • 41.
  • 42.  onion      GitHub      bartde@microsoft.com Service Host Data model Query engine Operators
  • 43. Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations/reactive- cloud-scale