A protocol implementation for Distributed Ruby (DRb), supporting connections via a PostgreSQL server by using the LISTEN/NOTIFY event system.
This project rocks and uses MIT-LICENSE.
Add to your
$ bundle install $ rake drbarpg:install:migrations $ rake db:migrate
Ensure the value of
pool in your
config/database.yml is high enough (at least 10).
# Startup your Rails environment to establish database connection. # Only necessary, if running outside of the rails context. require 'path/to/config/environment' # start up the DRb service .start_service "drbarpg://myserver",  # wait for the DRb service to finish before exiting .thread.join
# Startup your Rails environment to establish database connection. # Only necessary, if running outside of the rails context. require 'path/to/config/environment' # Start a local DRbServer to handle callbacks. # # Not necessary for this small example, but will be required # as soon as we pass a non-marshallable object as an argument # to a dRuby call. .start_service "drbarpg://" # attach to the DRb server via the server URI remote_array = DRbObject.new_with_uri("drbarpg://myserver") p remote_array.size # => 0 remote_array << 1 p remote_array.size # => 1
drbarpg makes it possible to create DRb-connections via the connection to a PostgreSQL server. It easily integrates into rails projects and uses the configured database connection for inter process communication.
Method calls with a size of less than 8000 bytes for all serialized parameters are directly passed through by the NOTIFY payload. This bypasses the transaction overhead in the database, so the calls are reasonably fast (approximately 1.5 of the time of a direct DRb-TCP connection). Calls with bigger parameter size are transferred by INSERT/SELECT and require transaction commits, so they usually take several milliseconds.