I have an app in Azure AppService and a mongo database in CosmosDB. They are in a same region, but the speed of the queries are much slower compared to a cheap VPS with an installed webserver and MongoDB (and much more expensive).
The app backend is a NestJS/node application, and it uses the connection string like this:
DATABASE_CONN_STRING=”mongodb://user:[email protected]:10255/?ssl=true&retrywrites=false&maxIdleTimeMS=120000&appName=@appName@”
Now I think the problem is they are in different networks, so the requests between the backend and cosmosdb are actually travel over the internet which could be a huge bottleneck. This is obviously slower than if they can be in the same “local” subnet (much less network speed overhead).
Am I miss some important configuration here to make it faster?
3