6 reasons Jubilee could be a Rubyist's new best friend

394
6 REASONS JUBILEE COULD BE A RUBYIST’S NEW BEST FRIEND FORREST CHANG @FKCHANG2000 https://bambegin.files.wordpress.com/2014/09/tumblr_mfm9lq28cn1s14crlo1_500.jpg

description

(Video here: http://confreaks.com/videos/5014-RubyConf2014-6-reasons-jubilee-could-be-a-rubyist-s-new-best-friend or https://www.youtube.com/watch?feature=player_embedded&v=FFR0G89WXI8) Rubyconf 2014 talk on Jubilee, a Vert.x module that runs rack apps. Alternate titles Beyond Rails while using Rails Rails can't do everything I want and makes me want to cry Rubyconf abstract Do you do web development in Ruby? Have you been forced to go to node or other technologies just for concurrency/websockets etc. Do miss your gems, and tire of functionality you have to implement from scratch? Do you hate javascript? Well no need to switch languages/platforms, Jubilee could be your new best friend. Jubilee, a rack server on top of Vert.x gives you * Concurrency * Speed * Easy Websockets support * Shared Memory * Access to the JVM ecosystem * Ability to reuse your existing Ruby knowledge and gems "Say Hello to your new friend" - Al Pacino

Transcript of 6 reasons Jubilee could be a Rubyist's new best friend

Page 1: 6 reasons Jubilee could be a Rubyist's new best friend

6 R E A S O N S J U B I L E E C O U L D B E A R U B Y I S T ’ S N E W B E S T F R I E N D

F O R R E S T C H A N G @ F K C H A N G 2 0 0 0

https://bambegin.files.wordpress.com/2014/09/tumblr_mfm9lq28cn1s14crlo1_500.jpg

Page 2: 6 reasons Jubilee could be a Rubyist's new best friend

A P O L O G I E S

http://images.sodahead.com/blogs/000302881/sorry20really20truly20very20apology_xlarge.jpeg.

Page 3: 6 reasons Jubilee could be a Rubyist's new best friend

A LT E R N AT E T I T L E S A F T E R S E E I N G

E R N I E M I L L E R ’ S R U B Y A F T E R R A I L S

Page 4: 6 reasons Jubilee could be a Rubyist's new best friend

!

R A I L S W H I L E S T I L L U S I N G R A I L S

Page 5: 6 reasons Jubilee could be a Rubyist's new best friend

O R

Page 6: 6 reasons Jubilee could be a Rubyist's new best friend

R A I L S C A N ’ T D O A L L T H E S T U F F I WA N T A N Y M O R E A N D < F I L L I N T H E T E C H > M A K E S M E WA N T T O C RY

http://www.louiseoneillauthor.com/wp-content/uploads/2014/06/crying-baby.jpg

Page 7: 6 reasons Jubilee could be a Rubyist's new best friend

P R E L U D E

Page 8: 6 reasons Jubilee could be a Rubyist's new best friend

Q U E S T I O N

http://wp.production.patheos.com/blogs/faithwalkers/files/2013/09/god-question.jpg

Page 9: 6 reasons Jubilee could be a Rubyist's new best friend

W H Y A R E Y O U H E R E AT R U B Y C O N F ?

Page 10: 6 reasons Jubilee could be a Rubyist's new best friend

A N A N S W E R

Page 11: 6 reasons Jubilee could be a Rubyist's new best friend

Y O U L I K E R U B Y

Page 12: 6 reasons Jubilee could be a Rubyist's new best friend

W H Y D O Y O U L I K E R U B Y ?

Page 13: 6 reasons Jubilee could be a Rubyist's new best friend

B E C A U S E I T M A K E S Y O U H A P P Y

Page 14: 6 reasons Jubilee could be a Rubyist's new best friend

– M AT Z

“For me the purpose of life is partly to have joy. Programmers often feel joy when they can

concentrate on the creative side of programming, So Ruby is designed to make programmers happy.”

http://euruko.org/img/matz_800.jpg

Page 15: 6 reasons Jubilee could be a Rubyist's new best friend

– M AT Z

“For me the purpose of life is partly to have joy. Programmers often feel joy when they can

concentrate on the creative side of programming, So Ruby is designed to make programmers happy.”

http://euruko.org/img/matz_800.jpg

Page 16: 6 reasons Jubilee could be a Rubyist's new best friend

H A P P I N E S S I S T H E R U B Y W AY

Page 17: 6 reasons Jubilee could be a Rubyist's new best friend

O B J E C T I V E

Page 18: 6 reasons Jubilee could be a Rubyist's new best friend

O B J E C T I V E

• To ensure you, the Rubyist, stays happy

Page 19: 6 reasons Jubilee could be a Rubyist's new best friend

H A P P I N E S S I S A R E C U R R I N G T H E M E

• J

• D

• D

I N M Y TA L K S , A S W E L L A S H E R E AT R U B Y C O N F

Page 20: 6 reasons Jubilee could be a Rubyist's new best friend

H A P P I N E S S I S A R E C U R R I N G T H E M E

• J

• D

• D

• Joy

I N M Y TA L K S , A S W E L L A S H E R E AT R U B Y C O N F

Page 21: 6 reasons Jubilee could be a Rubyist's new best friend

H A P P I N E S S I S A R E C U R R I N G T H E M E

• J

• D

• D

• Joy

• Driven

I N M Y TA L K S , A S W E L L A S H E R E AT R U B Y C O N F

Page 22: 6 reasons Jubilee could be a Rubyist's new best friend

H A P P I N E S S I S A R E C U R R I N G T H E M E

• J

• D

• D

• Joy

• Driven

• Development

I N M Y TA L K S , A S W E L L A S H E R E AT R U B Y C O N F

Page 23: 6 reasons Jubilee could be a Rubyist's new best friend

C O D I N G A N D L O V I N G I T

Page 24: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT D O W E L I K E A B O U T R U B Y ?

Page 25: 6 reasons Jubilee could be a Rubyist's new best friend

1 ) L A N G U A G E I T S E L F I S D E L I G H T F U L

Page 26: 6 reasons Jubilee could be a Rubyist's new best friend

1 ) L A N G U A G E I T S E L F I S D E L I G H T F U L

• An entire talk can be done on this

Page 27: 6 reasons Jubilee could be a Rubyist's new best friend

1 ) L A N G U A G E I T S E L F I S D E L I G H T F U L

• An entire talk can be done on this

• So I won't do one

Page 28: 6 reasons Jubilee could be a Rubyist's new best friend

S I N G L E E X A M P L E F R O M D E V I S E C O N F I G

# ==> Configuration for :validatable!# Range for password length. Default is 8..128.!config.password_length = 8..128

Page 29: 6 reasons Jubilee could be a Rubyist's new best friend

S I N G L E E X A M P L E F R O M D E V I S E C O N F I G

# ==> Configuration for :validatable!# Range for password length. Default is 8..128.!config.password_length = 8..128

• Intent is so clear

Page 30: 6 reasons Jubilee could be a Rubyist's new best friend

S I N G L E E X A M P L E F R O M D E V I S E C O N F I G

# ==> Configuration for :validatable!# Range for password length. Default is 8..128.!config.password_length = 8..128

• Intent is so clear

• Nothing extraneous

Page 31: 6 reasons Jubilee could be a Rubyist's new best friend

S I N G L E E X A M P L E F R O M D E V I S E C O N F I G

# ==> Configuration for :validatable!# Range for password length. Default is 8..128.!config.password_length = 8..128

• Intent is so clear

• Nothing extraneous

• Compared to new TimeRange(8, 128)

Page 32: 6 reasons Jubilee could be a Rubyist's new best friend

S I N G L E E X A M P L E F R O M D E V I S E C O N F I G

# ==> Configuration for :validatable!# Range for password length. Default is 8..128.!config.password_length = 8..128

• Intent is so clear

• Nothing extraneous

• Compared to new TimeRange(8, 128)

• Beautiful

Page 33: 6 reasons Jubilee could be a Rubyist's new best friend

R U B Y M A K E S M E H A P P Y

Page 34: 6 reasons Jubilee could be a Rubyist's new best friend

R U B Y M A K E S M E H A P P Y

Page 35: 6 reasons Jubilee could be a Rubyist's new best friend

2 ) G E M S A N D F R A M E W O R K S

Page 36: 6 reasons Jubilee could be a Rubyist's new best friend

2 ) G E M S A N D F R A M E W O R K S

• Many gems, nearly anything you'd want ready to go

Page 37: 6 reasons Jubilee could be a Rubyist's new best friend

2 ) G E M S A N D F R A M E W O R K S

• Many gems, nearly anything you'd want ready to go

• Choice, often more than 1 gem for the job

Page 38: 6 reasons Jubilee could be a Rubyist's new best friend

2 ) G E M S A N D F R A M E W O R K S

• Many gems, nearly anything you'd want ready to go

• Choice, often more than 1 gem for the job

• Gem authors tend to emulate Matz and try to make the programmer happy

Page 39: 6 reasons Jubilee could be a Rubyist's new best friend

800lb Gorilla of Rubygems

http://www.examiner.com/images/blog/wysiwyg/image/4056_Landing_gorilla-1.jpg

Page 40: 6 reasons Jubilee could be a Rubyist's new best friend

R A I L S

Page 41: 6 reasons Jubilee could be a Rubyist's new best friend

R A I L S

• Who codes in Rails?

Page 42: 6 reasons Jubilee could be a Rubyist's new best friend

R A I L S

• Who codes in Rails?

• Who came to Ruby from Rails?

Page 43: 6 reasons Jubilee could be a Rubyist's new best friend

R A I L S

• Who codes in Rails?

• Who came to Ruby from Rails?

• Who was coding Ruby before Rails?

Page 44: 6 reasons Jubilee could be a Rubyist's new best friend

R A I L S

• Who codes in Rails?

• Who came to Ruby from Rails?

• Who was coding Ruby before Rails?

• Who loves Rails?

Page 45: 6 reasons Jubilee could be a Rubyist's new best friend

R A I L S

• Who codes in Rails?

• Who came to Ruby from Rails?

• Who was coding Ruby before Rails?

• Who loves Rails?

• Who has a job because of Rails?

Page 46: 6 reasons Jubilee could be a Rubyist's new best friend

W H Y W E L O V E R A I L S

Page 47: 6 reasons Jubilee could be a Rubyist's new best friend

W H Y W E L O V E R A I L S

• A whole talk can be done this

Page 48: 6 reasons Jubilee could be a Rubyist's new best friend

W H Y W E L O V E R A I L S

• A whole talk can be done this

• So I won't do one

Page 49: 6 reasons Jubilee could be a Rubyist's new best friend

W H Y W E L O V E R A I L S

• A whole talk can be done this

• So I won't do one

• Productivity

Page 50: 6 reasons Jubilee could be a Rubyist's new best friend

W H Y W E L O V E R A I L S

• A whole talk can be done this

• So I won't do one

• Productivity

• Programmer interface - Omokase, designed to make the coder happy

Page 51: 6 reasons Jubilee could be a Rubyist's new best friend

R A I L S C A N M A K E S Y O U H A P P Y

Page 52: 6 reasons Jubilee could be a Rubyist's new best friend

R A I L S C A N M A K E S Y O U H A P P Y

Page 53: 6 reasons Jubilee could be a Rubyist's new best friend

R U B Y I S N O T A PA N A C E A

Page 54: 6 reasons Jubilee could be a Rubyist's new best friend

S O M E R E A S O N S T O N O T U S E R U B Y

