News for hackers. Stuff that matters.
Re:Cassandra vs MongoDB For Time Series Data by arohner on Wednesday August 21, 2013 @01:54PM (#6252137)
One thing I always find interesting about these kinds of problems is that most DBs don't describe how they're implemented. It's easy to use the wrong tool, and then once you learn how e.g. Mongo is implemented, it's obvious, "oh, that's why things are slow".

I'd love to see http://eagain.net/articles/git-for-computer-scientists/, but for every DB technology.

Re:Cassandra vs MongoDB For Time Series Data by teraflop on Wednesday August 21, 2013 @02:55PM (#6252524)
Agreed. Seeing a nice, clean user-facing API tells you practically nothing about the performance characteristics and failure modes you can expect to see.

The best database engine I've encountered in this respect is SQLite. It has plenty of information about what design tradeoffs it makes, and why, e.g.:

http://sqlite.org/lockingv3.html

http://sqlite.org/fileformat2.html

http://sqlite.org/atomiccommit.html

Re:Cassandra vs MongoDB For Time Series Data by trimbo on Wednesday August 21, 2013 @01:58PM (#6252169)
You nailed it. I think the issue is that people don't know what questions to ask when gathering the requirements.

I'd like to know more about how this part of the article came to be:

"This choice was made early on and it was supposed to be a temporary one."

HOW was that choice made. What requirements were out there. I think too many people choose Mongo because they believe it's "schemaless"[1] and faster for development, but don't look at the requirements for their actual use case.

[1] - There's always a schema. Either it's informally defined by your code or represented formally somewhere else.

Re:Cassandra vs MongoDB For Time Series Data by relistan on Wednesday August 21, 2013 @03:53PM (#6252910)
It was one of those, "we need to do something now and this will work" solutions. We had a really talented consultant working for us, writing some of the early code. He was familiar with Mongo and wanted to go that route. Early on I said we should use Cassandra for this, but it took us quite some time to get to the point of being able to migrate. A testament to his code and the "this will be temporary" foreknowledge is the fact that we could swap data stores in a pretty massive sense without much in the way of outward-facing changes to our processing engine.

I think the hard thing for us up front was that trying to explain Cassandra data models to someone (and this guy is really really good) and then hand the rest of the work over to them to implement now, on a contracting rate is not a trivial problem. And we needed to hurry for both deadlines and burn rate.

Re:Cassandra vs MongoDB For Time Series Data by trimbo on Wednesday August 21, 2013 @05:25PM (#6253397)
Cool, thanks for the info!
Re:Cassandra vs MongoDB For Time Series Data by mtkd on Wednesday August 21, 2013 @02:03PM (#6252195)
A pattern I've seen on a lot of the negative Mongo articles has been people using it for things they probably shouldn't.

I've yet to use it for any load, and am struggling to triangulate from all the articles I read on whether it does/doesn't scale efficiently.

All the issues I have hit so far have been self-inflicted, it is still one of the best new technologies I've used in years - but is has taken a while to stop thinking in SQL equivalents and start thinking natively.

Re:Cassandra vs MongoDB For Time Series Data by arohner on Wednesday August 21, 2013 @03:53PM (#6252909)
> whether [Mongo] does/doesn't scale efficiently

It doesn't. Three words: "global write lock". Writes block reads, reads block writes. Implications: if you run a query in production that doesn't hit an index, all traffic stops. The notablescan setting is a very, very good idea. This also means all queries must have an index, so Mongo ends up with more indexes than say, postgres would.

It's impossible to configure a clustered mongo environment to not lose data: http://aphyr.com/posts/284-call-me-maybe-mongodb

Sharding configuration is baroque, and limited.

Re:Cassandra vs MongoDB For Time Series Data by snmaynard on Wednesday August 21, 2013 @05:12PM (#6253340)
> Implications: if you run a query in production that doesn't hit an index, all traffic stops

Even if Mongo did have a global write lock, which it doesn't as has already been covered, it yields on page faults which means that other queries are minimally impacted. See: http://docs.mongodb.org/manual/faq/concurrency/#does-a-read-...

Re:Cassandra vs MongoDB For Time Series Data by arohner on Wednesday August 21, 2013 @06:01PM (#6253598)
Mongo does have a global write lock. A per-db lock does me very little good when I only have one DB.

As to your linked doc, emphasis added:

> In some situations, read and write operations can yield their locks.

> Long running read and write operations, such as queries, updates, and deletes, yield under many conditions.

In practice, I've been bitten hard by this. A new feature rolls out, and users can't log in anymore, because a query is taking 2 minutes to run.

Re:Cassandra vs MongoDB For Time Series Data by cbsmith on Wednesday August 21, 2013 @08:35PM (#6254306)
That's solves the contention problem, but just by virtue of yields on page faults being a big feature you can see where Mongo does have some scaling issue.
Re:Cassandra vs MongoDB For Time Series Data by francesca on Wednesday August 21, 2013 @04:47PM (#6253204)
The global lock was removed in 2.2

https://blog.serverdensity.com/goodbye-global-lock-mongodb-2...

Now locking is on the database level.

Re:Cassandra vs MongoDB For Time Series Data by MichaelGG on Wednesday August 21, 2013 @08:30PM (#6254282)
That sorta makes it sound worse, honestly, if databases in MongoDB are anything like you'd use the word for in any other datastore. A global lock across all databases is mind-bogglingly confusing; what's one DB got to do with another?

Couldn't you just work around that before by running a separate Mongo process per database?

Saying it's now on the database still means any single-database app is globally locked. Or does using Mongo imply you're going to be making lots of databases so this actually means anything?

Re:Cassandra vs MongoDB For Time Series Data by nasalgoat on Wednesday August 21, 2013 @10:18PM (#6254710)
That's what we do - dozens of databases, containing one collection.

It's perverse.

Re:Cassandra vs MongoDB For Time Series Data by VintageCool on Wednesday August 21, 2013 @07:32PM (#6254019)
TokuMX. They ripped out the native MongoDB storage engine and replaced it with the TokuDB engine.

http://www.xaprb.com/blog/2013/04/29/what-tokudb-might-mean-...

Re:Cassandra vs MongoDB For Time Series Data by nasalgoat on Wednesday August 21, 2013 @10:20PM (#6254718)
TokuDB doesn't currently have a drop-in replacement strategy, so you'd need to migrate your whole cluster.

A daunting task with hundreds of shards!

Re:Cassandra vs MongoDB For Time Series Data by leif on Thursday August 22, 2013 @12:17AM (#6255138)
Such a thing could never exist, because the point of tokumx is to change the storage system, so at some point you have to change the storage over and that's just going to be a rewrite of all your data. It sucks but that's the way it is.
Re:Cassandra vs MongoDB For Time Series Data by nasalgoat on Thursday August 22, 2013 @11:50AM (#6257878)
Yes, but if I could replace the replicas and let them refill one at a time, then replace the masters, I could do a rolling conversion.

But replication from MongoDB to TokuDB does not work.

Re:Cassandra vs MongoDB For Time Series Data by leif on Friday August 23, 2013 @02:17PM (#6265309)
Actually, you can do that. I wrote a tool to allow replication from MongoDB to TokuMX: http://www.tokutek.com/2013/07/tokumx-1-0-3-seamless-migrati.... It doesn't allow TokuMX instances to satisfy write concern or to participate in elections, but you can slave a TokuMX replica set off a MongoDB replica set just fine, and this allows you to do a rolling migration where you replace one secondary at a time.
Re:Cassandra vs MongoDB For Time Series Data by foobar1988 on Wednesday August 21, 2013 @04:47PM (#6253211)
You could say the same about multi-master environments. Those are prime opportunities for losing data (eventually consistent does not mean consistent, it means data loss)
Re:Cassandra vs MongoDB For Time Series Data by relistan on Wednesday August 21, 2013 @03:46PM (#6252863)
Hopefully this article wasn't seen as bashing MongoDB. I think I mention it was pretty reliable for us even under load. We were just solving a problem with it for which it wasn't the best solution.
Re:Cassandra vs MongoDB For Time Series Data by nasalgoat on Wednesday August 21, 2013 @10:17PM (#6254707)
It doesn't. MongoDB is a dog, and I know this because I run hundreds of instances of it in a production environment. I need to use 10x as many hosts as I should to support less than 30K queries per second.

The second I can migrate to another data store, I will. Unfortunately that kind of refactor isn't possible right now, but all new projects are using different tools.

Re:Cassandra vs MongoDB For Time Series Data by otterley on Wednesday August 21, 2013 @03:37PM (#6252796)
For what kind of application or workload is MongoDB superior to the alternatives?
Re:Cassandra vs MongoDB For Time Series Data by Xorlev on Wednesday August 21, 2013 @11:58PM (#6255064)
The kind that lives on a single VPS and requires a rich query layer to bootstrap quickly.
Re:Cassandra vs MongoDB For Time Series Data by mh- on Wednesday August 21, 2013 @07:56PM (#6254121)
> I'd love to see [git-for-computer-scientists], but for every DB technology.

this is a fantastic idea. if someone gets this going I'll enthusiastically contribute.

Re:Cassandra vs MongoDB For Time Series Data by hcarvalhoalves on Wednesday August 21, 2013 @10:23PM (#6254731)
+1

It would be useful to treat databases as those big data structures, knowing the best/average/worst case, cpu vs. memory trade-offs for search, etc.