NoSQL Database for ECommerce

skift picture skift · Sep 19, 2012 · Viewed 12.4k times · Source

I will be constructing an ecommerce site, and would like to use a no-sql database, which will fit well with the plans for the app. But when it comes to which database would fit the job, im not sure. After comparing various DB's, the ones that seem best might be either mongo, couch, or even orientdb. I have seen arguments for all of them to be used or not used compared to something like MySQL. But between themselves (nosql databases), which one would fit well with an ecommerce solution?

Note, for the use case, i wont be having thousands of transactions a second. Or similarly high write rates. they will be moderate sure, but at a level that any established database could handle.

CouchDB: Has master to master replication, which I could really use. If not, I will still have to implement the same functionality in code anyways. I need to be able to have a users database, sync with the mothership. (users will have their own, potentially localhost database, that could sync with the main domains server). Couch is also fast, once your queries have been stored in the db.As i will probably have a higher need for read performance. Though not by a lot.

MongoDB: queries are very easy and user friendly. Also, with the fact that end users may need to query for certain things at a given time that I may not be able to account for ahead of time, this seems like it may be a better fit. I dont have to pre-store my queries in the db. Does support atomic transactions, though only when writing to a single document at a time.

OrientDB: A graph database. much different that most people are used to, but with the needs, it could fit very well too. Orient has the benefits of being schemaless, as well as having support for ACID transactions. There is a lot of customer, and product relationships that a graph database could be great with. Orient also support master to master replication, similar to couchdb.

Dont get me wrong, I can see how to build this traditionally with something like MySQL, but the ease and simplicity of a nosql solution, is very attractive. Although, in my case, needing a schemaless solution, would be much easier in nosql rather than mysql. a given product may have more or less items, than another. and avoiding recreating a table whenever a new field is added, is preferrable.

So between these 3 (or even others you think may be better), what features in each could potentially work for, or against me in regards to an ecommerce based site, when dealing with customer transactions?

Edit: The reason I am not using an existing solution, is because with the integrated features I need, there are no solutions available out there. We are also aiming to use this as a full product for our company. There will be a handful of other integrations than just sales. It is also going to be working with a store's POS system.

Answer

Stennie picture Stennie · Sep 19, 2012

Since e-commerce can encompass everything from shopping carts through to membership and recurring subscriptions, it is hard to guess exactly what requirements and complexity you are envisioning.

When constructing an e-commerce site, one of the early considerations should be investigating whether there is already an established e-commerce product or toolkit that could meet your requirements. There are many subtleties to processes like ordering, invoicing, payments, products, and customer relationships even when your use case appears to be straightforward. It may also be possible to separate your application into the "catalog management" aspects (possibly more custom) versus the "billing" (potentially third party, perhaps even via a hosted billing/payment API).

Another consideration should be who you are developing the e-commerce site for: is this to scratch your own itch, or for a client? Time, budget, and features for a custom build can be difficult to estimate and schedule .. and a niche choice of technology may make it difficult to find/hire additional development expertise.

A third consideration is what your language(s) of choice are for developing your application. Some languages will have more complete/mature/documented drivers and/or framework abstractions for the different databases.

That said, writing an e-commerce system appears to be a rite of passage for many developers ;-).

For MongoDB in particular, you may want to look into:

  • Forward - a new open source e-commerce platform using MongoDB (with declared intent to support other databases). Currently described as in "private beta" but looks worth investigating (and apparently is used for a few live sites already). I noticed it was recently mentioned on the MongoDB blog: How MongoDB makes custom e-commerce easy.

  • MongoDB and E-Commerce - a blog post from Kyle Banker, author of the Manning book MongoDB In Action. It's a few years old, but has some interesting discussion on data modelling considerations; there was also a follow-up on E-Commerce Inventory. Note: the aggregation and reporting options available for MongoDB have greatly improved since those posts.

  • Perform Two-Phase Commits - a design pattern for doing multi-document updates in MongoDB

The Master-Master replication (MVCC) you mention doesn't seem like it would be a relevant feature for e-commerce, where you would generally need strong consistency rather than eventual consistency. You mention syncing user databases, so perhaps that specific requirement might be better addressed by a single sign-on solution like OpenID.