Page 55: 6 reasons Jubilee could be a Rubyist's new best friend

S O M E R E A S O N S T O N O T U S E R U B Y

• Speed

Page 56: 6 reasons Jubilee could be a Rubyist's new best friend

S O M E R E A S O N S T O N O T U S E R U B Y

• Speed

• Image processing, video encoding

Page 57: 6 reasons Jubilee could be a Rubyist's new best friend

S O M E R E A S O N S T O N O T U S E R U B Y

• Speed

• Image processing, video encoding

• Scaling

Page 58: 6 reasons Jubilee could be a Rubyist's new best friend

S O M E R E A S O N S T O N O T U S E R U B Y

• Speed

• Image processing, video encoding

• Scaling

• Resource heavy

Page 59: 6 reasons Jubilee could be a Rubyist's new best friend

S O M E R E A S O N S T O N O T U S E R U B Y

• Speed

• Image processing, video encoding

• Scaling

• Resource heavy

• Computation heavy

Page 60: 6 reasons Jubilee could be a Rubyist's new best friend

S O M E R E A S O N S T O N O T U S E R U B Y

• Speed

• Image processing, video encoding

• Scaling

• Resource heavy

• Computation heavy

• More/better Library functionality elsewhere

Page 61: 6 reasons Jubilee could be a Rubyist's new best friend

S O M E R E A S O N S T O N O T U S E R U B Y

• Speed

• Image processing, video encoding

• Scaling

• Resource heavy

• Computation heavy

• More/better Library functionality elsewhere

• Scientific programming support better in Python, etc.

Page 62: 6 reasons Jubilee could be a Rubyist's new best friend

A L L L E G I T R E A S O N S

Page 63: 6 reasons Jubilee could be a Rubyist's new best friend

P R O B L E M

Page 64: 6 reasons Jubilee could be a Rubyist's new best friend

P R O B L E MSome non Ruby technologies can be “Less Happy Making”

Page 65: 6 reasons Jubilee could be a Rubyist's new best friend

A C O M M O N A LT E R N AT I V E

Page 66: 6 reasons Jubilee could be a Rubyist's new best friend

N O D E , W H AT I T I S G O O D F O R ?

Page 67: 6 reasons Jubilee could be a Rubyist's new best friend

N O D E , W H AT I T I S G O O D F O R ?

Page 68: 6 reasons Jubilee could be a Rubyist's new best friend

N O D E , W H AT I T I S G O O D F O R ?

• Quick, Non blocking I/O

Page 69: 6 reasons Jubilee could be a Rubyist's new best friend

N O D E , W H AT I T I S G O O D F O R ?

• Quick, Non blocking I/O

• Concurrency

Page 70: 6 reasons Jubilee could be a Rubyist's new best friend

N O D E , W H AT I T I S G O O D F O R ?

• Quick, Non blocking I/O

• Concurrency

• Chat app demonstrates Node’s sweet spot

Page 71: 6 reasons Jubilee could be a Rubyist's new best friend

N O D E , W H AT I T I S G O O D F O R ?

• Quick, Non blocking I/O

• Concurrency

• Chat app demonstrates Node’s sweet spot

• high concurrency

Page 72: 6 reasons Jubilee could be a Rubyist's new best friend

N O D E , W H AT I T I S G O O D F O R ?

• Quick, Non blocking I/O

• Concurrency

• Chat app demonstrates Node’s sweet spot

• high concurrency

• quick, low CPU usage transactions

Page 73: 6 reasons Jubilee could be a Rubyist's new best friend

N O D E , W H AT I T I S G O O D F O R ?

• Quick, Non blocking I/O

• Concurrency

• Chat app demonstrates Node’s sweet spot

• high concurrency

• quick, low CPU usage transactions

• server push

Page 74: 6 reasons Jubilee could be a Rubyist's new best friend

N O D E , W H AT I T I S G O O D F O R ?

• Quick, Non blocking I/O

• Concurrency

• Chat app demonstrates Node’s sweet spot

• high concurrency

• quick, low CPU usage transactions

• server push

• so called "modern webapp"

Page 75: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT I T N O D E B A D AT ?

Page 76: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT I T N O D E B A D AT ?

• Vertical scaling

Page 77: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT I T N O D E B A D AT ?

• Vertical scaling

• CPU intensive

Page 78: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT I T N O D E B A D AT ?

• Vertical scaling

• CPU intensive

• Integration with other systems

Page 79: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT I T N O D E B A D AT ?

• Vertical scaling

• CPU intensive

• Integration with other systems

• Decent language (Ruby bias)

Page 80: 6 reasons Jubilee could be a Rubyist's new best friend

T O O M U C H J AVA S C R I P T A N D

Page 81: 6 reasons Jubilee could be a Rubyist's new best friend

S O , H O W D O W E

Page 82: 6 reasons Jubilee could be a Rubyist's new best friend

B R I N G B A C K T H AT L O V I N G F E E L I N G ?

Page 83: 6 reasons Jubilee could be a Rubyist's new best friend

B R I N G B A C K T H AT L O V I N G F E E L I N G ?

Page 84: 6 reasons Jubilee could be a Rubyist's new best friend
Page 85: 6 reasons Jubilee could be a Rubyist's new best friend

• Who's heard of it?

Page 86: 6 reasons Jubilee could be a Rubyist's new best friend

• Who's heard of it?

• Oversimplified - Node for the JVM

Page 87: 6 reasons Jubilee could be a Rubyist's new best friend

• Who's heard of it?

• Oversimplified - Node for the JVM

• BUT much more - more like Node++ and then some

Page 88: 6 reasons Jubilee could be a Rubyist's new best friend

D E S I G N E D F O R M O D E R N A P P L I C AT I O N S

Page 89: 6 reasons Jubilee could be a Rubyist's new best friend

D E S I G N E D F O R M O D E R N A P P L I C AT I O N S

Page 90: 6 reasons Jubilee could be a Rubyist's new best friend

D E S I G N E D F O R M O D E R N A P P L I C AT I O N S

Ruby/ JRuby

Page 91: 6 reasons Jubilee could be a Rubyist's new best friend

D E S I G N E D F O R M O D E R N A P P L I C AT I O N S

Ruby/ JRuby

Page 92: 6 reasons Jubilee could be a Rubyist's new best friend

D E S I G N E D F O R M O D E R N A P P L I C AT I O N S

Ruby/ JRuby

Page 93: 6 reasons Jubilee could be a Rubyist's new best friend

D E S I G N E D F O R M O D E R N A P P L I C AT I O N S

Ruby/ JRuby

Page 94: 6 reasons Jubilee could be a Rubyist's new best friend

S O M E K E Y F E AT U R E S

Page 95: 6 reasons Jubilee could be a Rubyist's new best friend

S O M E K E Y F E AT U R E S

Page 96: 6 reasons Jubilee could be a Rubyist's new best friend

S O M E K E Y F E AT U R E S

Page 97: 6 reasons Jubilee could be a Rubyist's new best friend

S O M E K E Y F E AT U R E S

Page 98: 6 reasons Jubilee could be a Rubyist's new best friend

S O M E K E Y F E AT U R E S

Page 99: 6 reasons Jubilee could be a Rubyist's new best friend

L I K E N O D E

Page 100: 6 reasons Jubilee could be a Rubyist's new best friend

L I K E N O D E

• Concurrency - Implements the same Reactor Pattern

Page 101: 6 reasons Jubilee could be a Rubyist's new best friend

L I K E N O D E

• Concurrency - Implements the same Reactor Pattern

• Non blocking i/o

Page 102: 6 reasons Jubilee could be a Rubyist's new best friend

L I K E N O D E

• Concurrency - Implements the same Reactor Pattern

• Non blocking i/o

• Fast

Page 103: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E

Page 104: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E

• Handles CPU intensive

Page 105: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E

• Handles CPU intensive

• JVM fast (JRuby fastes of the Rubies)

Page 106: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E

• Handles CPU intensive

• JVM fast (JRuby fastes of the Rubies)

• JVM thread friendly

Page 107: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E

• Handles CPU intensive

• JVM fast (JRuby fastes of the Rubies)

• JVM thread friendly

• Handles Blocking IO or Long running operations

Page 108: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E

• Handles CPU intensive

• JVM fast (JRuby fastes of the Rubies)

• JVM thread friendly

• Handles Blocking IO or Long running operations

• Worker verticles - uses threadpools

Page 109: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E

• Handles CPU intensive

• JVM fast (JRuby fastes of the Rubies)

• JVM thread friendly

• Handles Blocking IO or Long running operations

• Worker verticles - uses threadpools

• System scaling

Page 110: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E

• Handles CPU intensive

• JVM fast (JRuby fastes of the Rubies)

• JVM thread friendly

• Handles Blocking IO or Long running operations

• Worker verticles - uses threadpools

• System scaling

• Horizontal scaling- Clustering

Page 111: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E

• Handles CPU intensive

• JVM fast (JRuby fastes of the Rubies)

• JVM thread friendly

• Handles Blocking IO or Long running operations

• Worker verticles - uses threadpools

• System scaling

• Horizontal scaling- Clustering

• Vertical scaling- Verticle per CPU

Page 112: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 2

Page 113: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 2

• Polyglot

Page 114: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 2

• Polyglot

• Official idiomatic API support: Java, Javascript, Groovy, Coffeescript, *Ruby (by way of JRuby)*, Python

Page 115: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 2

• Polyglot

• Official idiomatic API support: Java, Javascript, Groovy, Coffeescript, *Ruby (by way of JRuby)*, Python

• Beta: Clojure, Scala, PhP (really?)

Page 116: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 2

• Polyglot

• Official idiomatic API support: Java, Javascript, Groovy, Coffeescript, *Ruby (by way of JRuby)*, Python

• Beta: Clojure, Scala, PhP (really?)

• any JVM lang or one compiles to a JVM language

Page 117: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 2

• Polyglot

• Official idiomatic API support: Java, Javascript, Groovy, Coffeescript, *Ruby (by way of JRuby)*, Python

• Beta: Clojure, Scala, PhP (really?)

• any JVM lang or one compiles to a JVM language

• General Applications platform

Page 118: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 2

• Polyglot

• Official idiomatic API support: Java, Javascript, Groovy, Coffeescript, *Ruby (by way of JRuby)*, Python

• Beta: Clojure, Scala, PhP (really?)

• any JVM lang or one compiles to a JVM language

• General Applications platform

• “modern web pages”

Page 119: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 2

• Polyglot

• Official idiomatic API support: Java, Javascript, Groovy, Coffeescript, *Ruby (by way of JRuby)*, Python

• Beta: Clojure, Scala, PhP (really?)

• any JVM lang or one compiles to a JVM language

• General Applications platform

• “modern web pages”

• traditional enterprise backends

Page 120: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 3

Page 121: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 3

• Designed to build systems of systems

Page 122: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 3

• Designed to build systems of systems

• Easy High Availability

Page 123: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 3

• Designed to build systems of systems

• Easy High Availability

• Easy Clustering

Page 124: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 3

• Designed to build systems of systems

• Easy High Availability

• Easy Clustering

• Easy subsystem Intercommunication

Page 125: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 3

• Designed to build systems of systems

• Easy High Availability

• Easy Clustering

• Easy subsystem Intercommunication

• Event Bus

Page 126: 6 reasons Jubilee could be a Rubyist's new best friend

B E T T E R T H A N N O D E , PA R T 3

• Designed to build systems of systems

• Easy High Availability

• Easy Clustering

• Easy subsystem Intercommunication

