MongoDB versus MarkLogic, the Fight

On the scale

No, this is not the latest work from The Asylium productions, but the comparative match of two of the leading document-oriented NoSQL databases.

MongoDB and MarkLogic are among the leading databases in the famous Gartner ranking:

 

MarkLogic was founded in 2001, when it entered the XML database niche that was popular at the time. Now in version 8, Marklogic, which is the market leader, has integrated the Json format and Javascript query APIs in addition to its native XQuery APIs.

MongoDB was created in 2007, taking advantage of the nascent NoSQL movement. MongoDB is now in version 3.2.

Since MarkLogic version 8 and its integration of the Json format, the two databases have many points in common which now allow them to be compared:

  • NoSQL world
  • document-oriented databases
  • storage of documents in json and binary format
  • javascript query

 

The ten-round battle is played out in a tense atmosphere, with MongoDB benefiting from a large supporting audience while the heavier and more experienced MarkLogic waits with bated breath for his challenger.

Summary of the fight::

In the ring

Organisation of documents

MongoDB adopts a collection-based approach representing a logical grouping of documents without constraining their format. A collection is a "bag" containing documents. Documents are contained in only one bag. The notion of collection is central in MongoDB since operations on documents are done through collections, as the CRUD APIs do not offer the possibility of updating documents horizontally over several collections. Collections can be limited in size which can be interesting in some use cases.

MarkLogic organises documents in a tree structure based on the document uri. This form of organisation has the advantage of allowing exposure of the database via the WebDAV protocol, and also allows business or technical semantics on the uris (e.g. /records/2015/07/12/12345.json). In MarkLogic, collections are document metadata, which allows a document to belong to several collections and does not hinder horizontal updating across the entire database. MarkLogic also includes an option for versioning documents.

 

Looking at the physical storage of data, the MarkLogic organisation is much more professional than MongoDB.

In MarkLogic the databases are organised in Forest (more or less equivalent to Oracle Tablespace).

 

In MongoDB, the databases are mixed, the tool not forcing any organisation.

 

The result of the first round: MarkLogic has the advantage for the flexibility of data organisation on the logical side and the consistency on the physical side. MongoDB, which is more messy, has let its guard down.

 

Basic operations

Both databases support CRUD operations with or without locks. Both offer read, write, update, and single or multiple delete capabilities. MongoDB has a Bulk mode for writes, while MarkLogic has a Bulk mode for writes and reads.

MarkLogic supports ACID transaction management on a set of updates, while MongoDB is content with document-level acidity (which seems a minimum).

 

Result of the second round: MarkLogic advantage for multi-document ACID transactions that sends MongoDB to the ropes.

 

Search

If there is one aspect where MongoDB is really poor, it is the search. A too simple rooting , quite few fine search options but some regular expression search possibilities and a geospatial search that seems quite complete (I confess I never used the latter). MongoDB clearly needs a search engine as a complement (ElasticSearch for example) as soon as the expectations of business results are important and the searches to be carried out are not of the form type.

MarkLogic on the other hand is clearly a search engine and is among the best. The search options are simply enormous (multiple levels of root, faceting, thesaurus, geospatial, reverse search, etc). It is also possible to create multi-format indexes on document fields; for example, if a document in json format contains an "author" field and an xml document contains an "author" element, it is possible to create an index based on the paths of these fields. The MarkLogic search guide alone is over 500 pages long.

 

The result of the third round: MarkLogic is still in the lead as it is a real search engine that performs particularly well. MongoDB was a knockout in this round.

 

Performance

It is always difficult and tricky to compare the performance of two DBMS without a common benchmarking tool. If MongoDB has a YCSB input it is not the case for MarkLogic. This round is therefore based on my experience of using both databases.

I will try to back it up with more tangible results in the near future.

Without specifying any particular index, after loading the same data, MarkLogic performs slightly better than MongoDB on most queries. This is probably due to the fact that MarkLogic creates some indexes by default.

With index, in MarkLogic and MongoDB, results can be as much as 100 times faster for MarkLogic especially on text searches.

 

Result of the fourth round: difficult to decide between the two opponents on this round for lack of objective data. Draw pending a later decision by the referee. Whistles in the stands.

 

API

On the API side, MarkLogic offers Javascript (NodeJs), Java (no Spring Data), XQuery and especially REST APIs. It should be noted that the NodeJs and Java APIs are only an overlay of the REST APIs. These APIs are complete and cover both database administration and data access.

MongoDB offers native APIs in C, C++, Java (sync and async) and Javascript. The Open Source model and the wide distribution of MongoDB has allowed the development of rich and varied APIs.

 

Result of the fifth round: advantage MongoDB which recovers and manages to place a light right hook which puts MarkLogic off balance.

 

Map-reduce and aggregation

Both MarkLogic and MongoDB offer both map-reduce and aggregation.

