Sorting in mongo sharding environment reduces performance

I have a query that does something like this,

last_shipment_id = OrderDelivery.where(platform: 'business').desc(:shipment_id).limit(1).pluck(:shipment_id)[0] 

It works fine from 1 ~ 5 ms when I index correctly using {platform: 1, shipment_id: -1} without a shell in an intermediate computer

However, our production is tuned with 4 shards of mongo db, the result ends in 1000-3000 m.

Does anyone know how this can happen or how to solve it?

I read about this slides https://www.slideshare.net/mongodb/how-queries-work-with-sharding

Well, he said on slide 13, but still not sure if he mentioned how to solve this issue.

+7
ruby-on-rails mongodb mongoid
source share

No one has answered this question yet.

See related questions:

873
Big data workflows using pandas
682
How to list all collections in mongo shell?
one
You should avoid renaming the large Mongoog database of 90 GB. Can I proxy one db name to another on the server?
one
Why is query isolation good?
one
MongoDB Rename Collection to Sharding
one
Shard with Mongodb Hadoop Connector
0
Mongo socketTimeoutMS not working
0
Mongo connection error while trying to create a replicated fragmentation cluster
0
Validating MongoDB on Windows Sharded Cluster
-one
MongoDB scaling scaling - performance of queries striking one piece?

All Articles