Data API is slow

I am trying to call data-api from postman, it’s taking nearly 3 seconds to give response. Is it the normal case? Because querying through connection URL is a lot more faster than this. Will data Api give the same performance as we get from connection URL or it’s slower than the other method.

Following are the details of my cluster :

1 Like

There is a lot more going on with Data API compared to a driver connection.

  1. The folllowing only occurs with the DataAPI - You start with a connection that is not established between postman and the web server that
    handle your request.
  2. This web server, as far as I know, is shared and might not have a connection established between itself and your atlas cluster.
  3. This web server has to interpret your request and create one for the cluster using the driver connection. From here the performance should match what you see from your driver as it is the same.
  4. The database server handle the request and send the response to the driver.
  5. Once the web server receive the answer it has to repackage it into an http response. The rest only occurs with Data API.
  6. You finally can read and process the response.

So a lot more is going on.

Data API is very convenient because it is a layer of abstraction where you do not have to manage an application server. But it comes at a performance cost. You have to be aware of that.


Hi @VIKASH_KUMAR_SHUKLA welcome to the community!

I would also like to point out that the Data API is still very much in Preview/Beta at this moment, so things might change for the better in the future.

Best regards


Hi Vikash - I’ll also jump in and add that we have some improvements planned that will make this much faster, including some optimizations internally and the ability to externally choose a better deployment model fit for your region and cloud provider.
Currently I can see you’ve deployed your cluster on GCP which may cause some latency since the API is default hosted on AWS which may lead to some cross-cloud latency.


Thank you Sumedha, I got your point. Now the problem is that we have deployed our Node Js (Back End) + React Js (Front End) on Google Cloud Platform. Also, our mongoDB cluster is deployed on GCP to reduce any latency. My questions are :

  1. Will the latency increase if we migrate our mongoDB cluster to AWS.
  2. Is it better to deploy mongodb as a service on Google Cloud Platform (from google cloud marketplace) rather than using a separate instance on Will it improve our api performance if we deploy it there itself as service?