torquebox - like a jboss - philly redsnake talk

45

Upload: jwatnj

Post on 29-Nov-2014

542 views

Category:

Software


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: TorqueBox - Like a JBoss - Philly RedSnake Talk
Page 2: TorqueBox - Like a JBoss - Philly RedSnake Talk

TorqueBoxLike a JBoss

Page 3: TorqueBox - Like a JBoss - Philly RedSnake Talk

What’s TorqueBox

• JRuby API around JBoss to:

• Run Ruby apps in JBoss AS

Page 4: TorqueBox - Like a JBoss - Philly RedSnake Talk

Who’s TorqueBox?

• Project built and supported by Red Hat

• #torquebox on IRC

• LGPL

• 5 years of active development

Page 5: TorqueBox - Like a JBoss - Philly RedSnake Talk

What’s JRuby

• Ruby on the JVM

• Not a toy

• Runs unmodified Ruby code

• Fast; Real Threads; Java Integration

Page 6: TorqueBox - Like a JBoss - Philly RedSnake Talk

What’s JBoss

Page 7: TorqueBox - Like a JBoss - Philly RedSnake Talk

Why JBoss?

• For an Ordinary Web Application

Page 8: TorqueBox - Like a JBoss - Philly RedSnake Talk

Why JBoss?

• For an Ordinary Web Application

• Just Run Passenger / Gunicorn

Page 9: TorqueBox - Like a JBoss - Philly RedSnake Talk

Why JBoss?

• Ordinary Web Application

• Just Run Passenger / Gunicorn

• And Memcached/Redis for caching

Page 10: TorqueBox - Like a JBoss - Philly RedSnake Talk

Why JBoss?

• Ordinary Web Application

• Just Run Passenger / Gunicorn

• And Memcached/Redis for caching

• And Sidekiq/Celery for background jobs

Page 11: TorqueBox - Like a JBoss - Philly RedSnake Talk

Why JBoss?

• Ordinary Web Application

• Just Run Passenger / Gunicorn

• And Memcached/Redis for caching

• And Sidekiq/Celery for background jobs

• And Cron/Sidetiq for scheduled jobs

Page 12: TorqueBox - Like a JBoss - Philly RedSnake Talk

Why JBoss?• Ordinary Web Application

• Just Run Passenger / Gunicorn

• And Memcached/Redis for caching

• And Sidekiq/Celery for background jobs

• And Cron/Sidetiq for scheduled jobs

• And EventMachine and Faye for Websockets

Page 13: TorqueBox - Like a JBoss - Philly RedSnake Talk

Why JBoss?• Ordinary Web Application

• Just Run Passenger / Gunicorn

• And Memcached/Redis for caching

• And Sidekiq/Celery for background jobs

• And Cron/Sidetiq for scheduled jobs

• And EventMachine and Faye for Websockets

• And a Load Balancer

Page 14: TorqueBox - Like a JBoss - Philly RedSnake Talk

Or

• Just Run JBoss

Page 15: TorqueBox - Like a JBoss - Philly RedSnake Talk

What’s in the Tin

• JBoss Web + Rack for running Web applications

Page 16: TorqueBox - Like a JBoss - Philly RedSnake Talk

What’s in the Tin

• JBoss Web + Rack for running Web applications

• Infinispan for caching

Page 17: TorqueBox - Like a JBoss - Philly RedSnake Talk

What’s in the Tin

• JBoss Web + Rack for running Web applications

• Infinispan for caching

• HornetQ/JMS for messaging

Page 18: TorqueBox - Like a JBoss - Philly RedSnake Talk

What’s in the Tin

• JBoss Web + Rack for running Web applications

• Infinispan for caching

• HornetQ/JMS for messaging

• Quartz for scheduled events

Page 19: TorqueBox - Like a JBoss - Philly RedSnake Talk

What’s in the Tin

• JBoss Web + Rack for running Web applications

• Infinispan for caching

• HornetQ/JMS for messaging

• Quartz for scheduled events

• Stilts for STOMP messaging over Websockets

Page 20: TorqueBox - Like a JBoss - Philly RedSnake Talk

What’s in the Tin• JBoss Web + Rack for running Web applications

• Infinispan for caching

• HornetQ/JMS for messaging

• Quartz for scheduled events

• Stilts for STOMP messaging over Websockets

