redis as native ruby extension?

22 views
Skip to first unread message

Tim Lossen

unread,
Nov 27, 2009, 4:59:30 AM11/27/09
to Redis DB
i would like to use redis as an *in-process* datastore from ruby, i.e.
as a ruby c extension,
maybe using ffi: http://kenai.com/projects/ruby-ffi

why would i want to do that? to have super-fast, non-garbage-collected
in-memory storage
for a graph database ....

do you think this idea makes any sense? has anybody done any
exploration in this direction?
google turned up nothing.

cheers,
tim

Chris Wanstrath

unread,
Nov 27, 2009, 12:46:09 PM11/27/09
to redi...@googlegroups.com
On Fri, Nov 27, 2009 at 1:59 AM, Tim Lossen <t...@lossen.de> wrote:

> i would like to use redis as an *in-process* datastore from ruby, i.e.
> as a ruby c extension,
> maybe using ffi: http://kenai.com/projects/ruby-ffi
>
> why would i want to do that? to have super-fast, non-garbage-collected
> in-memory storage
> for a graph database ....

http://localmemcache.rubyforge.org/

--
Chris Wanstrath
http://github.com/defunkt

Salvatore Sanfilippo

unread,
Nov 27, 2009, 1:22:53 PM11/27/09
to redi...@googlegroups.com
On Fri, Nov 27, 2009 at 10:59 AM, Tim Lossen <t...@lossen.de> wrote:
> do you think this idea makes any sense? has anybody done any
> exploration in this direction?
> google turned up nothing.

Hello Tim,

unfortunately there is no code separation between the "storage" part
of Redis and the networking side of the system. I'm not sure the two
subsystems will ever by split aparte, there was a plan in order to
support different "storage engines" but now I changed my mind and want
just an in-memory store as fast as possible with support for Virtual
Memory for datasets bigger than RAM.

What about Berkeley DB?

Cheers,
Salvatore

>
> cheers,
> tim
>
> --
>
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
>
>
>



--
Salvatore 'antirez' Sanfilippo
http://invece.org

"Once you have something that grows faster than education grows,
you’re always going to get a pop culture.", Alan Kay

Tim Lossen

unread,
Nov 29, 2009, 2:51:41 PM11/29/09
to Redis DB
this looks interesting - thanks for the tip, chris.

i don't think that it will work for my purpose, though,
as i am storing large sets per key and localmemcache
needs to marshal / unmarshal the value on every operation.

tim

Tim Lossen

unread,
Nov 29, 2009, 3:12:19 PM11/29/09
to Redis DB
On Nov 27, 7:22 pm, Salvatore Sanfilippo <anti...@gmail.com> wrote:
> unfortunately there is no code separation between the "storage" part
> of Redis and the networking side of the system.

i see.

as all i need is a big hashtable full of sets of integers, maybe i
could simply use your dict.c implementation and nothing else.
but it has been 15 years since i last wrote any c code ;)

> What about Berkeley DB?

i don't think it has in-memory sets.

cheers,
tim

--
http://tim.lossen.de

Aman Gupta

unread,
Nov 29, 2009, 8:04:44 PM11/29/09
to redi...@googlegroups.com
On Sun, Nov 29, 2009 at 3:12 PM, Tim Lossen <t...@lossen.de> wrote:
> On Nov 27, 7:22 pm, Salvatore Sanfilippo <anti...@gmail.com> wrote:
>> unfortunately there is no code separation between the "storage" part
>> of Redis and the networking side of the system.
>
> i see.
>
> as all i need is a big hashtable full of sets of integers, maybe i
> could simply use your dict.c implementation and nothing else.
> but it has been 15 years since i last wrote any c code ;)

what's wrong with ruby hashes?

Aman

>
>> What about Berkeley DB?
>
> i don't think it has in-memory sets.
>
> cheers,
> tim
>
> --
> http://tim.lossen.de
>

Flinn Mueller

unread,
Nov 29, 2009, 10:15:04 PM11/29/09
to redi...@googlegroups.com
What about Sparse Hash?
http://sparsehash.rubyforge.org/

Brian Hammond

unread,
Nov 29, 2009, 10:31:21 PM11/29/09
to Redis DB
That is needed for shared object storage. What about get/set?

> tim

Tim Lossen

unread,
Nov 30, 2009, 4:03:49 AM11/30/09
to Redis DB
On 30 Nov., 02:04, Aman Gupta <themastermi...@gmail.com> wrote:
> On Sun, Nov 29, 2009 at 3:12 PM, Tim Lossen <t...@lossen.de> wrote:
> > as all i need is a big hashtable full of sets of integers, maybe i
> > could simply use your dict.c implementation and nothing else.
> > but it has been 15 years since i last wrote any c code ;)
>
> what's wrong with ruby hashes?

i love ruby hashes ... but once you have one with 30 gigs
of data, garbage collection is going to take a loooong time.
even if nothing is deleted from that hash, ever.
Reply all
Reply to author
Forward
0 new messages