• Event Bus

• Shared Data

Page 127: 6 reasons Jubilee could be a Rubyist's new best friend

C O R E A P I S - W H AT Y O U N E E D

Page 128: 6 reasons Jubilee could be a Rubyist's new best friend

C O R E A P I S - W H AT Y O U N E E D

• TCP/SSL clients and servers

Page 129: 6 reasons Jubilee could be a Rubyist's new best friend

C O R E A P I S - W H AT Y O U N E E D

• TCP/SSL clients and servers

• HTTP/HTTPS clients and servers

Page 130: 6 reasons Jubilee could be a Rubyist's new best friend

C O R E A P I S - W H AT Y O U N E E D

• TCP/SSL clients and servers

• HTTP/HTTPS clients and servers

• Websockets

Page 131: 6 reasons Jubilee could be a Rubyist's new best friend

C O R E A P I S - W H AT Y O U N E E D

• TCP/SSL clients and servers

• HTTP/HTTPS clients and servers

• Websockets

• SockJS

Page 132: 6 reasons Jubilee could be a Rubyist's new best friend

C O R E A P I S - W H AT Y O U N E E D

• TCP/SSL clients and servers

• HTTP/HTTPS clients and servers

• Websockets

• SockJS

• File system

Page 133: 6 reasons Jubilee could be a Rubyist's new best friend

C O R E A P I S - W H AT Y O U N E E D

• TCP/SSL clients and servers

• HTTP/HTTPS clients and servers

• Websockets

• SockJS

• File system

• Event bus

Page 134: 6 reasons Jubilee could be a Rubyist's new best friend

C O R E A P I S - W H AT Y O U N E E D

• TCP/SSL clients and servers

• HTTP/HTTPS clients and servers

• Websockets

• SockJS

• File system

• Event bus

• DNS

Page 135: 6 reasons Jubilee could be a Rubyist's new best friend

C O R E A P I S - W H AT Y O U N E E D

• TCP/SSL clients and servers

• HTTP/HTTPS clients and servers

• Websockets

• SockJS

• File system

• Event bus

• DNS

• UDP

Page 136: 6 reasons Jubilee could be a Rubyist's new best friend

D U C T TA P E

Page 137: 6 reasons Jubilee could be a Rubyist's new best friend

D U C T TA P E

• Open SourceSystems are duct taped together

Page 138: 6 reasons Jubilee could be a Rubyist's new best friend

D U C T TA P E

• Open SourceSystems are duct taped together

• We figure out how to do to put together things

Page 139: 6 reasons Jubilee could be a Rubyist's new best friend

D U C T TA P E

• Open SourceSystems are duct taped together

• We figure out how to do to put together things

• Perl used to be the duct tape of the internet, Ruby a cleaner Perl…

Page 140: 6 reasons Jubilee could be a Rubyist's new best friend

D U C T TA P E

• Open SourceSystems are duct taped together

• We figure out how to do to put together things

• Perl used to be the duct tape of the internet, Ruby a cleaner Perl…

• Gems formalize that

Page 141: 6 reasons Jubilee could be a Rubyist's new best friend

D U C T TA P E

• Open SourceSystems are duct taped together

• We figure out how to do to put together things

• Perl used to be the duct tape of the internet, Ruby a cleaner Perl…

• Gems formalize that

• In Node, thats what you do even more

Page 142: 6 reasons Jubilee could be a Rubyist's new best friend

V E R T. X D E S I G N E D F O R I N T E G R AT E D S Y S T E M S

Page 143: 6 reasons Jubilee could be a Rubyist's new best friend

D I F F E R E N T T Y P E S O F P R O C E S S E S

Page 144: 6 reasons Jubilee could be a Rubyist's new best friend

D I F F E R E N T T Y P E S O F P R O C E S S E S

• Asynchronous - Verticle

Page 145: 6 reasons Jubilee could be a Rubyist's new best friend

D I F F E R E N T T Y P E S O F P R O C E S S E S

• Asynchronous - Verticle

• Blocking/CPU intensive - worker verticle

Page 146: 6 reasons Jubilee could be a Rubyist's new best friend

I N T E R P R O C E S S / S Y S T E M C O M M U N I C AT I O N

Page 147: 6 reasons Jubilee could be a Rubyist's new best friend

I N T E R P R O C E S S / S Y S T E M C O M M U N I C AT I O N

• Event Bus

Page 148: 6 reasons Jubilee could be a Rubyist's new best friend

I N T E R P R O C E S S / S Y S T E M C O M M U N I C AT I O N

• Event Bus

• publish

Page 149: 6 reasons Jubilee could be a Rubyist's new best friend

I N T E R P R O C E S S / S Y S T E M C O M M U N I C AT I O N

• Event Bus

• publish

• direct message

Page 150: 6 reasons Jubilee could be a Rubyist's new best friend

I N T E R P R O C E S S / S Y S T E M C O M M U N I C AT I O N

• Event Bus

• publish

• direct message

• direct message reply

Page 151: 6 reasons Jubilee could be a Rubyist's new best friend

I N T E R P R O C E S S / S Y S T E M C O M M U N I C AT I O N

• Event Bus

• publish

• direct message

• direct message reply

• extends into the browser

Page 152: 6 reasons Jubilee could be a Rubyist's new best friend

I N T E R P R O C E S S / S Y S T E M C O M M U N I C AT I O N

• Event Bus

• publish

• direct message

• direct message reply

• extends into the browser

• Shared Data

Page 153: 6 reasons Jubilee could be a Rubyist's new best friend

I N T E R P R O C E S S / S Y S T E M C O M M U N I C AT I O N

• Event Bus

• publish

• direct message

• direct message reply

• extends into the browser

• Shared Data

• Hash

Page 154: 6 reasons Jubilee could be a Rubyist's new best friend

I N T E R P R O C E S S / S Y S T E M C O M M U N I C AT I O N

• Event Bus

• publish

• direct message

• direct message reply

• extends into the browser

• Shared Data

• Hash

• Set

Page 155: 6 reasons Jubilee could be a Rubyist's new best friend

S C A L I N G B U I LT I N

Page 156: 6 reasons Jubilee could be a Rubyist's new best friend

S C A L I N G B U I LT I N

• Clustering

Page 157: 6 reasons Jubilee could be a Rubyist's new best friend

S C A L I N G B U I LT I N

• Clustering

• vertx process.rb —cluster

Page 158: 6 reasons Jubilee could be a Rubyist's new best friend

S C A L I N G B U I LT I N

• Clustering

• vertx process.rb —cluster

• High Availability

Page 159: 6 reasons Jubilee could be a Rubyist's new best friend

S C A L I N G B U I LT I N

• Clustering

• vertx process.rb —cluster

• High Availability

• vertx process.rb —ha

Page 160: 6 reasons Jubilee could be a Rubyist's new best friend

A N D M U C H M O R E

Page 161: 6 reasons Jubilee could be a Rubyist's new best friend

A N D M U C H M O R E

• A whole talk could be done on it

Page 162: 6 reasons Jubilee could be a Rubyist's new best friend

A N D M U C H M O R E

• A whole talk could be done on it

• So I won’t do one

Page 163: 6 reasons Jubilee could be a Rubyist's new best friend

A N D M U C H M O R E

• A whole talk could be done on it

• So I won’t do one

• 2 Good overview videos

Page 164: 6 reasons Jubilee could be a Rubyist's new best friend

A N D M U C H M O R E

• A whole talk could be done on it

• So I won’t do one

• 2 Good overview videos

• Tim Fox: Introducing Vert.x 2.0 - Taking Polyglot Application Development to the Next Level https://www.youtube.com/watch?v=3hv4QD5ZvKE

Page 165: 6 reasons Jubilee could be a Rubyist's new best friend

A N D M U C H M O R E

• A whole talk could be done on it

• So I won’t do one

• 2 Good overview videos

• Tim Fox: Introducing Vert.x 2.0 - Taking Polyglot Application Development to the Next Level https://www.youtube.com/watch?v=3hv4QD5ZvKE

• good over view of vert.x capabilities w/lots of live demos

Page 166: 6 reasons Jubilee could be a Rubyist's new best friend

A N D M U C H M O R E

• A whole talk could be done on it

• So I won’t do one

• 2 Good overview videos

• Tim Fox: Introducing Vert.x 2.0 - Taking Polyglot Application Development to the Next Level https://www.youtube.com/watch?v=3hv4QD5ZvKE

• good over view of vert.x capabilities w/lots of live demos

• Vert.x: This ain't your Dad's Node. https://www.youtube.com/watch?v=8ClYUo_A3h0

Page 167: 6 reasons Jubilee could be a Rubyist's new best friend

A N D M U C H M O R E

• A whole talk could be done on it

• So I won’t do one

• 2 Good overview videos

• Tim Fox: Introducing Vert.x 2.0 - Taking Polyglot Application Development to the Next Level https://www.youtube.com/watch?v=3hv4QD5ZvKE

• good over view of vert.x capabilities w/lots of live demos

• Vert.x: This ain't your Dad's Node. https://www.youtube.com/watch?v=8ClYUo_A3h0

• good at showing Vert.x's advantages over Node.js

Page 168: 6 reasons Jubilee could be a Rubyist's new best friend

V E R T. X I S P R E T T Y A W E S O M E

Page 169: 6 reasons Jubilee could be a Rubyist's new best friend

V E R T. X I S P R E T T Y A W E S O M E

Page 170: 6 reasons Jubilee could be a Rubyist's new best friend

B U T I T ’ S M O R E S T U F F T O L E A R N

Page 171: 6 reasons Jubilee could be a Rubyist's new best friend
Page 172: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT I F I T O L D Y O U Y O U C O U L D ?

Page 173: 6 reasons Jubilee could be a Rubyist's new best friend
Page 174: 6 reasons Jubilee could be a Rubyist's new best friend

O R I G I N A L J U B I L E E R E A D M E S L O G A N

Page 175: 6 reasons Jubilee could be a Rubyist's new best friend

O R I G I N A L J U B I L E E R E A D M E S L O G A N

"We need a web framework for Vertx.", you said.

Page 176: 6 reasons Jubilee could be a Rubyist's new best friend

O R I G I N A L J U B I L E E R E A D M E S L O G A N

"We need a web framework for Vertx.", you said.

"But why not use Vertx in your Rails applications, it's the most productive

web framework ever created."

Page 177: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E

Page 178: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E

• Originally Rack server w/ vert.x 2.0 built in

Page 179: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E

• Originally Rack server w/ vert.x 2.0 built in

• Now a Vert.x module that runs Rack

Page 180: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E

• Originally Rack server w/ vert.x 2.0 built in

• Now a Vert.x module that runs Rack

• improved performance and interaction with the Vert.x ecosystem

Page 181: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E

• Originally Rack server w/ vert.x 2.0 built in

• Now a Vert.x module that runs Rack

• improved performance and interaction with the Vert.x ecosystem

• All the power of vert.x AND you can keep doing Ruby/Rack programming

Page 182: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E

• Originally Rack server w/ vert.x 2.0 built in

• Now a Vert.x module that runs Rack

• improved performance and interaction with the Vert.x ecosystem

• All the power of vert.x AND you can keep doing Ruby/Rack programming

• Try that with Node!

Page 183: 6 reasons Jubilee could be a Rubyist's new best friend

6 R E A S O N S V E R T. X C O U L D B E Y O U R N E W B E S T F R I E N D

Page 184: 6 reasons Jubilee could be a Rubyist's new best friend

6 R E A S O N S V E R T. X C O U L D B E Y O U R N E W B E S T F R I E N D

