重现步骤
严重级别:严重
所属项目:OZON
问题原因:mongodb集合t_ozon_listing_rating是由于sourceId分片键,而执行操作却全部在分片1上并发增删改查操作,把分片1节点CPU打满,执行SQL之一为("op" : "update",
"ns" : "zhcxkj_comprehensive_pilot.t_ozon_listing_rating",
"command" : {
"$truncated" : "{ q: { $and: [ { sourceId: 25848 }, { uniqueId: "25848_2236276743_100.0" } ] }, u: { $setOnInsert: { uniqueId: "25848_2236276743_100.0", _id: 32703989, createTime: new Date(1750816317730) }, $set: { rating: 100.0, pfSku: 2236276743, syncTime: "2025-06-25 09:51:57", status: 1, listingCreateTime: new Date(1749085809000), listingStatus: 3, updateTime: new Date(1750816317730), isDeleted: 0, sourceId: 25848, pfListingId: 1901054047, groups: [ { key: "important_attributes", name: "Важные атрибуты", rating: 100, weight: 30, conditions: [ { key: "important_2", description: "Заполнено 2 атрибута и более", fulfilled: true, cost: 50 }, { key: "important_50_percent", description: "Заполнено более 50% атрибутов", fulfilled: true, cost: 25 }, { key: "important_70_percent", description: "Заполнено более 70% атрибутов", fulfilled: true, cost: 25 } ], improveAttributes: [], improveAtLeast: 0, _class: "com.zhcxkj.commo..."
})
解决方案:请评估当前分片键是否适合?如果不适合,则调整分片键,如果适合请根据业务场景调整解决方式
代码已调整分片创建完成