For its part, MarkLogic integrates the Hadoop map-reduce engine and offers aggregation functions (avg, sum, min, max, variance, covariance, etc.). The concept of aggregation is a little different from that of MongoDB in the sense that MarkLogic's is mainly concerned with mathematical calculations, aggregations in the sense of grouping are handled by other functions more related to research. Map-reduce, on the other hand, requires configuration and writing code in Java or C++.

MongoDB provides api allowing to make map-reduce in a rather simple way and a framework of aggregation which would deserve a more clarity (this part evolves however rather quickly). These functions are central to MongoDB and allow a real exploitability of the documents of the base.

 

The result of the sixth round: MongoDB has a new advantage and its attacks are more precise. MarkLogic defends itself well and keeps a good footwork.

 

Documentation / training / support

Rarely has a documentation site been richer than that of MarkLogic. The documentation is very precise and almost exhaustive. Most of it is also available in PDF format and occupies a volume of several thousand pages (530 for the search guide alone, for example).

MarkLogic offers a wide range of training materials in the form of tutorials, videos and even free remote training sessions for developers and administrators.

The MarkLogic documentation site is just huge!

 

MongoDB offers a fairly complete documentation, but it is sometimes updated after the release of new features. However, the documentation lacks completeness and consistency when it comes to using the more complex aggregation or map-reduce functions. The search in the documentation, if it uses MongoDB, shows its shortcomings in this area because a search in the documentation on "regex" or "$regex" never leads to the page of the $regex operator.

On the support side, videos and free distance learning sessions are also numerous and varied.

The font of the doc. MongoDB allows a better reading (it is the only advantage of the doc!)

 

Result of the seventh round: no miracle in this round, advantage MarkLogic which again struck a violent uppercut to MongoDB. The latter has just finished on the ground again and got up just before the 10 seconds.

 

Ecosystem

Because of its open source positioning and its wide distribution, MongoDB benefits from a set of very important free or paid tools. In particular, RoboMongo (free) or MongoVue ($35) offer a particularly pleasant heavy client interface for browsing the contents of databases and executing scripts. The MongoDB Tools site lists the main tools dedicated to MongoDB.

The excellent RoboMongo

 

MarkLogic has a native set of tools to quickly start building an application and a particularly rich administration interface. Unfortunately, some of the tools (notably qconsole) are not up to par with the product. The MarlKogic development site lists a number offree tools made available by Marklogic or the developer community.

The MarkLogic Administration Console allows you to set everything up.

 

However, it should be noted that MarkLogic hosts more projects on its Github repository than MongoDB does on its own.

 

Result of the eighth round: slight advantage for MongoDB, which held up particularly well in this round and pushed MarkLogic to the ropes.

 

Awards

In terms of licence prices, Marklogic and MongoDB are not in the same league and do not have the same business model. Moreover MarkLogic has a plethora of additional features such as an alert system, reverse lookups, the possibility to work in XML, semantic aspects ..., only the features on the common aspects are compared here.

 

Marklogic has positioned itself on an Oracle-style model, which is costly and safe for its product. The development version, which is not restricted and has all the functionalities, is available free of charge. This version cannot be used commercially.

 

MongoDB adopts a business model where the tool is free but additional services are paid for (support, particular bug fixes ...).

 

As an example, the pricing of the two tools is approximately as follows

Developer SAAS Clean accommodation
Marklogic Free of charge 1 hr or $8,500 / year 18,000 / year / server including support or $32,000 perpetual license.
MongoDB Free of charge 380 / year Free of charge, price of media not known

 

Result of the ninth round: MongoDB has regained its cool and is sending a quick alternation of hooks to MarkLogic.

 

Product developments

The least we can say about MarkLogic is that it is not a fixed and sclerotic tool. Major releases are regular with about one release every 1.5 years and release versions 3 to 4 times a year. The change is done in the continuity with the contribution of new functionalities (json, rdf, bitemporal...)

MongoDB has a somewhat similar evolutionary process but the major/minor version distinction is more blurred (version 2.4 in 2013, 2.6 in 2014 3.0 in 2015). Change is not always seamless, with version 3.0 requiring some updates.

 

Result of the tenth round: MarkLogic finishes on a beautiful last round and dominates MongoDB.

 

End of the fight

MarkLogic logically won this match 5 points to 4 and a tie. MongoDB narrowly snatching 2 of his rounds.

 

MarkLogic undoubtedly provides a more complete, more industrialised solution to the simplest and most complex needs by bringing together in a single product a range of features not previously available in the database world.

 

MongoDB offers a fast, inexpensive, easy-to-implement solution for storing binaries and documents in Json format and then accessing the documents themselves. As soon as the needs and uses become more complex, the need to associate a search engine with upstream or downstream data processing is cruelly felt (ElasticSearch type search engine).

Epilogue

ContentSide has been a Marklogic partner and reseller for many years, so some might conclude that this comparison is biased and advertorial. I would like to stress that many of our projects and products (including News'Innov, our flagship product) successfully use MongoDB. This comparison is based on our dual expertise, which we have and will continue to have, as these two products respond to different business logics.

Are you interested in this topic?

CONTACT US