How are the server less function request flows from the source requester to the cluster given GLOBAL Deployment?

I have a client project, which is deployed with “GLOBAL” deployment model. Preferred location is “us-east-1” by default. Customer has initiated a replica readonly node in “Mumbai” region to help us to validate the actual response time of realm-sdk function calls. (MongoDB instances are upgraded to M20 - 6.0 latest stable version).
Without changing any config, request are still going to US only which still have same response time as earlier with huge latency. I have tried to point “preferred_region” in real_config.json file as Mumbai then i see the request are flowing to Mumbai node.

I was going through the following link from MongoDB:

How is the set up of load balancer in AWS for MongoDB atlas which support multi-region request?
Can you help me understand, how the request if flowing from different regions to target region?
How can i make the “preferred_region” config value be dynamically pointing to required region?
With a give config stated above context, how can i point realm-sdk functions to call specified region (Mumbai)?

Thank you in advance.

Hi @RamaKishore_K ,

As far as I know with global deployment your application components (values, functions, config , rules etc) are duplicated across our global infrastructure and based on the client call will be served from the nearest region.

Now you have to remember that any write operation will be performed from the preferred region which for optimization reasons should be as close to your primary as possible , best in the same reason.

When you alter the preferred region to mumbai any function or operation with writes will start to run from there but it will slow your writes.

You should do another configuration to help only reads get to mumbai without harming the writes.

Its done in the linked data sources when editing your cluster settings and pointing read preference to nearest

If you have different components with different preference and region deployment requirments consider splitting them :
1- Two different data links with different configuration (its possible to have more than one link to the same cluster and dynamically pick one for the specific use case).
2 - Two different applications which split the responsibilities of your logic based on topology best fit for each.


Hi @Pavel_Duchovny,

Thank you for the response, after changing the read_preferences to nearest i am able to see the hits to the node. Comparing the response Time and revert back if any questions.

Thank you.