• Concurrency

Page 185: 6 reasons Jubilee could be a Rubyist's new best friend

6 R E A S O N S V E R T. X C O U L D B E Y O U R N E W B E S T F R I E N D

• Concurrency

• Speed

Page 186: 6 reasons Jubilee could be a Rubyist's new best friend

6 R E A S O N S V E R T. X C O U L D B E Y O U R N E W B E S T F R I E N D

• Concurrency

• Speed

• Expanded Ecosystem

Page 187: 6 reasons Jubilee could be a Rubyist's new best friend

6 R E A S O N S V E R T. X C O U L D B E Y O U R N E W B E S T F R I E N D

• Concurrency

• Speed

• Expanded Ecosystem

• Built in upgrade/scaling path

Page 188: 6 reasons Jubilee could be a Rubyist's new best friend

6 R E A S O N S V E R T. X C O U L D B E Y O U R N E W B E S T F R I E N D

• Concurrency

• Speed

• Expanded Ecosystem

• Built in upgrade/scaling path

• Easy web sockets support

Page 189: 6 reasons Jubilee could be a Rubyist's new best friend

6 R E A S O N S V E R T. X C O U L D B E Y O U R N E W B E S T F R I E N D

• Concurrency

• Speed

• Expanded Ecosystem

• Built in upgrade/scaling path

• Easy web sockets support

• Reuse all your existing knowledge/resources

Page 190: 6 reasons Jubilee could be a Rubyist's new best friend

1 ) C O N C U R R E N C Y

Page 191: 6 reasons Jubilee could be a Rubyist's new best friend

1 ) C O N C U R R E N C Y

• Same Reactor pattern as Node

Page 192: 6 reasons Jubilee could be a Rubyist's new best friend

1 ) C O N C U R R E N C Y

• Same Reactor pattern as Node

• Each Verticle single threaded

Page 193: 6 reasons Jubilee could be a Rubyist's new best friend

1 ) C O N C U R R E N C Y

• Same Reactor pattern as Node

• Each Verticle single threaded

• Simple concurrency model, no threading

Page 194: 6 reasons Jubilee could be a Rubyist's new best friend

1 ) C O N C U R R E N C Y

• Same Reactor pattern as Node

• Each Verticle single threaded

• Simple concurrency model, no threading

• Multiple verticles, can do 1 per CPU

Page 195: 6 reasons Jubilee could be a Rubyist's new best friend

2 ) S P E E D

Page 196: 6 reasons Jubilee could be a Rubyist's new best friend

2 ) S P E E D

• JVM faster and getting faster all the time

Page 197: 6 reasons Jubilee could be a Rubyist's new best friend

2 ) S P E E D

• JVM faster and getting faster all the time

• Can use threads, cpus

Page 198: 6 reasons Jubilee could be a Rubyist's new best friend

2 ) S P E E D

• JVM faster and getting faster all the time

• Can use threads, cpus

• Benchmarks

Page 199: 6 reasons Jubilee could be a Rubyist's new best friend

L I E S , D A M N L I E S , A N D B E N C H M A R K S

Page 200: 6 reasons Jubilee could be a Rubyist's new best friend

L I E S , D A M N L I E S , A N D B E N C H M A R K S• http://vertxproject.wordpress.com/2012/05/09/vert-x-vs-node-js-simple-http-

benchmarks/

Page 201: 6 reasons Jubilee could be a Rubyist's new best friend

L I E S , D A M N L I E S , A N D B E N C H M A R K S• http://vertxproject.wordpress.com/2012/05/09/vert-x-vs-node-js-simple-http-

benchmarks/

Ruby

Page 202: 6 reasons Jubilee could be a Rubyist's new best friend

L I E S , D A M N L I E S , A N D B E N C H M A R K S• http://vertxproject.wordpress.com/2012/05/09/vert-x-vs-node-js-simple-http-

benchmarks/

Ruby

Node

Page 203: 6 reasons Jubilee could be a Rubyist's new best friend

L I E S , D A M N L I E S , A N D B E N C H M A R K S• http://vertxproject.wordpress.com/2012/05/09/vert-x-vs-node-js-simple-http-

benchmarks/

Ruby

Node

Node 6 processes

Page 204: 6 reasons Jubilee could be a Rubyist's new best friend
Page 205: 6 reasons Jubilee could be a Rubyist's new best friend

Ruby

Page 206: 6 reasons Jubilee could be a Rubyist's new best friend

Ruby

Best Node

Page 207: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E - 2 N D FA S T E S T R U B Y S E R V E R

Page 208: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E - 2 N D FA S T E S T R U B Y S E R V E R

• http://www.madebymarket.com/blog/dev/ruby-web-benchmark-report.html

Page 209: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E - 2 N D FA S T E S T R U B Y S E R V E R

• http://www.madebymarket.com/blog/dev/ruby-web-benchmark-report.html

• Maximum speed benchmarks vs typical

Page 210: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E - 2 N D FA S T E S T R U B Y S E R V E R

• http://www.madebymarket.com/blog/dev/ruby-web-benchmark-report.html

• Maximum speed benchmarks vs typical

• JRuby clear leader across the board

Page 211: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E - 2 N D FA S T E S T R U B Y S E R V E R

• http://www.madebymarket.com/blog/dev/ruby-web-benchmark-report.html

• Maximum speed benchmarks vs typical

• JRuby clear leader across the board

• Almost as fast as golang

Page 212: 6 reasons Jubilee could be a Rubyist's new best friend
Page 213: 6 reasons Jubilee could be a Rubyist's new best friend
Page 214: 6 reasons Jubilee could be a Rubyist's new best friend
Page 215: 6 reasons Jubilee could be a Rubyist's new best friend

Golang hello world was 10,500 reqs/sec

Page 216: 6 reasons Jubilee could be a Rubyist's new best friend

3 ) E X PA N D E D E C O S Y S T E M

Page 217: 6 reasons Jubilee could be a Rubyist's new best friend

3 ) E X PA N D E D E C O S Y S T E M

• Rubygems

Page 218: 6 reasons Jubilee could be a Rubyist's new best friend

3 ) E X PA N D E D E C O S Y S T E M

• Rubygems

• Must run under JRuby

Page 219: 6 reasons Jubilee could be a Rubyist's new best friend

3 ) E X PA N D E D E C O S Y S T E M

• Rubygems

• Must run under JRuby

• Vertx modules (200 at time of writing)

Page 220: 6 reasons Jubilee could be a Rubyist's new best friend

3 ) E X PA N D E D E C O S Y S T E M

• Rubygems

• Must run under JRuby

• Vertx modules (200 at time of writing)

• Entire JVM ecosystem, languages, libraries

Page 221: 6 reasons Jubilee could be a Rubyist's new best friend

3 ) E X PA N D E D E C O S Y S T E M

• Rubygems

• Must run under JRuby

• Vertx modules (200 at time of writing)

• Entire JVM ecosystem, languages, libraries

• Call other JVM languages directly from JRuby

Page 222: 6 reasons Jubilee could be a Rubyist's new best friend

3 ) E X PA N D E D E C O S Y S T E M

• Rubygems

• Must run under JRuby

• Vertx modules (200 at time of writing)

• Entire JVM ecosystem, languages, libraries

• Call other JVM languages directly from JRuby

• Can run other JVM language verticles and communicate via Event Bus

Page 223: 6 reasons Jubilee could be a Rubyist's new best friend

4 ) B U I LT I N U P G R A D E / S C A L I N G PAT H

Page 224: 6 reasons Jubilee could be a Rubyist's new best friend

4 ) B U I LT I N U P G R A D E / S C A L I N G PAT H

• Designed for multiple verticles (async)

Page 225: 6 reasons Jubilee could be a Rubyist's new best friend

4 ) B U I LT I N U P G R A D E / S C A L I N G PAT H

• Designed for multiple verticles (async)

• Worker verticles (slow)

Page 226: 6 reasons Jubilee could be a Rubyist's new best friend

4 ) B U I LT I N U P G R A D E / S C A L I N G PAT H

• Designed for multiple verticles (async)

• Worker verticles (slow)

• Inter communication

Page 227: 6 reasons Jubilee could be a Rubyist's new best friend

4 ) B U I LT I N U P G R A D E / S C A L I N G PAT H

• Designed for multiple verticles (async)

• Worker verticles (slow)

• Inter communication

• Core APIs

Page 228: 6 reasons Jubilee could be a Rubyist's new best friend

4 ) B U I LT I N U P G R A D E / S C A L I N G PAT H

• Designed for multiple verticles (async)

• Worker verticles (slow)

• Inter communication

• Core APIs

• Event Bus

Page 229: 6 reasons Jubilee could be a Rubyist's new best friend

4 ) B U I LT I N U P G R A D E / S C A L I N G PAT H

• Designed for multiple verticles (async)

• Worker verticles (slow)

• Inter communication

• Core APIs

• Event Bus

• Shared Data

Page 230: 6 reasons Jubilee could be a Rubyist's new best friend

4 ) B U I LT I N U P G R A D E / S C A L I N G PAT H

• Designed for multiple verticles (async)

• Worker verticles (slow)

• Inter communication

• Core APIs

• Event Bus

• Shared Data

• Clustering

Page 231: 6 reasons Jubilee could be a Rubyist's new best friend

4 ) B U I LT I N U P G R A D E / S C A L I N G PAT H

• Designed for multiple verticles (async)

• Worker verticles (slow)

• Inter communication

• Core APIs

• Event Bus

• Shared Data

• Clustering

• High Availability

Page 232: 6 reasons Jubilee could be a Rubyist's new best friend

5 ) E A S Y W E B S O C K E T S S U P P O R T

Page 233: 6 reasons Jubilee could be a Rubyist's new best friend

5 ) E A S Y W E B S O C K E T S S U P P O R T

• SocketIO support

Page 234: 6 reasons Jubilee could be a Rubyist's new best friend

5 ) E A S Y W E B S O C K E T S S U P P O R T

• SocketIO support

• SockJS support

Page 235: 6 reasons Jubilee could be a Rubyist's new best friend

5 ) E A S Y W E B S O C K E T S S U P P O R T

• SocketIO support

• SockJS support

• ** Event Bus **

Page 236: 6 reasons Jubilee could be a Rubyist's new best friend

5 ) E A S Y W E B S O C K E T S S U P P O R T

• SocketIO support

• SockJS support

• ** Event Bus **

• Easy

Page 237: 6 reasons Jubilee could be a Rubyist's new best friend

5 ) E A S Y W E B S O C K E T S S U P P O R T

• SocketIO support

• SockJS support

• ** Event Bus **

• Easy

• Extends into the browser

Page 238: 6 reasons Jubilee could be a Rubyist's new best friend

6 ) R E U S E A L L Y O U R E X I S T I N G K N O W L E D G E /R E S O U R C E S

Page 239: 6 reasons Jubilee could be a Rubyist's new best friend

6 ) R E U S E A L L Y O U R E X I S T I N G K N O W L E D G E /R E S O U R C E S

• Ruby

Page 240: 6 reasons Jubilee could be a Rubyist's new best friend

6 ) R E U S E A L L Y O U R E X I S T I N G K N O W L E D G E /R E S O U R C E S

• Ruby

• Rack programming

Page 241: 6 reasons Jubilee could be a Rubyist's new best friend

6 ) R E U S E A L L Y O U R E X I S T I N G K N O W L E D G E /R E S O U R C E S

• Ruby

• Rack programming

• i.e. Rails, Sinatra, etc.

