How to use to readonly cluster in Atlas multi cloud deployment

I have a cluster in AWS Singapore region (SG), but I have Apps (Lambdas) running in SG as well as in the Hongkong (HK) region. In order to lower the read latency for HK, I’m planning to utilise Atlas multi cloud deployment to deploy a read-only cluster in HK.

after the changes, I noticed that the latency for HK App remain the same. I expect it to drop as I expect HK App would connect to the HK readonly cluster automatically because it’s the nearest, but apparently not.

I’m using the same connection uri before and after the deployment, i.e.,

mongodb+srv://XXXX:YYYY@ZZZZ.zjls6.mongodb.net/db?retryWrites=true&w=majority

where did it go wrong?

one way to try is to add some replica set tags, like so:

mongodb+srv://XXXX:YYYY@ZZZZ.zjls6.mongodb.net/db?retryWrites=true&w=majority&readPreference=secondary&readPreferenceTags=nodeType:READ_ONLY&readConcernLevel=local

but I’m not sure if I’m doing it correctly. Would like to get some expert opinions before my attempt. Thanks.

Hi PK,

I think what you want is the read preference “nearest” (sorry for the delay in seeing this post!):

Cheers
-Andrew

Thanks for replying.

I have already used the options: readPreference=secondary&readPreferenceTags=nodeType:READ_ONLY

and it works. the read latency is lowered in the HK region and comparable to the read latency of the SG region.