TorqueBox•The power of JBoss with the expressiveness of Ruby•Rails, Sinatra, Rack and non-web applications running on top of JBoss AS and JRuby•Messaging, Asynchronous Tasks, Scheduled Jobs, and Services built-in
Rails“Ruby on Rails® is an open-source web frameworkthat’s optimized for programmer happiness andsustainable productivity. It lets you write beautiful codeby favoring convention over conﬁguration.” - http://rubyonrails.org
ScalingAbility to increase throughput by adding hardware
Learn By (Beer) ExampleLet’s create an application to ﬁnd the most popular beeraccording to Twitter.
Beer Tweets•Web front-end•Twitter Streaming API client•Scheduled job to clean old beer tweets•Caching so our database doesn’t fall over
TorqueBox Sessions•Server-side sessions without hitting the database or requiring an external process (memcached)•Uses JBoss AS session replication under the hood
Are We Scaled Yet?We’ve taken care of the load balancer and sessionreplication, but what about our Twitter Streaming APIclient? How will it scale?
Twitter Streaming API Client•By default our service will start on every node in the cluster•Sometimes that’s what you want, but not in this case; we only want one copy of each beer tweet to be saved.
HASingleton Services•TorqueBox supports highly-available singleton services•The service will only run on one node in the cluster•If that node goes down, another node will start the service
Queues and Topicsquestions = inject(‘/queues/questions’)answers = inject(‘/queues/answers’)Thread.new do questions.publish ‘What time is it?’ puts answers.receive(:timeout => 1000)endputs questions.receiveanswers.publish Time.now
Queues and Topicsconﬁg/torquebox.yml:queues: /queues/questions: /queues/answers:
BackStageDashboard and RESTful API to inspect and control Rubycomponents