Performance issue on CosmosDB for MongoDB

Sanjay Mange 5 Reputation points
2024-07-04T07:54:19.1266667+00:00

I am experiencing performance issue with CosmosDB for MongoDB (RU), when executing a query on a collection containing 300,000 documents. The query takes 43 seconds to execute on CosmosDB, whereas on my local MongoDB setup, it only takes 411 ms. Both env having the same data and same indexes + i have executed other queries also to evaluate and compare the performance and i am seeing significant performance difference. Additionally CosmosDB is on DEV environment so there is no traffic on the server.

What could be causing this significant performance difference ?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,638 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ShaktiSingh-MSFT 15,301 Reputation points
    2024-07-04T09:22:10.0566667+00:00

    Hi Sanjay Mange •,

    Welcome to Microsoft Q&A forum.

    As I understand, you want to know performance difference between MongoDB and Azure Cosmos Mongo DB(RU).

    Performance depends on multiple factors:

    1). Whether DB is Provisioned or Serverless.

    2). Check RUs allocated.

    Choose RU-based if

    • You're building new cloud-native MongoDB apps or refactoring existing apps for cloud-native benefits.
    • Your workload has more point reads (fetching a single item by its _id and shard key value) and few long-running queries and complex aggregation pipeline operations.
    • You want limitless horizontal scalability, instantaneous scale up, and granular throughput control.
    • You're running mission-critical applications requiring industry-leading 99.999% availability.

    You'd like a multitenant service that instantly allocates resources to your workload, aligning with storage and throughput requirements.

    Throughput is based on Request Units (RUs).

    RU charges depend on the selected model: provisioned throughput (standard or autoscale) or serverless.

    Refer: https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/cosmos-db-vs-mongodb-atlas?source=recommendations#azure-cosmos-db-for-mongodb-vs-mongodb-atlas

    Could you please check configuration of your DB and share details.

    Thanks.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.