A Performance Comparison of Drivers for Azure Cosmos DB



In this article, we compare the performance of the CData Drivers for MongoDB to the equivalent drivers offered by other companies. We compared read performance, measuring the amount of time that it takes to query an Azure Cosmos DB instance (configured for the MongoDB API) for data and process the result set in some way.

The test machine specifications are as follows:
Operating System: Windows 10
Processor: Intel® CoreTM 2 Quad CPU Q8400 @ 2.66GHz
Installed Memory (RAM): 6.00 GB
System type: 64-bit Operating System

Since the drivers are being compared side-by-side, the performance of the machine itself is relatively unimportant; what matters is how the drivers compare relative to one another.

The Data



In order to provide a reproducible comparison, we copied the sample restaurants dataset made publicly available by MongoDB, Inc. The relevant details for the table queried are below:

Table Number of Rows
restaurants 25,359
restaurants_large 1,193,949

Query



The main goal of this investigation was to compare the related performance of the drivers. We did this by running the same query with each driver. To simulate actual processing of the data beyond simply reading from Cosmos DB, we stored the values of each row in an array (that was replaced for each row). The queries are listed below:

  1. SELECT borough, cuisine, name, restaurant_id FROM restaurants
  2. SELECT borough, cuisine, name, restaurant_id FROM restaurants_large

Results



Below, you can see the performance of the various queries, based on the driver/platform.

ADO.NET Provider / C# Drivers

CData Software and MongoDB, Inc are the two companies that provide native support for connecting to Cosmos DB data (behind the MongoDB API) in .NET applications. CData Software has an ADO.NET Provider for MongoDB. MongoDB, Inc has their own C# and .NET MongoDB Driver, which allows you to connect to Cosmos DB instances using the MongoDB API. The times required for each product to process the results are in the table below.

ADO.NET/C# Query Times by Company (in milliseconds)
Query CData Software MongoDB, Inc
~25,000 rows 6,911.4 (+160%) 18,001.4
~1.2 million rows 267,950 (+209%) 828,049

As can be seen in the results, the CData ADO.NET Provider was able to work with large result sets faster than the MongoDB, Inc. C# Drivers, processing the largest dataset over three times faster than the MongoDB, Inc. driver.

The average runtime for each query is compared in the charts below:

Results for ~25,000 Rows

Results for ~1,200,000 Rows

ODBC Drivers

While CData Software offers an ODBC Driver for the MongoDB API in Azure Cosmos DB, there is also a native ODBC Driver. The times required for each product to process the results are in the table below.

ODBC Query Times by Company (in milliseconds)
Query CData Software Native
~25,000 rows 4,123.6 (-18%) 3,377.6
~1.2 million rows 151,849.8 (+200%) 455,843.6

As can be seen in the results, the CData ODBC Driver was able to work with large result sets significantly faster than the native driver, processing the largest dataset three times faster.

The average runtime for each query is compared in the charts below:

Results for ~25,000 Rows

Results for ~1,200,000 Rows

Conclusion



The CData Software drivers regularly prove to be faster than the competitors' equivalent products, particularly when dealing with large data sets. Our developers have spent countless hours optimizing the performance in processing the results returned by the Cosmos DB database to the point that the drivers seem to only be hindered by web traffic and server processing times. Download a free, 30-day trial of any of our MongoDB drivers and experience the CData difference for yourself.

Related Articles