Page 242: 6 reasons Jubilee could be a Rubyist's new best friend

6 ) R E U S E A L L Y O U R E X I S T I N G K N O W L E D G E /R E S O U R C E S

• Ruby

• Rack programming

• i.e. Rails, Sinatra, etc.

• Gems

Page 243: 6 reasons Jubilee could be a Rubyist's new best friend

6 ) R E U S E A L L Y O U R E X I S T I N G K N O W L E D G E /R E S O U R C E S

• Ruby

• Rack programming

• i.e. Rails, Sinatra, etc.

• Gems

• Low barrier to entry for the Rubyist!

Page 244: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E C A N M A K E Y O U H A P P Y

Page 245: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E C A N M A K E Y O U H A P P Y

Page 246: 6 reasons Jubilee could be a Rubyist's new best friend

I N S TA L L AT I O N

$ gem install jubilee!

Page 247: 6 reasons Jubilee could be a Rubyist's new best friend

R U N N I N G W I T H R A C K

$ cd a-jruby-compatible-rack-app!# Start it, several options available!$ jubilee <options> !# If you don’t need jubilee options!$ rails s jubilee!$ rackup -s jubilee!# running as vertx module!$ vertx run config.ru -conf config.json !

Page 248: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT A B O U T H E R O K U ?

Page 249: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT A B O U T H E R O K U ?• http://funkworks.blogspot.com/2014/08/deploying-rails-41-app-served-by.html

Page 250: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT A B O U T H E R O K U ?• http://funkworks.blogspot.com/2014/08/deploying-rails-41-app-served-by.html

ruby '2.0.0', engine: 'jruby', engine_version: '1.7.13'!gem 'jubilee', :platforms => [:jruby]!gem 'rails_12factor'

Gemfile

Page 251: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT A B O U T H E R O K U ?• http://funkworks.blogspot.com/2014/08/deploying-rails-41-app-served-by.html

ruby '2.0.0', engine: 'jruby', engine_version: '1.7.13'!gem 'jubilee', :platforms => [:jruby]!gem 'rails_12factor'

web: jubilee --eventbus /eventbus -n 1 —e $RACK_ENV -p $PORT !

Gemfile

Procfile

Page 252: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT A B O U T H E R O K U ?• http://funkworks.blogspot.com/2014/08/deploying-rails-41-app-served-by.html

ruby '2.0.0', engine: 'jruby', engine_version: '1.7.13'!gem 'jubilee', :platforms => [:jruby]!gem 'rails_12factor'

web: jubilee --eventbus /eventbus -n 1 —e $RACK_ENV -p $PORT !

heroku config:add JRUBY_OPTS="-J-Xmn128m -J-Xms768m -J-Xmx768m"!

Gemfile

Procfile

Set JRuby/JVM Opts

Page 253: 6 reasons Jubilee could be a Rubyist's new best friend

G E T T I N G T H E M E S S A G E A C R O S S

Page 254: 6 reasons Jubilee could be a Rubyist's new best friend

G E T T I N G T H E M E S S A G E A C R O S S

• Everyone has slides

Page 255: 6 reasons Jubilee could be a Rubyist's new best friend

G E T T I N G T H E M E S S A G E A C R O S S

• Everyone has slides

• Many have demos

Page 256: 6 reasons Jubilee could be a Rubyist's new best friend

G E T T I N G T H E M E S S A G E A C R O S S

• Everyone has slides

• Many have demos

• I want 1st hand interaction -

Page 257: 6 reasons Jubilee could be a Rubyist's new best friend

A N E X P E R I E N C E

Page 258: 6 reasons Jubilee could be a Rubyist's new best friend

A N E X P E R I E N C E

Page 259: 6 reasons Jubilee could be a Rubyist's new best friend

N O D E ’ S S W E E T S P O T

Page 260: 6 reasons Jubilee could be a Rubyist's new best friend

N O D E ’ S S W E E T S P O T

• Chat - The sample app that everyone makes

Page 261: 6 reasons Jubilee could be a Rubyist's new best friend

N O D E ’ S S W E E T S P O T

• Chat - The sample app that everyone makes

• How do I make a chat app a little more interesting?

Page 262: 6 reasons Jubilee could be a Rubyist's new best friend

N O D E ’ S S W E E T S P O T

• Chat - The sample app that everyone makes

• How do I make a chat app a little more interesting?

• How about a game with chat characterstics

Page 263: 6 reasons Jubilee could be a Rubyist's new best friend

M M O W H AT ?

Page 264: 6 reasons Jubilee could be a Rubyist's new best friend

M M O W H AT ?

• Rock, Paper, Scissors

Page 265: 6 reasons Jubilee could be a Rubyist's new best friend

M M O W H AT ?

• Rock, Paper, Scissors

• Really!

Page 266: 6 reasons Jubilee could be a Rubyist's new best friend

M M O W H AT ?

• Rock, Paper, Scissors

• Really!

• 4 kids, demanding job - World of Warcraft is out

Page 267: 6 reasons Jubilee could be a Rubyist's new best friend

E X P E R I E N C I N G J U B I L E E I N A C T I O N

Page 268: 6 reasons Jubilee could be a Rubyist's new best friend

E X P E R I E N C I N G J U B I L E E I N A C T I O N

• Everyone in the room sign on

Page 269: 6 reasons Jubilee could be a Rubyist's new best friend

E X P E R I E N C I N G J U B I L E E I N A C T I O N

• Everyone in the room sign on

• Play each other

Page 270: 6 reasons Jubilee could be a Rubyist's new best friend

E X P E R I E N C I N G J U B I L E E I N A C T I O N

• Everyone in the room sign on

• Play each other

• Have fun!

Page 271: 6 reasons Jubilee could be a Rubyist's new best friend

E X P E R I E N C I N G J U B I L E E I N A C T I O N

• Everyone in the room sign on

• Play each other

• Have fun!

• Then we talk

Page 272: 6 reasons Jubilee could be a Rubyist's new best friend

E X P E R I E N C I N G J U B I L E E I N A C T I O N

• Everyone in the room sign on

• Play each other

• Have fun!

• Then we talk

• EXPERIMENT WARNING: Intentionally running in 1 dyno, curious to see how it scales

Page 273: 6 reasons Jubilee could be a Rubyist's new best friend

E X P E R I E N C I N G J U B I L E E I N A C T I O N

• Everyone in the room sign on

• Play each other

• Have fun!

• Then we talk

• EXPERIMENT WARNING: Intentionally running in 1 dyno, curious to see how it scales

• Conference WIFI

Page 274: 6 reasons Jubilee could be a Rubyist's new best friend

E X P E R I E N C I N G J U B I L E E I N A C T I O N

• Everyone in the room sign on

• Play each other

• Have fun!

• Then we talk

• EXPERIMENT WARNING: Intentionally running in 1 dyno, curious to see how it scales

• Conference WIFI

• Sound effects file (bad decision?)

Page 275: 6 reasons Jubilee could be a Rubyist's new best friend

R O C K PA P E R S C I S S O R S M AY H E M

R P S M

Page 276: 6 reasons Jubilee could be a Rubyist's new best friend

R P S M

Page 277: 6 reasons Jubilee could be a Rubyist's new best friend

H T T P : / / B I T. LY / R P S M AY H E M!

P !

!

!

!

M

!

!

S R

Page 278: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT T O D O

Page 279: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT T O D O

• Go to http://bit.ly/rpsmayhem

Page 280: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT T O D O

• Go to http://bit.ly/rpsmayhem

• Login with twitter

Page 281: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT T O D O

• Go to http://bit.ly/rpsmayhem

• Login with twitter

• Android users click the “Play Sound” button to prime sound (HTML5 audio not quite there yet)

Page 282: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT T O D O

• Go to http://bit.ly/rpsmayhem

• Login with twitter

• Android users click the “Play Sound” button to prime sound (HTML5 audio not quite there yet)

• Likely to be the most taxing on conference wifi, (experiment)

Page 283: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT T O D O

• Go to http://bit.ly/rpsmayhem

• Login with twitter

• Android users click the “Play Sound” button to prime sound (HTML5 audio not quite there yet)

• Likely to be the most taxing on conference wifi, (experiment)

• Pick opponents and play

Page 284: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT T O D O

• Go to http://bit.ly/rpsmayhem

• Login with twitter

• Android users click the “Play Sound” button to prime sound (HTML5 audio not quite there yet)

• Likely to be the most taxing on conference wifi, (experiment)

• Pick opponents and play

• Observe activity, player states

Page 285: 6 reasons Jubilee could be a Rubyist's new best friend

W H AT T O D O

• Go to http://bit.ly/rpsmayhem

• Login with twitter

• Android users click the “Play Sound” button to prime sound (HTML5 audio not quite there yet)

• Likely to be the most taxing on conference wifi, (experiment)

• Pick opponents and play

• Observe activity, player states

• If something’s off, refresh page, in progress matches will get rejoined

Page 286: 6 reasons Jubilee could be a Rubyist's new best friend

P L AY I T !

Page 287: 6 reasons Jubilee could be a Rubyist's new best friend

A P P B R E A K D O W N

Page 288: 6 reasons Jubilee could be a Rubyist's new best friend

R I G H T T O O L F O R T H E J O B

Page 289: 6 reasons Jubilee could be a Rubyist's new best friend

R I G H T T O O L F O R T H E J O B

• Rails

Page 290: 6 reasons Jubilee could be a Rubyist's new best friend

R I G H T T O O L F O R T H E J O B

• Rails

• Login - omniauth, devise

Page 291: 6 reasons Jubilee could be a Rubyist's new best friend

R I G H T T O O L F O R T H E J O B

• Rails

• Login - omniauth, devise

• Views - haml

Page 292: 6 reasons Jubilee could be a Rubyist's new best friend

R I G H T T O O L F O R T H E J O B

• Rails

• Login - omniauth, devise

• Views - haml

• DB - ActiveRecord, migrations

Page 293: 6 reasons Jubilee could be a Rubyist's new best friend

R I G H T T O O L F O R T H E J O B

• Rails

• Login - omniauth, devise

• Views - haml

• DB - ActiveRecord, migrations

• Jubilee/Vert.x

Page 294: 6 reasons Jubilee could be a Rubyist's new best friend

R I G H T T O O L F O R T H E J O B

• Rails

• Login - omniauth, devise

• Views - haml

• DB - ActiveRecord, migrations

• Jubilee/Vert.x

• Event Bus - websockets, concurrency, subsystem communciation

Page 295: 6 reasons Jubilee could be a Rubyist's new best friend

R I G H T T O O L F O R T H E J O B

• Rails

• Login - omniauth, devise

• Views - haml

• DB - ActiveRecord, migrations

• Jubilee/Vert.x

• Event Bus - websockets, concurrency, subsystem communciation

• Shared Data - quick shared memory

Page 296: 6 reasons Jubilee could be a Rubyist's new best friend

R I G H T T O O L F O R T H E J O B

• Rails

• Login - omniauth, devise

• Views - haml

• DB - ActiveRecord, migrations

• Jubilee/Vert.x

• Event Bus - websockets, concurrency, subsystem communciation

• Shared Data - quick shared memory

• Vertx::Timer - enforce challenge acceptance timeout

Page 297: 6 reasons Jubilee could be a Rubyist's new best friend

R I G H T T O O L F O R T H E J O B

• Rails

• Login - omniauth, devise

• Views - haml

• DB - ActiveRecord, migrations

• Jubilee/Vert.x

• Event Bus - websockets, concurrency, subsystem communciation

