# erlang/Mnesia adaptor for rails

**URL:** <https://www.ruby-forum.com/t/erlang-mnesia-adaptor-for-rails/114172>\
**Category:** Rails\
**Created:** [September 9, 2007, 3:48am UTC](https://www.ruby-forum.com/t/erlang-mnesia-adaptor-for-rails/114172 "2007-09-09T03:48:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [September 9, 2007, 3:48am UTC](https://www.ruby-forum.com/t/erlang-mnesia-adaptor-for-rails/114172/1 "2007-09-09T03:48:18Z")

</div>

I’m working on a site that will most likely be huge and could easily  
be one of the largest ruby on rails sites yet. While we will be  
using databases to some extent on the backend, I know that’s only  
going to scale out so far, so I’ve been looking at some alternatives.  
Memcache is nice and I’m sure we will use it, but we are really  
looking for something more along the lines of a distributed rdbms. At  
the same time I’ve been playing around with erlang and mnesia for the  
first time.

It seems to me that it should be possible to write an AR adaptor that  
communicates as a client to an erlang node via tcp, and have code on  
the node to translate sql into mnesia database calls. While  
translating sql would be a pain, supporting simple queries should be  
doable without too much effort.

Anyone working on something like this, or have ideas on interfacing  
rails with erlang OTP systems?

Chris

---

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [September 10, 2007, 4:03am UTC](https://www.ruby-forum.com/t/erlang-mnesia-adaptor-for-rails/114172/2 "2007-09-10T04:03:43Z")

</div>

Read up on Erlang ports - that’s probably the mechanism I’d look at  
first to use in interfacing Rails with Erlang.

The reason I’d look at it first is that it exists now, is fairly  
straightforward to implement and works. If for some reason it’s not  
going to work (and I can see that having to translate between SQL and  
Mnesia calls might be one reason not to use it), then I think you’re  
on the right track looking at something like a TCP socket connection.

It might also be worth reading up on the limitations around massive  
Mnesia databases. Although I haven’t built anything particularly  
large with Mnesia, it seems as though some people are concerned with  
Mnesia’s ability to handle very large datasets and have been  
discussing this on the Erlang groups recently. Taking what I’ve read  
at strictly face value, I’d have concerns about it as well until I’d  
done some fairly rigorous investigation of my own.

Regards

Dave M.

---

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [September 10, 2007, 5:03am UTC](https://www.ruby-forum.com/t/erlang-mnesia-adaptor-for-rails/114172/3 "2007-09-10T05:03:47Z")

</div>

On Sep 8, 2007, at 6:44 PM, snacktime wrote:

> It seems to me that it should be possible to write an AR adaptor that  
> communicates as a client to an erlang node via tcp, and have code on  
> the node to translate sql into mnesia database calls. While  
> translating sql would be a pain, supporting simple queries should be  
> doable without too much effort.
> 
> Anyone working on something like this, or have ideas on interfacing  
> rails with erlang OTP systems?
> 
> Chris

Chris-

You might want to take a look at CouchDB. It’s built on erlang but  
exposes data as json objects over a REST interface with a map/reduce  
javascript query language.

[http://couchdb.org/](http://couchdb.org/)

Cheers-  
– Ezra Z.  
– Founder & Ruby Hacker  
– removed\_email\_address@domain.invalid  
– Engine Y., Serious Rails Hosting  
– (866) 518-YARD (9273)
