TorqueBox - Like a JBoss - Philly RedSnake Talk
description
Transcript of TorqueBox - Like a JBoss - Philly RedSnake Talk
TorqueBoxLike a JBoss
What’s TorqueBox
• JRuby API around JBoss to:
• Run Ruby apps in JBoss AS
Who’s TorqueBox?
• Project built and supported by Red Hat
• #torquebox on IRC
• LGPL
• 5 years of active development
What’s JRuby
• Ruby on the JVM
• Not a toy
• Runs unmodified Ruby code
• Fast; Real Threads; Java Integration
What’s JBoss
Why JBoss?
• For an Ordinary Web Application
Why JBoss?
• For an Ordinary Web Application
• Just Run Passenger / Gunicorn
Why JBoss?
• Ordinary Web Application
• Just Run Passenger / Gunicorn
• And Memcached/Redis for caching
Why JBoss?
• Ordinary Web Application
• Just Run Passenger / Gunicorn
• And Memcached/Redis for caching
• And Sidekiq/Celery for background jobs
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
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
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
Or
• Just Run JBoss
What’s in the Tin
• JBoss Web + Rack for running Web applications
What’s in the Tin
• JBoss Web + Rack for running Web applications
• Infinispan for caching
What’s in the Tin
• JBoss Web + Rack for running Web applications
• Infinispan for caching
• HornetQ/JMS for messaging
What’s in the Tin
• JBoss Web + Rack for running Web applications
• Infinispan for caching
• HornetQ/JMS for messaging
• Quartz for scheduled events
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
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
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
Torquebox API
• Caching
• Messaging/Backgroundable
• Scheduled Jobs
• Services
• STOMP
Caching• Infinispan Data Grid
• Local memory
• Invalidate across cluster <- Rails Store Default
• Distributed <- Non-Rails Default, most interesting
• XA Transactions
• Configure Rails Cache Store for Torquebox
!
!
• Use the Rails.cache normally
!
Caching• Or Use TorqueBox’s Infinispan API directly
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)
Topics vs Queues
• Configure a Topic at deployment
!
!
• Set up a class to process the messages
Backgroundable• Simpler abstraction for fire-and-forget
Scheduled Jobs
Services
• TorqueBox managed background thread
• Like a daemon
• Can run on a single-node with fail-over to another node in the cluster
WebSockets
• STOMP Protocol
• Ships with client JS library
• Can use Topics and Queues we saw earlier
Even More
• Authentication
• Hot deploys
• Dependency Injection
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
Backstage
• Dashboard monitor for your applications
• Deploys into Torquebox
Immutant
• Same thing for Clojure
• Red Hat’s Polyglot strategy
• Escalante for Scala
Rough Spots, IMO
• Clustering is non-trivial without multicast
• Logging
• Source is mostly Java
• JBoss configuration is intimidating
What’s Next
• Torquebox 4
• Probably Wildfly-based
• aka JBoss 8
• Improved Performance
Da Mystery of Torqueboxin’
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