• Shared Data - quick shared memory

• Vertx::Timer - enforce challenge acceptance timeout

• Additional Verticle - Bot

Page 298: 6 reasons Jubilee could be a Rubyist's new best friend

R I G H T T O O L F O R T H E J O B

• Rails

• Login - omniauth, devise

• Views - haml

• DB - ActiveRecord, migrations

• Jubilee/Vert.x

• Event Bus - websockets, concurrency, subsystem communciation

• Shared Data - quick shared memory

• Vertx::Timer - enforce challenge acceptance timeout

• Additional Verticle - Bot

• Worker Verticle - TBI Leaderboard

Page 299: 6 reasons Jubilee could be a Rubyist's new best friend

A P P S U M M A R Y

Page 300: 6 reasons Jubilee could be a Rubyist's new best friend

A P P S U M M A R Y

• Rails to get to the game

Page 301: 6 reasons Jubilee could be a Rubyist's new best friend

A P P S U M M A R Y

• Rails to get to the game

• Jubilee/Vert.x to play the game

Page 302: 6 reasons Jubilee could be a Rubyist's new best friend

S C R E E N B Y S C R E E N

Page 303: 6 reasons Jubilee could be a Rubyist's new best friend

M A I N PA G E

Page 304: 6 reasons Jubilee could be a Rubyist's new best friend

M A I N PA G E

Main page is vanilla Rails Sign in

Page 305: 6 reasons Jubilee could be a Rubyist's new best friend

S I G N I N W I T H T W I T T E R

Page 306: 6 reasons Jubilee could be a Rubyist's new best friend

S I G N I N W I T H T W I T T E R

Omniauth gem makes it easy

Page 307: 6 reasons Jubilee could be a Rubyist's new best friend

C H AT L I K E F E AT U R E S O F T H E G A M E

Page 308: 6 reasons Jubilee could be a Rubyist's new best friend

C H AT L I K E F E AT U R E S O F T H E G A M E

You

Page 309: 6 reasons Jubilee could be a Rubyist's new best friend

C H AT L I K E F E AT U R E S O F T H E G A M E

YouLive Activity Stream

Page 310: 6 reasons Jubilee could be a Rubyist's new best friend

C H AT L I K E F E AT U R E S O F T H E G A M E

YouLive Activity Stream

Live presence and state

Page 311: 6 reasons Jubilee could be a Rubyist's new best friend

C H A L L E N G E A N O P P O N E N T

You can give up

Page 312: 6 reasons Jubilee could be a Rubyist's new best friend

C H A L L E N G E T I M E O U T

Jubilee/Vert.x Timer checks and cancels the

challenge

Page 313: 6 reasons Jubilee could be a Rubyist's new best friend

R E A LT I M E C H A L L E N G E

Page 314: 6 reasons Jubilee could be a Rubyist's new best friend

R E A LT I M E C H A L L E N G E

Connected to server and each other by EventBus

Page 315: 6 reasons Jubilee could be a Rubyist's new best friend

C H A L L E N G E T I M E O U T

Page 316: 6 reasons Jubilee could be a Rubyist's new best friend

C H A L L E N G E T I M E O U T

Jubilee/Vert.x Timer checks and cancels the

challenge

Page 317: 6 reasons Jubilee could be a Rubyist's new best friend

R E A LT I M E M M O G A M E P L AY

Page 318: 6 reasons Jubilee could be a Rubyist's new best friend

R E A LT I M E M M O G A M E P L AY

Connected to server and each other by EventBus,

uses SharedData for speed

Page 319: 6 reasons Jubilee could be a Rubyist's new best friend

R E A LT I M E M M O G A M E P L AY

Connected to server and each other by EventBus,

uses SharedData for speed

The bot is it’s own Verticle, playing via

EventBus

Page 320: 6 reasons Jubilee could be a Rubyist's new best friend

A R C H I T E C T U R E I N 1 D Y N O

R A I L S

E V E N T B U SB O T

S V R

S H A R E D D ATA

B R O W S E R C L I E N T

T I M E R S

Page 321: 6 reasons Jubilee could be a Rubyist's new best friend

A R C H I T E C T U R E I N 1 D Y N O

R A I L S

E V E N T B U SB O T

S V R

S H A R E D D ATA

B R O W S E R C L I E N T

T I M E R S

Normal Rails App

Page 322: 6 reasons Jubilee could be a Rubyist's new best friend

A R C H I T E C T U R E I N 1 D Y N O

R A I L S

E V E N T B U SB O T

S V R

S H A R E D D ATA

B R O W S E R C L I E N T

T I M E R S

Normal Rails App

Rabbit MQ or similar

Page 323: 6 reasons Jubilee could be a Rubyist's new best friend

A R C H I T E C T U R E I N 1 D Y N O

R A I L S

E V E N T B U SB O T

S V R

S H A R E D D ATA

B R O W S E R C L I E N T

T I M E R S

Normal Rails App

Server is EventBus handler, would be

another process to handle concurrency

Rabbit MQ or similar

Page 324: 6 reasons Jubilee could be a Rubyist's new best friend

A R C H I T E C T U R E I N 1 D Y N O

R A I L S

E V E N T B U SB O T

S V R

S H A R E D D ATA

B R O W S E R C L I E N T

T I M E R S

Normal Rails App

Server is EventBus handler, would be

another process to handle concurrency

Redis, Tokyo Cabinet, etc. Rabbit MQ or similar

Page 325: 6 reasons Jubilee could be a Rubyist's new best friend

A R C H I T E C T U R E I N 1 D Y N O

R A I L S

E V E N T B U SB O T

S V R

S H A R E D D ATA

B R O W S E R C L I E N T

T I M E R S

Normal Rails App

Server is EventBus handler, would be

another process to handle concurrency

Redis, Tokyo Cabinet, etc. Rabbit MQ or similar

Websocket server/push

Page 326: 6 reasons Jubilee could be a Rubyist's new best friend

A R C H I T E C T U R E I N 1 D Y N O

R A I L S

E V E N T B U SB O T

S V R

S H A R E D D ATA

B R O W S E R C L I E N T

T I M E R S

Normal Rails App

Bot Verticle would be another process

Server is EventBus handler, would be

another process to handle concurrency

Redis, Tokyo Cabinet, etc. Rabbit MQ or similar

Websocket server/push

Page 327: 6 reasons Jubilee could be a Rubyist's new best friend

A R C H I T E C T U R E I N 1 D Y N O

R A I L S

E V E N T B U SB O T

S V R

S H A R E D D ATA

B R O W S E R C L I E N T

T I M E R S

Normal Rails App

Bot Verticle would be another process

Server is EventBus handler, would be

another process to handle concurrency

Redis, Tokyo Cabinet, etc. Rabbit MQ or similar

Websocket server/push

Expire unanswered challenges Delayed job

Page 328: 6 reasons Jubilee could be a Rubyist's new best friend

D E S I G N E D T O W O R K T O G E T H E R

Page 329: 6 reasons Jubilee could be a Rubyist's new best friend

A S O P P O S E D T O D U C T TA P E D T O G E T H E R

Page 330: 6 reasons Jubilee could be a Rubyist's new best friend

D U C T TA P E

Page 331: 6 reasons Jubilee could be a Rubyist's new best friend

A P P C O D E S TAT S

Page 332: 6 reasons Jubilee could be a Rubyist's new best friend

A P P C O D E S TAT S

• Client code 497 LOC Opal (including whitespace and debug)

Page 333: 6 reasons Jubilee could be a Rubyist's new best friend

A P P C O D E S TAT S

• Client code 497 LOC Opal (including whitespace and debug)

• game.js.rb 444

Page 334: 6 reasons Jubilee could be a Rubyist's new best friend

A P P C O D E S TAT S

• Client code 497 LOC Opal (including whitespace and debug)

• game.js.rb 444

• event_bus.rb 52

Page 335: 6 reasons Jubilee could be a Rubyist's new best friend

A P P C O D E S TAT S

• Client code 497 LOC Opal (including whitespace and debug)

• game.js.rb 444

• event_bus.rb 52

• Server code: vertx initializer 50 LOC including whitespace and comments

Page 336: 6 reasons Jubilee could be a Rubyist's new best friend

C O D E

Page 337: 6 reasons Jubilee could be a Rubyist's new best friend

C O D E

• Rails code - typical stuff you’re already doing - don’t need to see

Page 338: 6 reasons Jubilee could be a Rubyist's new best friend

C O D E

• Rails code - typical stuff you’re already doing - don’t need to see

• Client Game code - similar to what you might do browser side - don’t need to see

Page 339: 6 reasons Jubilee could be a Rubyist's new best friend

C O D E

• Rails code - typical stuff you’re already doing - don’t need to see

• Client Game code - similar to what you might do browser side - don’t need to see

• Jubilee Code - you’ll want to see

Page 340: 6 reasons Jubilee could be a Rubyist's new best friend

C O D E

• Rails code - typical stuff you’re already doing - don’t need to see

• Client Game code - similar to what you might do browser side - don’t need to see

• Jubilee Code - you’ll want to see

• EventBus communication code - the heart of a Jubilee/Vert.x app

Page 341: 6 reasons Jubilee could be a Rubyist's new best friend

C O D E

• Rails code - typical stuff you’re already doing - don’t need to see

• Client Game code - similar to what you might do browser side - don’t need to see

• Jubilee Code - you’ll want to see

• EventBus communication code - the heart of a Jubilee/Vert.x app

• Deploying another verticle, Bot, TBI Leaderboard

Page 342: 6 reasons Jubilee could be a Rubyist's new best friend

C O D E

• Rails code - typical stuff you’re already doing - don’t need to see

• Client Game code - similar to what you might do browser side - don’t need to see

• Jubilee Code - you’ll want to see

• EventBus communication code - the heart of a Jubilee/Vert.x app

• Deploying another verticle, Bot, TBI Leaderboard

• Shared Data

Page 343: 6 reasons Jubilee could be a Rubyist's new best friend

C O D E

• Rails code - typical stuff you’re already doing - don’t need to see

• Client Game code - similar to what you might do browser side - don’t need to see

• Jubilee Code - you’ll want to see

• EventBus communication code - the heart of a Jubilee/Vert.x app

• Deploying another verticle, Bot, TBI Leaderboard

• Shared Data

• Timer

Page 344: 6 reasons Jubilee could be a Rubyist's new best friend

E V E N T B U S S E T U P - R A I L Sbegin! require 'vertx'! def to_array(shared_set)! ret = []! shared_set.each{ |item| ret << item}! ret! end!! Vertx::EventBus.register_handler('logout') do |message|! user_id = message.body! puts "logging out #{user_id}"! Vertx::SharedData.get_set(:users).delete(user_id)! Vertx::EventBus.publish("user_logout", user_id)! end!! # register the user and return the previous users! Vertx::EventBus.register_handler('login') do |message|! user_id = message.body! users = Vertx::SharedData.get_set(:users).add(user_id)! user_records = User.find(to_array(users)).to_json! message.reply(users: to_array(users))! user = User.find user_id! Vertx::EventBus.publish("new_user", user.to_json)! end!end

Page 345: 6 reasons Jubilee could be a Rubyist's new best friend

