This Time Self-Hosted
dark mode light mode Search

Small talk about my experience with MongoDB

I’m interrupting the series of Ruby rants (somewhat) to talk about something that is slightly related but not too much. I’ve already written about my plan of writing a system to index and manage the boxes that I manage at various customers’ places. This system is half written for me to have something neater than GIT and HTML to manage the data, and half to get up-to-date with modern Rails development.

One of the decisions I made was to try for once a NoSQL approach. I had many questions on why I did it that way and the answer was for me pretty simple actually: I didn’t want to spend time in designing the relationships first and write the code later. The nice part about using MongoDB was that I’m able to add and remove attributes when I like, and still query for them without fetching huge amount of data to process Ruby-side.

Honestly, after seeing the kind of queries that Rails concocts to get me data that is normalised, but requires multiple many-to-many relationships to be resolved, I’m quite sure that it can’t be worse with MongoDB than it is with PostgreSQL, for this kind of data.

Of course it’s not all positive sides with MongoDB; beside the obnoxious requirement of a JavaScript engine (and there aren’t many), which is linked to the use of v8 (which is not ABI-stable, and thus each update is a rebuild and restart), I had some bad experience yesterday, but not something extreme, luckily. On the one server I use MongoDB on, I recently configured the locale settings in the environment — but I forgot to re-execute locale-gen so the locale was broken; as it turns out, Boost throws an exception in that case, and MongoDB does not try to manage it, aborting instead.

I guess the main blame here is on the init script that does not report an execution failure: the service is noted as started, and then crashed, which is technically correct, but not what you expect the init script to tell you. I guess if I have more time I should try to get more Unix-style daemon support to mongod so that it can be integrated better with our start-stop-daemon rather than left with the hacky script that it’s using now.

Add to that missing support for using the syslog protocol and you can probably figure out that the thing that worries me the most about MongoDB is the usual sense of “let’s ignore every previous convention” which seems to come with NoSQL projects. Luckily at least this project feels like technically, rather than politically, driven, which means I should be able to get them to at least partially implement those features that would make it a “good citizen” in an Unix environment.

Sigh, I really wish I had a bit more time to hack at it, since I know the few rough spots I found should be easily polished with a week or so of work; unfortunately I guess that’ll have to wait. Maybe after my coming US trip I’ll be able to take a couple of weeks to dedicate to myself rather than customers.

Comments 3
  1. I know you’ve probably seen it already, but 2.1+ will have syslog support as an option:…Thanks for sharing your thoughts; love reading your opinions on things, especially ones I use (MongoDB on Gentoo being one of them). Would really love to see an improved init script, but like you, haven’t had the motivation or time to look into doing so myself. They are working towards it, however, and do seem to genuinely want to be better “citizens” of the ecosystem.

  2. Actually I didn’t know that, I’ll be looking forward for 2.1 then. Maybe I’ll be able to find the time so that 2.1 also has a more Unix-like daemon starting.But first I guess I should try to fix the mongostat command so that I can write a munin plugin for it, sigh.

  3. Glad I could help point you to it! As for munin, I’ve been using… and they’ve been fairly decent, but in the interest of full disclosure I haven’t had to use them a LOT, I mostly just find the information interesting.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.