Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fastest, non-memory-based, multi-process key-value store for Node.js

What is the fastest non-memory key-value store for Node.js supporting multiple processes?

I need to store simple key-value string/string pairs (not documents or JSON, just strings).
Here are some examples (there would be millions of those):

  • 12345678 – abcdefghijklmnopabcdefghijklmnop
  • 86358098 – ahijklmnopbcdefgahijklmnopbcdefg
  • abcdefghijklmnopabcdefghijklmnop - 12345678
  • ahijklmnopbcdefgahijklmnopbcdefg - 86358098

I have tried:

  • Redis: it's really fast and does everything I need, but consumes too much RAM.
  • LevelDB: it's fast and not too heavy on RAM, but only single-process.

A workaround for LevelDB is multilevel, which exposes a single LevelDB process though HTTP.
But that of course comes at a cost; I need something fast.

Is there any key-value store that:

  • supports Node.js or has bindings for it;
  • stores string/string pairs;
  • supports multiple processes;
  • does not entirely reside in memory;
  • is fast?

I only care about reading. Fast multi-process reading is necessary, but not writing.
I'm happy with the current speed of LevelDB, just not with the fact that it is single-process.


Additional details:

  • I'm talking about some 50 million key/value pairs, with keys and values between 8 and 500 chars.
  • The code will run on a regular Linux server.
  • Memory usage should be limited to a few gigabytes (4GB is fine, 8GB is acceptable)
  • Reading will happen way more than writing; actually, I could do without writing.
  • Speed is more important than anything (given memory and multi-process constraint are respected).
like image 919
Ruben Verborgh Avatar asked Jan 18 '14 13:01

Ruben Verborgh


People also ask

How much RAM is required for node JS?

256 MB is sufficient amount of RAM to run Node. js (e.g. on Linux VPS instance), assuming no other memory-hog software is run.

What does Node js do?

Node. js is primarily used for non-blocking, event-driven servers, due to its single-threaded nature. It's used for traditional web sites and back-end API services, but was designed with real-time, push-based architectures in mind.

CAN node js store data?

Storing your Node. js application's configuration data is quite simple - every object in JavaScript can be easily rendered as JSON, which in turn is just string data that can be sent or saved any way you'd like. The simplest way to do this involves the built-in JSON.

What is the best database for a Node JS project?

As we wrote at the beginning of the article, the choice of the best database for a Node.js project depended on the kind of tasks you needed to solve. Some developers prefer to use a NoSQL database, some prefer using an SQL one. Nevertheless, that’s just a matter of habit and taste.

What are some alternatives to node modules?

Simple key-value storage (a persistent data structure) directly on file system, maps each key to a separate file. A very nice alternative for any of these node modules: node-persist, configstore, flat-cache, conf, simple-store and more...

What is a Java-based DBMS?

The Java-based project was developed by Facebook in 2008 and was then donated to the Apache Software Foundation in 2009. This DBMS is a hybrid NoSQL solution because it combines a ColumnFamily storage model with the key-value concept. Integer – store integer values. Depending on the server, it can be either 32-bit or 64-bit;

What is the faster project?

The FASTER project offers two artifacts to help tackle this problem. FASTER Log is a high-performance concurrent persistent recoverable log, iterator, and random reader library in C#. It supports very frequent commit operations at low latency, and can quickly saturate disk bandwidth.


1 Answers

I would suggest to have a look at LMDB (which is the most efficient engine for OpenLDAP, and used in a number of other open-source projects).

LMDB is an embedded key/value store, with a Berkeley-DB or LevelDB like API, does not have to store everything in memory, and can support access from multiple processes. There are Node.js bindings:

  • https://github.com/Venemo/node-lmdb
  • https://github.com/rvagg/lmdb (see also this post)
like image 151
Didier Spezia Avatar answered Sep 27 '22 19:09

Didier Spezia