Performance advice for App Services deployment model, GLOBAL vs LOCAL

Hello I have an entire backend running on MongoDB App Service Functions and my deployment model is GLOBAL.

Basically all my functions connects to my Atlas Cluster to read or write something.

Would it be better if I change the deployment model to LOCAL??

My non-informed guess is yes, because:
— As all functions are r/w to the cluster anyway, so there is little improvement for the functions to be GLOBAL, as they will have to reach the Atlas cluster anyway;
— I will gain on serverless warm up. Being LOCAL all calls will go to the same region, and I have increased chance the Lambda function is already warmed up;

So I would love confirmation from an expert before doing the change.

— Yes, I would choose the same LOCAL region as my Atlas cluster.
— MongoDB now have the ability to change deployment model/region


My general take is that GLOBAL apps are best when you are trying to minimize the amount of distance between your end-users and App Services. Having your app be GLOBAL is preferred if your functions are just hitting an http endpoint, doing some logic and sending back a response, or doing a DB read on a secondary if you are using a multi-region cluster.

However, if most of your app relies on making calls to your database which is in a single region (which is how most customers are set up), then it is likely that the LOCAL configuration is the better option for you since the latency between App Services and your Atlas Cluster will likely be more important than the latency between App Services and your end user.

Another added benefit is that it will result in your connection count on your database being lower as all of your requests will be routed through a subset of the servers (which share connections).

The one correction I would make to your response is that there will not be any gain in “warm up” because there is already a very low warm-up time due to the way our functions are architected. We do not have the same cold start problem that Lambda functions can run into.

To confirm your notes:

  1. Yes, you should make it local in the same region and cloud provider as your atlas cluster
  2. Yes, we now offer a seamless way to migrate deployment models


1 Like

Hello @Tyler_Kaye

Thank you very much for the clear explanation. Extra nice to understand there is no warmup issues on MongoDB App Functions.

I successfully migrated my app to LOCAL and did a test:
— Indeed improved performance, the function call I was watching took ~1000ms on GLOBAL and ~600 on LOCAL deployment;
— It was being called from Sao Paulo, Brazil and my App is on US-EAST-1. The function executes 3 DB calls (2 reads and 1 write).

So I am thankful for the knowledge and the speedup!

Please add that to your Documentation!
Would be nice to know that beforehand.
I have been on GLOBAL for 2 years now. Wish I’ve chosen LOCAL from the start.

All my best!

Felt the need to drop an extra comment, the speed improvement has improved amazingly throughout the entire app. Even GitHub auto-deployment.

Happy for the service. Thanks.

(please add to documentation and Atlas UI, the GLOBAL may be only for a few use cases, maybe the most is better with LOCAL)