Ernie is an Erlang/Ruby BERT-RPC Server.
Erlang Ruby
Pull request Compare This branch is 2 commits ahead, 34 commits behind vitaliel:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


By Tom Preston-Werner (

Ernie is a BERT-RPC server implementation that uses an Erlang server to accept incoming connections, and then delegates the request to Ruby handlers.

See the full BERT-RPC specification at

Ernie currently supports the following BERT-RPC features:

  • call requests
  • cast requests

Ernie was developed for GitHub and is currently in production use serving millions of RPC requests every day. The stability and performance have been exemplary.


You must have Erlang installed before installing Ernie.

$ gem install ernie -s


Usage: ernie [command] [options]
    -h, --handler HANDLER            Handler file
    -p, --port PORT                  Port
    -n, --number NUMBER              Number of handler instances
    -d, --detached                   Run as a daemon
    -P, --pidfile PIDFILE            Location to write pid file.
    -u, --user USERNAME              The user to run as
    -g, --group GROUP                The group to run as

  <none>                Start an Ernie server.
  reload-handlers       Gracefully reload all of the the ruby handlers
                        and use the new code for all subsequent requests.
  stats                 Print a list of connection and handler statistics.

  ernie -d -p 9999 -n 10 -h calc.rb
    Start the ernie server in the background on port 9999 with ten
    handlers, using the calc.rb handler file.

  ernie reload-handlers -p 9999
    Reload the handlers for the ernie server currently running on
    port 9999.

  ernie -d -p 9998 -n 5 -h calc.rb -u www-data -u www-data
    Similar to the above command to start the ernie server, but this
    one will run the Erlang server and the child handlers as the
    www-data user and group.

Example Handler

require 'ernie'

mod(:calc) do
  fun(:add) do |a, b|
    a + b

Example BERT-RPC call for above example

-> {call, calc, add, [1, 2]}

<- {reply, 3}

Using the BERTRPC gem to make calls to Ernie

You can make BERT-RPC calls from Ruby with the BERTRPC gem:

require 'bertrpc'

svc ='localhost', 8000), 2)
# => 3


If you'd like to hack on Ernie, start by forking my repo on GitHub:

To get all of the dependencies, install the gem first. The best way to get your changes merged back into core is as follows:

  1. Clone down your fork
  2. Create a topic branch to contain your change
  3. Hack away
  4. Add tests and make sure everything still passes by running rake
  5. If you are adding new functionality, document it in the
  6. Do not change the version number, I will do that on my end
  7. If necessary, rebase your commits into logical chunks, without errors
  8. Push the branch up to GitHub
  9. Send me (mojombo) a pull request for your branch


Copyright (c) 2009 Tom Preston-Werner. See LICENSE for details.