• mod_cluster/JGroups for clustering/load balancing

Page 21: TorqueBox - Like a JBoss - Philly RedSnake Talk

That’s a lot of stuff

• Can pick and choose

• But it’s all supported

• All within a single JVM, with JVMs clustered across nodes

Page 22: TorqueBox - Like a JBoss - Philly RedSnake Talk

Torquebox API

• Caching

• Messaging/Backgroundable

• Scheduled Jobs

• Services

• STOMP

Page 23: TorqueBox - Like a JBoss - Philly RedSnake Talk

Caching• Infinispan Data Grid

• Local memory

• Invalidate across cluster <- Rails Store Default

• Distributed <- Non-Rails Default, most interesting

• XA Transactions

Page 24: TorqueBox - Like a JBoss - Philly RedSnake Talk

• Configure Rails Cache Store for Torquebox

!

!

• Use the Rails.cache normally

!

Page 25: TorqueBox - Like a JBoss - Philly RedSnake Talk

Caching• Or Use TorqueBox’s Infinispan API directly

Page 26: TorqueBox - Like a JBoss - Philly RedSnake Talk

Messaging!

• HornetQ

• Load balancing, Failover, Timeouts, Retries

• Persistent across restarts

• TorqueBox API offers

• Topics (all subscribers get message)

• Queues (first subscriber to pop message gets it)

Page 27: TorqueBox - Like a JBoss - Philly RedSnake Talk

Topics vs Queues

Page 28: TorqueBox - Like a JBoss - Philly RedSnake Talk

• Configure a Topic at deployment

!

!

• Set up a class to process the messages

Page 29: TorqueBox - Like a JBoss - Philly RedSnake Talk

Backgroundable• Simpler abstraction for fire-and-forget

Page 30: TorqueBox - Like a JBoss - Philly RedSnake Talk

Scheduled Jobs

Page 31: TorqueBox - Like a JBoss - Philly RedSnake Talk

Services

• TorqueBox managed background thread

• Like a daemon

• Can run on a single-node with fail-over to another node in the cluster

Page 32: TorqueBox - Like a JBoss - Philly RedSnake Talk

WebSockets

• STOMP Protocol

• Ships with client JS library

• Can use Topics and Queues we saw earlier

Page 33: TorqueBox - Like a JBoss - Philly RedSnake Talk
Page 34: TorqueBox - Like a JBoss - Philly RedSnake Talk
Page 35: TorqueBox - Like a JBoss - Philly RedSnake Talk

Even More

• Authentication

• Hot deploys

• Dependency Injection

Page 36: TorqueBox - Like a JBoss - Philly RedSnake Talk

I wanna try this!• rvm install jruby

• gem install rails

• rails new your_app

• echo ‘gem torquebox’ >> Gemfile

• bundle install

• torqeubox run

• torquebox deploy

• OR

• docker run mguymon/torquebox

Page 37: TorqueBox - Like a JBoss - Philly RedSnake Talk

Backstage

• Dashboard monitor for your applications

• Deploys into Torquebox

Page 38: TorqueBox - Like a JBoss - Philly RedSnake Talk

Immutant

• Same thing for Clojure

• Red Hat’s Polyglot strategy

• Escalante for Scala

Page 39: TorqueBox - Like a JBoss - Philly RedSnake Talk

Rough Spots, IMO

• Clustering is non-trivial without multicast

• Logging

• Source is mostly Java

• JBoss configuration is intimidating

Page 40: TorqueBox - Like a JBoss - Philly RedSnake Talk

What’s Next

• Torquebox 4

• Probably Wildfly-based

• aka JBoss 8

• Improved Performance

Page 41: TorqueBox - Like a JBoss - Philly RedSnake Talk

Da Mystery of Torqueboxin’

Page 42: TorqueBox - Like a JBoss - Philly RedSnake Talk

Joe Winter• [email protected]

• @jwinter

• From Sungard Consulting Services

• We’re hiring

• We’re looking for Ruby || Front-end JS || Java

• Come talk to me about JRuby

• We’re hiring

Page 43: TorqueBox - Like a JBoss - Philly RedSnake Talk
Page 44: TorqueBox - Like a JBoss - Philly RedSnake Talk
Page 45: TorqueBox - Like a JBoss - Philly RedSnake Talk