Vertx for worlddomination

Post on 10-May-2015

1.409 views 0 download

Tags:

description

A variation of the talk I gave at JavaLand.

Transcript of Vertx for worlddomination

World Domination+ Vert.x

?

DOES!IT!

SCALE ?

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

C10K

ZZZZZZZZZz

ZZZZZZZZZzZZZZZZZZZz

CPU

ABC

42

1 2 3

4 5 6

7 8 90

volatile

CyclicBarrier

AtomicBoolean

synchronized

ReentrantLock

AtomicInteger

AtomicCafe

Thread

ThreadPoolExecutor

RunnableCallable

contentionI/O

Single Thread

1 Thread w/ lock

2 Threads w/ lock

1 Thread w/ CAS

2 Threads w/ CAS

Volatile

0 12500 25000 37500 50000

Contention

https://github.com/codepitbull/lockperformance

I/OAcces type cycles

L1- Cache 3

L2-Cache 14

RAM 250

Disk 41000000

Network 240000000

http://blog.mixu.net/2011/02/01/understanding-the-node-js-event-loop/

Channel AChannel BChannel CChannel D

Selector

Event Handler 1Event Handler 2Event Handler 3Event Handler 4Event Handler 5

12.10.2012

Quasar

生 ॐ СВОБОДА

Microservice!

certified !

Verticle

Module

1

0..n0..n

Verticle

Module

1

0..n

0..n

1

System

vert.x

module1

verticle 1 verticle 2

module2

verticle 3 verticle 4

class MustacheRendererVerticle extends Verticle { DefaultMustacheFactory mf = new DefaultMustacheFactory( "de/codepitbull/javaland/mustache"); @Override def start() { vertx.eventBus.registerHandler("template.render", { message -> Mustache mustache = mf.compile(message.body()); StringWriter sw = new StringWriter(); mustache.execute(sw, new Example()).flush(); message.reply(sw.getBuffer().toString()); }); }}

import org.vertx.groovy.platform.Verticleclass DemoVerticle extends Verticle { @Override Object start() { container.deployModule("io.vertx~mod-web-server~2.0.0-final", container.config) }}

io.vertx~mod-web-server~2.0.0-final

officialcommunity

生 ॐ СВОБОДА

Verticle Verticle Verticle Verticle

Verticle Verticle Verticle Verticle

mod 2mod 1CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

vertx -cluster

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

mod 2mod 1

Multicast

mod 2mod 1CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

vertx -hamod ? mod ? mod ? mod ?

mod ? mod ? mod ? mod ?

CPU

CPU

CPU

CPU

CPU

CPU

CPU

CPU

mod 2mod 1

DEMO

Leseliste/Quellen

http://martinfowler.com/articles/microservices.html http://www.cs.wustl.edu/~schmidt/PDF/reactor-siemens.pdf http://tutorials.jenkov.com/java-nio/selectors.html https://www.ibm.com/developerworks/java/library/j-jtp02225/ http://blog.tsunanet.net/2010/11/how-long-does-it-take-to-make-context.html http://blog.mixu.net/2011/02/01/understanding-the-node-js-event-loop/ http://lmax-exchange.github.io/disruptor/ https://github.com/codepitbull/lockperformance