A few weeks ago we were at MongoDB World 2017 in Chicago. The engineers and I who attended took full advantage of the demos and presentations given there. One of my favorites was "Using Compass to Diagnose Performance Problems in Your Cluster". MongoDB Compass is a graphical client for MongoDB. If you use MongoDB to host your Nuxeo repository then Compass is a tool you should be familiar with.
Compass connects to your MongoDB cluster and presents two tabs - Databases and Performance. In the Database tab, we can create and browse what's on the host. Statistics are given for existing databases. We can drill down into a database and browse its collections. In the nuxeo database we can see the default collection where the general document hierarchy is stored. If
nuxeo-mongodb-ext is installed we can see collections for Nuxeo directories and audit records. Drilling down into a collection we can work with the collection schema, view, edit or insert documents, view and create indexes, explain queries and view and edit validation rules.
In the Performance tab we can view real time performance metrics, watch the hottest collections (the collections most frequently used) and inspect long-running queries. All of these options give a Nuxeo admin the ability to view and interact with database records, add indexes to improve search performance, and identify potential points for improvement.
To get an idea of what the Performance tab offers I imported a few thousand random text documents using the Nuxeo Platform Importer. As the import progressed I could see the insertion of new documents, database queries on those documents, and updates to the documents as fulltext information is generated.
The most useful feature of Compass for Nuxeo users is the ability to add indexes. The Nuxeo Platform automatically creates indexes on common fields like
ecm:parentId at the time a repository is initialized, which is invaluable, but no indexes are created for fields coming from custom schemas. Currently, there is no Nuxeo-native option for defining indexes in MongoDB, but that is not a problem because these are easily created in Compass. For example, a customer can identify and inspect long-running queries in the Performance tab, use the Explain Plan feature to identify which fields are being used in the query, and use the Create Index wizard to add indexes for those fields.
Check out the full presentation at MongoDB World 2017 here.
Many thanks to the presenter of the talk, Brian Blevins, and MongoDB for having us at the conference.