libraries: All content tagged as libraries in NoSQL databases and polyglot persistence
Staying in the Java land, I’ve put together this short list of Redis Java libraries as I’m looking myself for a stable one:
Main page mentions that JRedis is compatible with Redis 1.2.x only. But JRedis author left a comment mentioning that JRedis is Redis 2.0.0 compatible.
Project home page mentions that Jedis is compatible with Redis 2.0.0. Currently the following features are supported:
- Connection handling
- Commands operating on all the kind of values
- Commands operating on string values
- Commands operating on hashes
- Commands operating on lists
- Commands operating on sets
- Commands operating on sorted sets
- Persistence control commands
- Remote server control commands
- Connection pooling
A library developed in Scala (you should still be able to use it from any VM language) compatible with Redis 2.0.0. Some features:
- Native Scala types Set and List responses.
- Consisten Hashing on the client.
- Support for Clustering of Redis nodes.
Have I missed any? Also wondering which of these is stable.
Update: Graeme Rocher (@graemerocher) pointed out:
According to project home page, it is compatible with Redis 2.0.0, but there are no other details.
There have been only a few days since I’ve written that (maybe) there are already too may mapping tools for document databases. Then, we’ve heard about Mongomatic: a minimal Ruby mapper for MongoDB. And now it is MongoODM, yet another Ruby mapper for MongoDB that can be found on ☞ GitHub.
Basically, I’ve tried to create an ODM that uses the native query syntax of the Ruby driver, but that was:
- Fully compatible with Rails 3
- Use the Mongo ruby driver syntax over a new syntax (for queries, cursors, indexes management…)
- Allow lazy loading of collections and queries nesting (concatenation of ‘find’ calls) to emulate ActiveRecord 3
- No association methods (for now): Just declare your own methods on models to fetch associated items
- Give support for dirty objects, validations, etc. through ActiveModel 3
- Automanage type conversions and default values
- Keep it as simple as possible
I made sure to ask the author, Carlos Paramio, why a new mapping tool for MongoDB? and what is it different in MongoODM compared to those other 3 MongoDB mapping libraries?
Carlos Paramio: The main reason for me creating this new ODM is that I felt the Mongo Ruby driver and its syntax (which is pretty similar to the native MongoDB syntax) is much more proper and richer than the syntax similar to the popular ActiveRecord ORM for Ruby — which is particularly designed for relational databases. Even if MongoMapper and MongoId are awesome projects, they both share this particular ActiveRecord-like syntax, which sometimes seems a bit forced and it generates weird bugs and unexpected behavior.
I preferred to use the official syntax and instead of writing tons of new code to bring all the other interesting features that you would expect from an Object Mapper (as an extra to the database driver), I used some stable and widely used Ruby libraries to provide: Validations, type conversions, dirty objects, nesting conditions, Rails 3 compatibility, etc.
There is a similar ODM by Ben Myles, who shares this same opinion about how a MongoDB ODM should work. It’s called MongoMatic, and it’s really cool. I think we started to code our ODMs at approximately same time, because we both have published stable versions of them recently (I’m particularly using MongoODM for my own project). MongoMatic doesn’t support some features like dirty objects, nesting conditions or Rails 3 compatibility yet, but it seems to be interesting to follow.
I think some people was expecting a solution like this. Like Kyle Banker has said (and I quote) recently in response to the MongoODM announcement at the mongodb-user mailing list: “Awesome. I love the trend of moving toward a more native MongoDB query syntax. Great to see the surge in new Ruby ODMs, too.”
Now the Ruby world of MongoDB has 4 mapping libraries and it is only the time and users that will decide if all of them are needed.
In case you miss data to play with CouchDB, now you can ☞ import Wikipedia dumps:
First of all WikiImporter is a lame name! It is a set of tools for importing Wikipedia dumps to CouchDB. The parser currently only extracts the page ID, title, text, version ID and the timestamp of the latest change. For CouchDB document IDs currently the page title is used.
- Richard Boulton: ☞ Using Redis as a backend for Xapian. An interesting analysis of how a dedicated search engine would work with a Redis backend. Meanwhile others try to simply store the reverted index into Redis¶
- Paul Rosania: ☞ Point-and-Click install of MongoDB on OS X 10.5+. Not that it was difficult before, but nice to have! ¶
- Doug Judd: ☞ Why We Started Hypertable, Inc. … or welcome to the Hypertable Inc. blog. ¶
- Surya Surabarapu: ☞ Terrastore Scala Client. First Terrastore library in our NoSQL libraries list ¶
It might be only my feeling that the amount of experiments and work done in the NoSQL space using dynamic languages (PHP, Python, Ruby, etc.) is bigger than what has been done so far using “big brothers” languages like C# or Java. That’s not to say that C# and Java developers do not like NoSQL, just that good resources are rare.
Here are my notes after going through the article:
- model classes must extend a library provided class (
CouchDbDocument). Java being a single inheritance language, this might be an issue for complex class hierarchies, so I was wondering if an approach based on annotations (see JPA) would not work even better. Update: according to the author this is optional and there are also mechanisms available.
- “view” classes which provide through an annotation the CouchDB mapreduce based view definition.
It is also worth noting the comment around the model definition:
The relationship between BlogPost and Comment is modeled with a blogPostId field in Comment. In order to find the comments for a blog post a ‘by_blogPostId’ query has to be performed.
A perhaps more natural way would be let BlogPost keep its comments in a list. Although this is possible, this model would cause update congestion in the blog post document if many users post comments concurrently.
A better way is to keep each comment in its own document as no update conflict will occur.
We already talked a couple of times about how important is the role of data modeling while using a NoSQL storage. And even if CouchDB has ☞ a whole wiki page dedicated to modeling entity relationships and there are some articles covering schemaless data modeling, questions are still arising ☞ every ☞ day. The lesson to be learned from this is that: 1) you’ll need to carefully design your data model and 2) while you might be tempted to re-use an already known “pattern”, you’d better think twice about your application scenarios.
MongoDB Slow Queries Monitor
Reports slow queries based on the threshold (100ms or greater) you specify. Provides details on queries that are slow.
MongoDB Metrics for Ganglia
Right now it tracks the following:
- Operations per second
- Memory usage
- Btree statistics
- Master/Slave status
- Current connections
Meclipse: Eclipse + MongoDB
What does Meclipse do? * It has a MongoDB View that contains a list of servers (connections). It is possible to add/remove connections. They are saved in a settings file. * It loads (as TreeView) the list of databases and collections. * It loads the data found in the collection. To do this, Meclipse opens a new Editor and shows the data loaded (This part needs a lot of work).
Do you have other MongoDB utilities that you’d like to share?