Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Démystifier le réactif et l'orchestration de services avec Vert.x, Kubernetes et Kotlin
Julien Ponge
March 29, 2018
Programming
0
190
Démystifier le réactif et l'orchestration de services avec Vert.x, Kubernetes et Kotlin
Julien Ponge
March 29, 2018
Tweet
Share
More Decks by Julien Ponge
See All by Julien Ponge
jponge
0
110
jponge
0
140
jponge
0
230
jponge
0
140
jponge
0
100
jponge
0
180
jponge
0
180
jponge
0
160
jponge
0
120
Other Decks in Programming
See All in Programming
ganchan11
0
160
yosuke_furukawa
PRO
1
330
yasuakiomokawa
0
610
hkusu
0
280
timeseriesfr
0
120
imk2o
0
200
minodriven
37
28k
hamakou108
4
520
yusuke57
2
290
dunglas
5
5.6k
ickx
3
640
d_endo
1
510
Featured
See All Featured
samlambert
237
10k
mojombo
359
62k
iamctodd
22
2.2k
tanoku
259
24k
ufuk
56
5.5k
kastner
54
2k
thoeni
4
660
mza
80
4.2k
chriscoyier
779
240k
addyosmani
495
110k
sstephenson
146
12k
philhawksworth
192
8.9k
Transcript
Démystifier le réactif et l'orchestration de services avec Vert.x, Kubernetes
et Kotlin
Julien Ponge Maitre de Conférences “Delegated consultant to Red Hat”
on Vert.x Eclipse Golo + extensive F/OSS background ! https://julien.ponge.org/ " @jponge # @jponge https://www.mixcloud.com/hclcast/
“No to average expertise on any of these technologies” !
" (or async)
Kotlin? (1 slide to be an expert)
data class Person(val name: String, val age: Int) fun String.yo()
{ println("$this -> Yo!") } fun wrap(block: () -> Unit) { println("{{{") block() println("}}}") } fun main(args: Array<String>) { wrap { val phil = Person(name="Philippe", age=45) println(phil) phil.name.yo() } }
data class Person(val name: String, val age: Int) fun String.yo()
{ println("$this -> Yo!") } fun wrap(block: () -> Unit) { println("{{{") block() println("}}}") } fun main(args: Array<String>) { wrap { val phil = Person(name="Philippe", age=45) println(phil) phil.name.yo() } }
data class Person(val name: String, val age: Int) fun String.yo()
{ println("$this -> Yo!") } fun wrap(block: () -> Unit) { println("{{{") block() println("}}}") } fun main(args: Array<String>) { wrap { val phil = Person(name="Philippe", age=45) println(phil) phil.name.yo() } }
data class Person(val name: String, val age: Int) fun String.yo()
{ println("$this -> Yo!") } fun wrap(block: () -> Unit) { println("{{{") block() println("}}}") } fun main(args: Array<String>) { wrap { val phil = Person(name="Philippe", age=45) println(phil) phil.name.yo() } } {{{ Person(name=Philippe, age=45) Philippe -> Yo! }}}
Reactive? (because resources are scarce)
None
Application
Reactive systems Reactive streams Reactive programming Reactive “Responding to stimuli”
Manifesto, Actor, Messages Resilience, Elasticity, Scalability, Asynchronous, non-blocking Data flow Back-pressure Non-blocking Data flow Events, Observable Spreadsheets Akka, Vert.x Akka Streams, RxJava, Reactor, Vert.x Reactor, Reactive Spring, RxJava, Vert.x
while (isRunning) { String line = bufferedReader.readLine(); switch (line.substring(0, 4))
{ case "ECHO": bufferedWriter.write(line); break // ... // other cases ( ...) // ... default: bufferedWriter.write("UNKW Unknown command"); } }
x 1000 = %
Virtual machines, Containers, etc
None
Vert.x? (async all the things!)
Eclipse Vert.x Open source project started in 2012 Eclipse /
Apache licensing A toolkit for building reactive applications for the JVM 7K ⋆ on ' Built on top of ! https://vertx.io " @vertx_project
( ) ( Http server verticle Database client verticle
Event Bus + ) “Details for user 1234?” “{data}” 4 instances 1 instance
Events Thread Event Loop
Verticles ( ( ( public class SomeVerticle extends AbstractVerticle
{ @Override public void start() throws Exception { } @Override public void stop() throws Exception { } } class SomeVerticle : AbstractVerticle() { override fun start() { } override fun stop() { } } exports.vertxStart = function() { } exports.vertxStop = function() { }
(demo) Hello Kotlin + Vert.x
None
Async is hard (callback hell is just one facet)
Kotlin coroutines Looks “like” sequential operations async/await, Go-style channels
None
RxJava2 + Kotlin extensions Declarative data flows over event sources
Operators transforming data + event streams
fun main(args: Array<String>) { val rand = Random() val o1
= Observable .fromCallable(rand ::nextInt) .repeat() .take(500, TimeUnit.MILLISECONDS) .filter { it > 0 } .filter { it % 2 == 0 } .map { "[${it}]" } val o2 = Observable.fromIterable(1 ..Long.MAX_VALUE) Observables .zip(o1, o2) { n, id -> "${id} -> ${n}" } .subscribeBy( onNext = logger ::info, onError = { logger.error("Oh?") }, onComplete = { logger.info("Done!") } ) } “id -> [n]” zip()
Kubernetes? (orchestrating containers for you)
https://cloud.google.com/kubernetes-engine/kubernetes-comic
None
https://cloud.google.com/kubernetes-engine/kubernetes-comic
https://cloud.google.com/kubernetes-engine/kubernetes-comic
Pod Pod Pod Pod Pod Pod Pod Pod Node Node
Master(s)
Same host Same network Same namespace Same volumes Same secrets
Pod Container Container Container
Container Container Container Pod replicas & scaling Readiness probes Liveness
probes Restart policy Rolling upgrades (…)
Using Kubernetes (minikube is your friend)
⚙ Temperatures services Aggregate Alarm
Vert.x callbacks Coroutines, liveness RxKotlin Discovery RxKotlin, SockJS event bus
bridge, VueJS, MongoDB
(demo) Kubernetes (minikube) https://github.com/jponge/demo-vertx-kotlin-rxjava2-kubernetes
Outro (how was the nap?)
Unified end-to-end reactive model + ecosystem (not just APIs…) For
all kinds of distributed applications (even the small-scale ones) Flexible toolkit, not a framework (your needs, your call)
https: //youtu.be/ZkWsilpiSqw - Applications réactives avec Eclipse Vert.x . Building
Reactive Microservices in Java https: //goo.gl/ep6yB9 . Guide to async programming with Vert.x for Java developers https: //goo.gl/AcWW3A
Q&A ! https://julien.ponge.org/ " @jponge # @jponge https://www.mixcloud.com/hclcast/