Detailed behaviour of mongos in context of sharded Mongo cluster I have a mongo cluster as follows:


3 shards, located in the 3 main global regions (APAC/EMEA/AMER)
The shardKey is "Region".
Each region has a mongos running locally, "close" to its users, "close" to its mongods.


Question: when the mongos receives an insert request for a document who's region is not the mongos "close" region, does the mongos:

a) route the insert into its "close" regional shard then let the balancer sort out moving the document to its correct shard.
OR
b) route the insert to the correct regional shard directly.

It seems to me that a) would give faster inserts than b) but takes longer for the database to settle down to its eventual state.

Which one is what mongos actually does?

Thanks!
It does the second option 'route the insert to the correct regional shard directly`.

See this answer for details.

Where to insert data after sharding?

More resource:

https://docs.mongodb.com/manual/core/sharded-cluster-query-router/