E V E N T B U S S E T U P - R A I L Sbegin! require 'vertx'! def to_array(shared_set)! ret = []! shared_set.each{ |item| ret << item}! ret! end!! Vertx::EventBus.register_handler('logout') do |message|! user_id = message.body! puts "logging out #{user_id}"! Vertx::SharedData.get_set(:users).delete(user_id)! Vertx::EventBus.publish("user_logout", user_id)! end!! # register the user and return the previous users! Vertx::EventBus.register_handler('login') do |message|! user_id = message.body! users = Vertx::SharedData.get_set(:users).add(user_id)! user_records = User.find(to_array(users)).to_json! message.reply(users: to_array(users))! user = User.find user_id! Vertx::EventBus.publish("new_user", user.to_json)! end!end

Page 346: 6 reasons Jubilee could be a Rubyist's new best friend

E V E N T B U S S E T U P - R A I L Sbegin! require 'vertx'! def to_array(shared_set)! ret = []! shared_set.each{ |item| ret << item}! ret! end!! Vertx::EventBus.register_handler('logout') do |message|! user_id = message.body! puts "logging out #{user_id}"! Vertx::SharedData.get_set(:users).delete(user_id)! Vertx::EventBus.publish("user_logout", user_id)! end!! # register the user and return the previous users! Vertx::EventBus.register_handler('login') do |message|! user_id = message.body! users = Vertx::SharedData.get_set(:users).add(user_id)! user_records = User.find(to_array(users)).to_json! message.reply(users: to_array(users))! user = User.find user_id! Vertx::EventBus.publish("new_user", user.to_json)! end!end

Page 347: 6 reasons Jubilee could be a Rubyist's new best friend

E V E N T B U S S E T U P - R A I L Sbegin! require 'vertx'! def to_array(shared_set)! ret = []! shared_set.each{ |item| ret << item}! ret! end!! Vertx::EventBus.register_handler('logout') do |message|! user_id = message.body! puts "logging out #{user_id}"! Vertx::SharedData.get_set(:users).delete(user_id)! Vertx::EventBus.publish("user_logout", user_id)! end!! # register the user and return the previous users! Vertx::EventBus.register_handler('login') do |message|! user_id = message.body! users = Vertx::SharedData.get_set(:users).add(user_id)! user_records = User.find(to_array(users)).to_json! message.reply(users: to_array(users))! user = User.find user_id! Vertx::EventBus.publish("new_user", user.to_json)! end!end

Page 348: 6 reasons Jubilee could be a Rubyist's new best friend

E V E N T B U S S E T U P - R A I L Sbegin! require 'vertx'! def to_array(shared_set)! ret = []! shared_set.each{ |item| ret << item}! ret! end!! Vertx::EventBus.register_handler('logout') do |message|! user_id = message.body! puts "logging out #{user_id}"! Vertx::SharedData.get_set(:users).delete(user_id)! Vertx::EventBus.publish("user_logout", user_id)! end!! # register the user and return the previous users! Vertx::EventBus.register_handler('login') do |message|! user_id = message.body! users = Vertx::SharedData.get_set(:users).add(user_id)! user_records = User.find(to_array(users)).to_json! message.reply(users: to_array(users))! user = User.find user_id! Vertx::EventBus.publish("new_user", user.to_json)! end!end

Page 349: 6 reasons Jubilee could be a Rubyist's new best friend

E V E N T B U S S E T U P - R A I L Sbegin! require 'vertx'! def to_array(shared_set)! ret = []! shared_set.each{ |item| ret << item}! ret! end!! Vertx::EventBus.register_handler('logout') do |message|! user_id = message.body! puts "logging out #{user_id}"! Vertx::SharedData.get_set(:users).delete(user_id)! Vertx::EventBus.publish("user_logout", user_id)! end!! # register the user and return the previous users! Vertx::EventBus.register_handler('login') do |message|! user_id = message.body! users = Vertx::SharedData.get_set(:users).add(user_id)! user_records = User.find(to_array(users)).to_json! message.reply(users: to_array(users))! user = User.find user_id! Vertx::EventBus.publish("new_user", user.to_json)! end!end

Page 350: 6 reasons Jubilee could be a Rubyist's new best friend

S E R V E R C O N T I N U E D

begin! Vertx::EventBus.register_handler('game') do |message|! server = Server.new(Vertx::EventBus, Vertx)! cmd_hash = message.body["map"]! case cmd_hash["cmd"]! when "new_game"! server.new_game(cmd_hash["challenge_id"], cmd_hash["challenger_id"], cmd_hash["challenged_id"])! when "move"! server.move(cmd_hash["game_id"], cmd_hash["user_id"], cmd_hash["move"])! when "challenge_accepted"! server.challenge_accepted(cmd_hash["challenge_id"], cmd_hash["challenger_id"], cmd_hash["challenged_id"])! when "give_up_challenge"! server.give_up_challenge(cmd_hash["challenged_id"], cmd_hash["challenger_id"])! else! puts("Unhandled cmd: #{cmd_hash.inspect}")! end! end! Vertx.deploy_verticle("bot.rb")!rescue LoadError! puts "Vertx is NOT defined - no loading of vertx initializer"!end

Page 351: 6 reasons Jubilee could be a Rubyist's new best friend

S E R V E R C O N T I N U E D

begin! Vertx::EventBus.register_handler('game') do |message|! server = Server.new(Vertx::EventBus, Vertx)! cmd_hash = message.body["map"]! case cmd_hash["cmd"]! when "new_game"! server.new_game(cmd_hash["challenge_id"], cmd_hash["challenger_id"], cmd_hash["challenged_id"])! when "move"! server.move(cmd_hash["game_id"], cmd_hash["user_id"], cmd_hash["move"])! when "challenge_accepted"! server.challenge_accepted(cmd_hash["challenge_id"], cmd_hash["challenger_id"], cmd_hash["challenged_id"])! when "give_up_challenge"! server.give_up_challenge(cmd_hash["challenged_id"], cmd_hash["challenger_id"])! else! puts("Unhandled cmd: #{cmd_hash.inspect}")! end! end! Vertx.deploy_verticle("bot.rb")!rescue LoadError! puts "Vertx is NOT defined - no loading of vertx initializer"!end

Page 352: 6 reasons Jubilee could be a Rubyist's new best friend

S E R V E R C O N T I N U E D

begin! Vertx::EventBus.register_handler('game') do |message|! server = Server.new(Vertx::EventBus, Vertx)! cmd_hash = message.body["map"]! case cmd_hash["cmd"]! when "new_game"! server.new_game(cmd_hash["challenge_id"], cmd_hash["challenger_id"], cmd_hash["challenged_id"])! when "move"! server.move(cmd_hash["game_id"], cmd_hash["user_id"], cmd_hash["move"])! when "challenge_accepted"! server.challenge_accepted(cmd_hash["challenge_id"], cmd_hash["challenger_id"], cmd_hash["challenged_id"])! when "give_up_challenge"! server.give_up_challenge(cmd_hash["challenged_id"], cmd_hash["challenger_id"])! else! puts("Unhandled cmd: #{cmd_hash.inspect}")! end! end! Vertx.deploy_verticle("bot.rb")!rescue LoadError! puts "Vertx is NOT defined - no loading of vertx initializer"!end

Page 353: 6 reasons Jubilee could be a Rubyist's new best friend

C L I E N T S I D E E V E N T B U S S E T U P ( O PA L )

