Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any embedable key-value store for Ruby?

Tags:

ruby

key-value

I need fast and reliable key-value store for Ruby. Is there anything like it already?

The requirement is for it to run wholly inside the Ruby process, not needing any outside processes.
It might be in-memory with explicit disk flushes.
It needs to have minimal value-for-key retrieval times, write times may be not so good.
The amount of data stored won't be terrible, about few hundred thousand keys, each with ~1kb text value.

like image 858
Cyryl Płotnicki Avatar asked Nov 14 '12 18:11

Cyryl Płotnicki


People also ask

What is an embedded key-value store?

Embedded key-value stores come with the additional baggage of embedded systems: they share resources with the system embedding them, which means efficiency is key.

Are all NoSQL databases key-value store?

There are many types of NoSQL databases. They can be divided into four major groups: key-value store, column-oriented, document-based and graph databases. Each of the types suit specific requirements and data types.

Which NoSQL database based on the key-value data store?

MongoDB as a key-value store MongoDB stores data in collections, which are a group of BSON (Binary JSON) documents where each document is essentially built from a field-value structure.

When should you not use a key-value database?

Key-value stores are not considered suitable for applications requiring frequent updates or for complex queries involving specific data values, or multiple unique keys and relationships between them.


2 Answers

It turns out that the best option for me was to use plain Hash along with Marshal to serialize it to disk.
YAML is definitely too slow for that number of objects.
Thanks to @ian-armit for reinforcing my trust in the core Ruby libraries.

like image 79
Cyryl Płotnicki Avatar answered Oct 23 '22 01:10

Cyryl Płotnicki


You could also try Moneta which allows you to build your own key/value store embedded in a ruby process.

like image 30
Daniel Avatar answered Oct 23 '22 02:10

Daniel