My application has one central database + Rails server and many
distributed GUI clients. The remote clients need to read and update
different collections of ActiveRecords. They also need to submit
fairly demanding calculation + database update requests.
Have you designed a similar Ruby application? What did you do?
I’ll try to summarize the approachs I’m considering without putting
you to sleep with the details.
Rails Web Service. Built in to the Rails framework. Interoperable
with other applications. Easy to get through firewalls/proxy. But I
don’t care about interoperability. How fast is XML marshaling/
unmarshaling? Probably requires that I recreate a subset of my domain
model in Structs.
DRb + DRbUndumped. Send ActiveRecords across as remote proxies. Easy
to set up. Faster than XML. Can re-use ActiveRecord. A bit tricky to
get right – where is that method being called? Won’t every method
call be a remote call in this design? This fine-grained remote
interface approach didn’t pan out so well with remote EJBs, to say
DRb + pass ActiveRecords by value. DRb creates a local copy of each
remote ActiveRecord. Coarse-grained remote interface. Can use
ActiveRecord methods locally for formatting, calculations, etc. Big
drawback: ActiveRecord expects a working database connection. It uses
the database connection to “magically” add association methods at
runtime. Requires considerable ActiveRecord hacking.
DRb + custom remote models. Use “service” classes that convert
ActiveRecords to and from remote-friendly domain classes. Precise
control of what is sent to the remote client. Doesn’t try to force
ActiveRecord into something it’s not. But we’re back to recreating
our domain model again. Maybe I should just crack open my Core J2EE
XML-RPC/SOAP. XML marshalling and SOAP complexity with all the
drawbacks of the DRb approach.
There’s not a lot out there, but the best summary I’ve found is this
Thanks for any thoughts or feedback!