def setup_eventbus! @event_bus = EventBus.new! @event_bus.onopen {! @event_bus.send_msg(:login, @uid)! @event_bus.register_handler(:new_user) do |data|! json = JSON.parse(data)! @player_info[json[:id]] = { name: json[:name], image: json[:image]}! render_potential_victim(json) unless json[:id].to_i == @uid.to_i! append_activity("#{json['name']} joined")! end

Page 354: 6 reasons Jubilee could be a Rubyist's new best friend

C L I E N T S I D E E V E N T B U S S E T U P ( O PA L )

def setup_eventbus! @event_bus = EventBus.new! @event_bus.onopen {! @event_bus.send_msg(:login, @uid)! @event_bus.register_handler(:new_user) do |data|! json = JSON.parse(data)! @player_info[json[:id]] = { name: json[:name], image: json[:image]}! render_potential_victim(json) unless json[:id].to_i == @uid.to_i! append_activity("#{json['name']} joined")! end

Page 355: 6 reasons Jubilee could be a Rubyist's new best friend

C L I E N T S I D E E V E N T B U S S E T U P ( O PA L )

def setup_eventbus! @event_bus = EventBus.new! @event_bus.onopen {! @event_bus.send_msg(:login, @uid)! @event_bus.register_handler(:new_user) do |data|! json = JSON.parse(data)! @player_info[json[:id]] = { name: json[:name], image: json[:image]}! render_potential_victim(json) unless json[:id].to_i == @uid.to_i! append_activity("#{json['name']} joined")! end

Page 356: 6 reasons Jubilee could be a Rubyist's new best friend

C L I E N T S I D E E V E N T B U S S E T U P ( O PA L )

def setup_eventbus! @event_bus = EventBus.new! @event_bus.onopen {! @event_bus.send_msg(:login, @uid)! @event_bus.register_handler(:new_user) do |data|! json = JSON.parse(data)! @player_info[json[:id]] = { name: json[:name], image: json[:image]}! render_potential_victim(json) unless json[:id].to_i == @uid.to_i! append_activity("#{json['name']} joined")! end

Page 357: 6 reasons Jubilee could be a Rubyist's new best friend

C L I E N T C O N T I N U E D @event_bus.register_handler(@uid) do |data|! cmd_hash = Native(data)! case cmd_hash["cmd"]! when "challenge"! show_challenge(cmd_hash)! when "new_game"! new_game(cmd_hash["challenger_id"], cmd_hash["challenged_id"], cmd_hash["game_id"])! when "move"! process_move(cmd_hash)! when "give_up_challenge"! give_up_challenge(cmd_hash)! when "challenge_aborted"! challenger_name = @player_info[cmd_hash["challenged_id"]][:name]! hide_overlay! swal("You missed a challenge from #{challenger_name}")! when "user_details"! json = @player_info[@uid].merge({id: @uid}).to_json! puts "Sending user_details #{json}"! replier.call(json)! when "not_available"! hide_overlay! swal "#{@player_info[@desired_challenged_id][:name]} is not available to play"! else! puts "can't handle "! end! end!end # split in half

Page 358: 6 reasons Jubilee could be a Rubyist's new best friend

def cont! @event_bus.register_handler(:activity) do |data|! append_activity(data)! end! @event_bus.register_handler(:player_state) do |data|! `console.log(data); `! state_hash = Native(data)! set_player_states(state_hash)! end! @event_bus.register_handler(:user_logout) do |data|! user_id = data! puts "logging out #{user_id}"! append_activity("#{@player_info[user_id]['name']} left")! Element.find("##{user_id}").hide! end! }!end!

Page 359: 6 reasons Jubilee could be a Rubyist's new best friend

B O T C O D E@handler = Vertx::EventBus.register_handler(BOT_ID) do |message|! cmd_hash = message.body! puts "\nBOT handling #{cmd_hash['cmd']}"! case cmd_hash["cmd"]! when "challenge"! Vertx::EventBus.send("game",! { cmd: "challenge_accepted",! challenge_id: cmd_hash["challenge_id"],! challenger_id: cmd_hash["challenger_id"],! challenged_id: BOT_ID! }! )! when "move"! process_move(cmd_hash)! when "give_up_challenge", "challenge_aborted", "not_available", "challenge_accepted"! # NO OP! else! puts "\nBOT can't handle #{cmd_hash.inspect}"! p cmd_hash! end!!end!!def vertx_stop! puts "Must exterminate self!"! Vertx::EventBus.unregister_handler( BOT_ID, @handler)!end

Page 360: 6 reasons Jubilee could be a Rubyist's new best friend

B O T C O D E@handler = Vertx::EventBus.register_handler(BOT_ID) do |message|! cmd_hash = message.body! puts "\nBOT handling #{cmd_hash['cmd']}"! case cmd_hash["cmd"]! when "challenge"! Vertx::EventBus.send("game",! { cmd: "challenge_accepted",! challenge_id: cmd_hash["challenge_id"],! challenger_id: cmd_hash["challenger_id"],! challenged_id: BOT_ID! }! )! when "move"! process_move(cmd_hash)! when "give_up_challenge", "challenge_aborted", "not_available", "challenge_accepted"! # NO OP! else! puts "\nBOT can't handle #{cmd_hash.inspect}"! p cmd_hash! end!!end!!def vertx_stop! puts "Must exterminate self!"! Vertx::EventBus.unregister_handler( BOT_ID, @handler)!end

Page 361: 6 reasons Jubilee could be a Rubyist's new best friend

B O T C O D E@handler = Vertx::EventBus.register_handler(BOT_ID) do |message|! cmd_hash = message.body! puts "\nBOT handling #{cmd_hash['cmd']}"! case cmd_hash["cmd"]! when "challenge"! Vertx::EventBus.send("game",! { cmd: "challenge_accepted",! challenge_id: cmd_hash["challenge_id"],! challenger_id: cmd_hash["challenger_id"],! challenged_id: BOT_ID! }! )! when "move"! process_move(cmd_hash)! when "give_up_challenge", "challenge_aborted", "not_available", "challenge_accepted"! # NO OP! else! puts "\nBOT can't handle #{cmd_hash.inspect}"! p cmd_hash! end!!end!!def vertx_stop! puts "Must exterminate self!"! Vertx::EventBus.unregister_handler( BOT_ID, @handler)!end

Page 362: 6 reasons Jubilee could be a Rubyist's new best friend

B O T C O D E@handler = Vertx::EventBus.register_handler(BOT_ID) do |message|! cmd_hash = message.body! puts "\nBOT handling #{cmd_hash['cmd']}"! case cmd_hash["cmd"]! when "challenge"! Vertx::EventBus.send("game",! { cmd: "challenge_accepted",! challenge_id: cmd_hash["challenge_id"],! challenger_id: cmd_hash["challenger_id"],! challenged_id: BOT_ID! }! )! when "move"! process_move(cmd_hash)! when "give_up_challenge", "challenge_aborted", "not_available", "challenge_accepted"! # NO OP! else! puts "\nBOT can't handle #{cmd_hash.inspect}"! p cmd_hash! end!!end!!def vertx_stop! puts "Must exterminate self!"! Vertx::EventBus.unregister_handler( BOT_ID, @handler)!end

Page 363: 6 reasons Jubilee could be a Rubyist's new best friend

S E R V E R T I M E R C O D E

# timer when challenged! timer_id = @container.set_timer(10000) do |timer_id|! check_accepted?(challenge_id, challenger_id, challenged_id)! end! timer_map = Vertx::SharedData.get_hash(:timers)! timer_map[challenge_id] = timer_id!!

# clear the timer if user aborts his challenge! timer_map = Vertx::SharedData.get_hash(:timers)! timer_id = timer_map[challenge_id]! if timer_id! Vertx.cancel_timer timer_id! timer_map.delete challenge_id! end

Page 364: 6 reasons Jubilee could be a Rubyist's new best friend

S E R V E R T I M E R C O D E

# timer when challenged! timer_id = @container.set_timer(10000) do |timer_id|! check_accepted?(challenge_id, challenger_id, challenged_id)! end! timer_map = Vertx::SharedData.get_hash(:timers)! timer_map[challenge_id] = timer_id!!

# clear the timer if user aborts his challenge! timer_map = Vertx::SharedData.get_hash(:timers)! timer_id = timer_map[challenge_id]! if timer_id! Vertx.cancel_timer timer_id! timer_map.delete challenge_id! end

Page 365: 6 reasons Jubilee could be a Rubyist's new best friend

S E R V E R T I M E R C O D E

# timer when challenged! timer_id = @container.set_timer(10000) do |timer_id|! check_accepted?(challenge_id, challenger_id, challenged_id)! end! timer_map = Vertx::SharedData.get_hash(:timers)! timer_map[challenge_id] = timer_id!!

# clear the timer if user aborts his challenge! timer_map = Vertx::SharedData.get_hash(:timers)! timer_id = timer_map[challenge_id]! if timer_id! Vertx.cancel_timer timer_id! timer_map.delete challenge_id! end

Page 366: 6 reasons Jubilee could be a Rubyist's new best friend

S E R V E R T I M E R C O D E

# timer when challenged! timer_id = @container.set_timer(10000) do |timer_id|! check_accepted?(challenge_id, challenger_id, challenged_id)! end! timer_map = Vertx::SharedData.get_hash(:timers)! timer_map[challenge_id] = timer_id!!

# clear the timer if user aborts his challenge! timer_map = Vertx::SharedData.get_hash(:timers)! timer_id = timer_map[challenge_id]! if timer_id! Vertx.cancel_timer timer_id! timer_map.delete challenge_id! end

Page 367: 6 reasons Jubilee could be a Rubyist's new best friend

S E R V E R T I M E R C O D E

# timer when challenged! timer_id = @container.set_timer(10000) do |timer_id|! check_accepted?(challenge_id, challenger_id, challenged_id)! end! timer_map = Vertx::SharedData.get_hash(:timers)! timer_map[challenge_id] = timer_id!!

# clear the timer if user aborts his challenge! timer_map = Vertx::SharedData.get_hash(:timers)! timer_id = timer_map[challenge_id]! if timer_id! Vertx.cancel_timer timer_id! timer_map.delete challenge_id! end

Page 368: 6 reasons Jubilee could be a Rubyist's new best friend

S E R V E R T I M E R C O D E

# timer when challenged! timer_id = @container.set_timer(10000) do |timer_id|! check_accepted?(challenge_id, challenger_id, challenged_id)! end! timer_map = Vertx::SharedData.get_hash(:timers)! timer_map[challenge_id] = timer_id!!

# clear the timer if user aborts his challenge! timer_map = Vertx::SharedData.get_hash(:timers)! timer_id = timer_map[challenge_id]! if timer_id! Vertx.cancel_timer timer_id! timer_map.delete challenge_id! end

Page 369: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E C O N S I D E R AT I O N S I N R A I L S

Page 370: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E C O N S I D E R AT I O N S I N R A I L S

• Setup server side EventBus in Rails initializer

Page 371: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E C O N S I D E R AT I O N S I N R A I L S

• Setup server side EventBus in Rails initializer

• Done in initializer so it is done for whole Rails app

Page 372: 6 reasons Jubilee could be a Rubyist's new best friend

J U B I L E E C O N S I D E R AT I O N S I N R A I L S

• Setup server side EventBus in Rails initializer

• Done in initializer so it is done for whole Rails app

• Wrap vertx initialization in begin rescue so Rake tasks (not running vert.x server) will run

Page 373: 6 reasons Jubilee could be a Rubyist's new best friend

D R A W B A C K S

Page 374: 6 reasons Jubilee could be a Rubyist's new best friend

D R A W B A C K S

• JRuby still 2nd class citizen, sometime have gem trouble or hard to get the config right

Page 375: 6 reasons Jubilee could be a Rubyist's new best friend

D R A W B A C K S

• JRuby still 2nd class citizen, sometime have gem trouble or hard to get the config right

• Debugging asynchronous multi agent systems still hard regardless

Page 376: 6 reasons Jubilee could be a Rubyist's new best friend

D R A W B A C K S

• JRuby still 2nd class citizen, sometime have gem trouble or hard to get the config right

• Debugging asynchronous multi agent systems still hard regardless

• Fine control will require vertx style deploy instead of Rails friendly jubilee

Page 377: 6 reasons Jubilee could be a Rubyist's new best friend

D R A W B A C K S

• JRuby still 2nd class citizen, sometime have gem trouble or hard to get the config right

• Debugging asynchronous multi agent systems still hard regardless

• Fine control will require vertx style deploy instead of Rails friendly jubilee

• Error messages can get swallowed inside of Event Handlers

Page 378: 6 reasons Jubilee could be a Rubyist's new best friend

D R A W B A C K S

• JRuby still 2nd class citizen, sometime have gem trouble or hard to get the config right

• Debugging asynchronous multi agent systems still hard regardless

• Fine control will require vertx style deploy instead of Rails friendly jubilee

• Error messages can get swallowed inside of Event Handlers

• Haven’t found the right place so that Jubilee/Vertx code auto reloads on Rails completely consistently

Page 379: 6 reasons Jubilee could be a Rubyist's new best friend

O N E M O R E T H I N G

Page 380: 6 reasons Jubilee could be a Rubyist's new best friend

O N E M O R E T H I N G

• Opal (Ruby in the browser) front end == All Ruby Stack

Page 381: 6 reasons Jubilee could be a Rubyist's new best friend

O N E M O R E T H I N G

• Opal (Ruby in the browser) front end == All Ruby Stack

• The same language on front end/back end advantage that Node touts is nice!

Page 382: 6 reasons Jubilee could be a Rubyist's new best friend

O N E M O R E T H I N G

• Opal (Ruby in the browser) front end == All Ruby Stack

• The same language on front end/back end advantage that Node touts is nice!

• This could be it’s own talk

Page 383: 6 reasons Jubilee could be a Rubyist's new best friend

O N E M O R E T H I N G

• Opal (Ruby in the browser) front end == All Ruby Stack

• The same language on front end/back end advantage that Node touts is nice!

• This could be it’s own talk

• I already did that (RubyConf 2013 https://vimeo.com/82573680 ) So I won’t do it here

Page 384: 6 reasons Jubilee could be a Rubyist's new best friend

R U B Y I N T H E B R O W S E R M A K E S M E H A P P Y

Page 385: 6 reasons Jubilee could be a Rubyist's new best friend

R U B Y I N T H E B R O W S E R M A K E S M E H A P P Y

Page 386: 6 reasons Jubilee could be a Rubyist's new best friend

T H A N K S

• Matz - Ruby

• DHH - Rails and jobs

• Charles Nutter, Tom Enebo - JRuby

• Tim Fox & Vert.x team - Vert.x

• Isaiah Peng - Jubilee

• Adam Beynon, Elia Schito, Meh’ - Opal

• You for listening

Page 387: 6 reasons Jubilee could be a Rubyist's new best friend

A D V I C E T O R U B Y I S T S

Page 388: 6 reasons Jubilee could be a Rubyist's new best friend

A D V I C E T O R U B Y I S T S

• Stay happy, you can still do most of your stuff in Ruby via Jubilee

Page 389: 6 reasons Jubilee could be a Rubyist's new best friend

A D V I C E T O R U B Y I S T S

• Stay happy, you can still do most of your stuff in Ruby via Jubilee

• Stay happy, you can grow/scale in Ruby via Jubilee

Page 390: 6 reasons Jubilee could be a Rubyist's new best friend

A D V I C E T O R U B Y I S T S

• Stay happy, you can still do most of your stuff in Ruby via Jubilee

• Stay happy, you can grow/scale in Ruby via Jubilee

• Don’t worry, Be Happy

Page 391: 6 reasons Jubilee could be a Rubyist's new best friend
Page 392: 6 reasons Jubilee could be a Rubyist's new best friend
Page 393: 6 reasons Jubilee could be a Rubyist's new best friend
Page 394: 6 reasons Jubilee could be a Rubyist's new best friend