News for hackers. Stuff that matters.
Re:Why I Migrated Away From MongoDB by gregjor on Monday September 17, 2012 @02:43PM (#4534128)
I don't know if there's a use case. I have never had one come up in my own projects. I do sometimes need to manage a large number of documents (unstructured data) but I have found the Unix file system sufficient for those, maybe augmented by metadata in the database.

I've worked on big applications with big databases where DB operations and aggregations started to get too slow but so far I or someone smarter on the team has always been able to figure out a solution without throwing the RDBMS out. One big advantage of working with RDBMSs is the roads are paved and well-mapped. By contrast you still need a machete and good luck in the NoSQL world, and even then you can get sick or lost in the jungle.

I haven't personally worked on a web app with the kinds of database scaling issues I've dealt with in logistics applications involving tens of millions of movements every day.

RDBMSs were invented to allow data malleability. Go back to the old textbooks and look at what preceded the relational model. Remember that data is more valuable and permanent than application code. When you have multiple applications accessing the same database, each with their own implementation of consistency rules and their own internal idea of the data schema, come back and explain how that is more fun than using an RDBMS and being able to sleep nights.

Re:Why I Migrated Away From MongoDB by blaines on Monday September 17, 2012 @03:12PM (#4534301)
Respectfully, I believe your comment is not very open minded. I believe the obvious answer is "Of course there's a use case!", just like there's obviously a use case for RDBMS, NoSQL (Mongo, Cassandra, BigTable, Redis, etc) serves a purpose.

I'll give you a couple examples. Google stores a huge amount of data in BigTable [1] which is fundamental for the operation of Gmail at scale. Another, Facebook initially used Cassandra [2] for it's Inbox search, then migrated to HBase when their needs changed for their new messaging feature.

Do we know if the the underlying data is stored in RDBMS? I'm guessing not at Google, but yes for Facebook/Inbox search. But my point is I'm not ruling it out, I'm open to different options.

[1] http://en.wikipedia.org/wiki/BigTable [2] http://en.wikipedia.org/wiki/Apache_Cassandra#History

Re:Why I Migrated Away From MongoDB by gregjor on Monday September 17, 2012 @03:25PM (#4534357)
I wrote "I don't know if there's a use case. I have never had one come up in my own projects." I don't work for Facebook or Google, perhaps they have a use case. I guess I could assume there's a use case because the tools exist and people use them, but in my experience I have not had a need for Mongo or any NoSQL database.

I'm not dismissing the tools out of hand -- I haven't used them except to play around with tutorials. I am pretty sure a lot of people start out with Mongo or whatever without having a use case defined and without having good reasons to eliminate the tried-and-true RDBMS solutions. "Use something cool and new" is not a use case. "I've read on slashdot that SQL databases don't scale" is not a use case.

Re:Why I Migrated Away From MongoDB by taligent on Monday September 17, 2012 @04:49PM (#4534816)
> I haven't used them except to play around with tutorials.

And yet you feel the need to lecture others on their choices ?

Wow you are something.

Re:Why I Migrated Away From MongoDB by ozataman on Monday September 17, 2012 @04:32PM (#4534721)
I'm not sure if Cassandra and Bigtable are "document" databases in the same vein as MongoDB. These guys are more like turbo-charged key-value stores - which is quite different. They trade in the ability to manipulate data for an ability to scale out linearly and have no singular point of failure (and of course various other trade-offs). Cassandra nicely gives you composite columns and column-key sorting, but that's about all you're going to get.
Re:Why I Migrated Away From MongoDB by blaines on Monday September 17, 2012 @08:25PM (#4535616)
"NoSQL is simply a buzzword. It basically means 'anything but the old and trusty MySQL server in the attic', which includes a lot of alternative storage mechanisms. Even a simple text file can be considered a NoSQL solution"

http://stackoverflow.com/questions/4255895/why-googles-bigta...

Re:Why I Migrated Away From MongoDB by gregjor on Monday September 17, 2012 @03:32PM (#4534393)
I'll add that email and Facebook postings and Instagram photos don't require the same kind of data consistency and durability that medical records, bank transactions, or rail car movements require. If Google loses some old emails or Facebook loses the last thousand "likes" on a Jersey Shore fan page that's not much of a catastrophe, and they don't guarantee their data anyway. For those use cases Mongo or Cassandra et al. may be the right fit.

I work on a app that stores documents (PDFs) in Amazon S3 containers, and sometimes those documents get lost or inaccessible for some reason. We have backups for those. The only consistency requirement there is that the PDF opens and the name matches the name in the RDBMS. That's a much lower bar for consistency and durability than our credit card transaction data, for example.

Re:Why I Migrated Away From MongoDB by taligent on Monday September 17, 2012 @05:37PM (#4535028)
This is complete and utter nonsense.

Facebook and Instagram itself I imagine would care VERY much if data went missing as it would mean not just (a) user data going missing but (b) potentially huge inconsistencies in the social graph.

Unless you have some evidence that those companies do not care about data durability ?

Re:Why I Migrated Away From MongoDB by nerd_in_rage on Monday September 17, 2012 @08:25PM (#4535615)
What? It's the absolute truth. If someone's wall post or tweet goes missing, it's totally inconsequential.

"Social graph" - LOL.

Re:Why I Migrated Away From MongoDB by lttlrck on Monday September 17, 2012 @10:49PM (#4536034)
You think FB doesn't consider durability and consistency essential? With almost one billion users?!

Wow.

Whether it is consequential or not is completely beside the point. As is whether you understand the "social graph".

Re:Why I Migrated Away From MongoDB by nerd_in_rage on Monday September 17, 2012 @11:27PM (#4536146)
Eventual consistency, yes. What I'm saying is if a few pics disappear for a half hour while things resolve themselves, nobody is going to care... or likely notice.

It's not a bank.

By the way, I believe social networking is mostly bullshit, which is my "LOL" at the "social graph".

Re:Why I Migrated Away From MongoDB by einhverfr on Monday September 17, 2012 @11:47PM (#4536215)
Eventual consistency however provides no guarantee of consistency unless it is backed by absolute local consistency on every node. Don't you run into CAP theorem problems otherwise?
Re:Why I Migrated Away From MongoDB by taligent on Monday September 17, 2012 @10:44PM (#4536018)
Sure. But if a person or a photo data object goes missing ?

Facebook has different data stores for each of their features so I imagine the loss of a person would be pretty nasty as would a photo data object that multiple people have tagged or commented on.

My point is that when you are the size of Facebook, Twitter etc a loss of data in 0.001% of cases equates to a LOT of data and relationships.

Re:Why I Migrated Away From MongoDB by einhverfr on Monday September 17, 2012 @10:45PM (#4536020)
If it is that important, they'd be using an ACID-compliant solution, right?

You don't use Best-guess Attempt at Sorta-consistent Eventualities for important data ;-)

Re:Why I Migrated Away From MongoDB by einhverfr on Tuesday September 18, 2012 @02:55AM (#4536765)
I suspect that a lot of NoSQL folks come to NoSQL from MySQL.

As for this part:

>"When you have multiple applications accessing the same database, each with their own implementation of consistency rules and their own internal idea of the data schema, come back and explain how that is more fun than using an RDBMS and being able to sleep nights."

The obvious answer from the MySQL/NoSQL folks is "What? That's crazy! Multiple apps hitting the same db? Are you nuts???"

See my blog post at http://ledgersmbdev.blogspot.com/2012/09/or-modelling-interl... for more on this mentality.

Re:Why I Migrated Away From MongoDB by gregjor on Wednesday September 19, 2012 @02:38AM (#4542422)
I wasn't able to figure out how to post a comment/reply on Blogger, sorry.

Thanks for pointing me to your article from the HN flame war about MongoDB. If only there were more useful articles like this and less flaming.

You wrote "...in MySQL, the application is king and the db a humble servant." That is exactly my experience, and it leads not only to terrible databases but to piles of awful code written around terrible databases. In 1974 Kernighan and Plauger wrote "Choose a data representation that makes your program simple" (Elements of Programming Style). Other esteemed programmers have said the same thing. A well-designed and normalized database schema with validations and access rules implemented in the database will reduce the amount of application code needed.

I've written about keeping data management code in the database where it belongs (http://typicalprogrammer.com/?p=101), but you make a much clearer argument with real examples. A few years ago the Ruby on Rails people championed the idea of "application databases" and writing HTTP+XML APIs, which probably seemed like a great idea given that few, if any, Rails applications ever had databases that other applications needed to access. Now the NoSQL folks have taken this even further, eliminating structure from the data and all ACID compliance, separating the data from integrity enforcement, all in the name of scalability problems their app might have if they get as big as Google.

I am stuck with MySQL most of the time because I work with broken web applications, and so far all but a couple have used MySQL. As a long-time Oracle and SQL Server programmer I almost cry trying to figure out some of the MySQL databases I come actoss. I am working on one now that uses GUUIDs as primary keys in every table, generated in PHP code, for reasons I can only attribute to ignorance.

Re:Why I Migrated Away From MongoDB by einhverfr on Wednesday September 19, 2012 @05:39AM (#4542851)
It's too late to post on your blog, unfortuanately (great article btw) but I think your article hits the nail on the head. A couple points I would make though is that I don't see anything wrong really with using an ORM plus views to encapsulate data. INSERT INTO invoice isn't all that bad if invoice is a view. Data operations are still encapsulated.

The second point is that I am a relative fan of loosely coupled systems. Loose coupling gets away from CAP theorem problems because each system is autonomous and can always defer interop with other applications until later. On the other hand your centralized RDBMS goes down and every app that needs it dies with it. How many apps we want entangled in that way is a business decision but there are tradeoffs on both sides.

That doesn't mean endorsing the NoSQL approach though. I maintain that you can't have "eventual consistency" in any meaningful, guaranteed way unless you always have "absolute local consistency" within some scope. Postgres-XC defines that scope as cluster-wide. In a loosely coupled system it could be each individual node. For this reason BASE doesn't work for anything that is important. It reduces to:

Best-guess Attempt at Semi-consistent Eventualities.

Lesson is: not only do you want to encapsulate your data, but anywhere that you want eventual consistency, you need to have local ACID compliance for some defined scope of local. This is a big issue that NoSQL db's have and that they cannot solve (due to CAP theorem issues). If only it were absent from the RDBMS world. I groan every time someone asks for "multi-master asynchronous replication."

Re:Why I Migrated Away From MongoDB by einhverfr on Wednesday September 19, 2012 @05:27AM (#4542813)
>"That is exactly my experience, and it leads not only to terrible databases but to piles of awful code written around terrible databases. "

Not planning for the future tends to do that.

>"I am stuck with MySQL most of the time because I work with broken web applications, and so far all but a couple have used MySQL. As a long-time Oracle and SQL Server programmer I almost cry trying to figure out some of the MySQL databases I come actoss. I am working on one now that uses GUUIDs as primary keys in every table, generated in PHP code, for reasons I can only attribute to ignorance."

Ouch, that sounds painful. I have horror stories I could tell too. Ambiguous foreign keys? ouch.....