Friday, November 2, 2007

RubyConf 2007: Introduction to AP4R

Shunichi Shinohara (shino) and Kiwamu Kato (kiwana). they work for Future Architect, in Japan.

What is it? Asynchronous Processing for Ruby (AP4R). A messaging library in Ruby. Loose coupling by messaging.

Some background. "RtFA" is their company's proprietary java messaging middle-ware library (!= JMS).

Allows faster response to consumers. If it is not needed immediately, execute it later. Usage examples: logging, sending mail, and creating heavy summary data. More advanced use: intersystem connection.

Allows for load distribution (scales horizontally).

Advantages: lightweight (benefits from ruby) and robust (guaranteed message delivery).

Who is using it?
  • MMORPG from Englad is using it. The game is currently in beta testing.
  • textmeforbusiness.com
    • inbound queue
    • outboud queue
    • routing queue
<coffee_break>
The mascot is a three-banded armadillo, named Maro. AP4R => APAR => apar.
</coffee_break>

Simple API
payment(o.id) becomes ap4r.async_to({action_to => 'payment'}, {order_id => o.id})

Process Flow
User => Apache => Rails cluster => AP4R => Apache

Seamless Integration with Rails

Flexible System Design
  • Replace one AP4R machine with multiple machines
  • Split-up sync and async servers
  • URL rewite filters
An AP4R process has many dispatcher threads.

It speaks HTTP POST, SOAP, XML-RPC and druby.

Provides message status monitoring.

Server Configurations
  • Busy: many messages, but short processing time
  • Heavy: few messages, but long processing time
The robustness comes from a store and forward strategy. They store the message in a MySQL database before sending it to the AP4R server.

They mentioned these books
  • From Java to Ruby
  • Enterprise Integration Patterns
Provides:
  • Message recovery when something bad happens
  • Capistrano support
  • Test support
They have a lot more content in the slides that will be uploaded, but did not have time to go over everything in this talk.

How does this compare to twisted? AP4R is a queueing framework. Twisted is an asynchronous framework. Was it Zed Shaw that answered that? So, if you want a response, AP4R is not for you.

No comments: