複製集同步時發生Mongod慢查詢 (Mongod slow query be happend when replicate set sync)


問題描述

複製集同步時發生Mongod慢查詢 (Mongod slow query be happend when replicate set sync)

最近,我發現一個插入操作會使 mongod 慢查詢發生。並且總是在輔助 mongod 實例從另一個節點同步數據時發生。

複製集有三個成員,我將客戶端驅動程序寫入關注點設置為“w:2”。

oplog同步會阻止插入操作?將文檔插入同步節點會發生什麼?


參考解法

方法 1:

The writeConcern setting w:2 means that the write will be acknowledged when exactly two members of the replica set has acknowledged that the write happened (see https://docs.mongodb.com/v3.2/reference/write‑concern/#w‑option). In other words, it will wait until the write has replicated (via the oplog) to one other node, since the Primary is counted as one node.

This means that the "speed" of the insert/update query will be subject to your network speed. If the network is slow or congested, then the insert will appear to be "slow". This is not due to replication blocking anything, it is simply the effect of specifying w:2 in a congested network.

There may be a network congestion that triggers both the sync source change and the slow insert, but the replication process by itself does not block any insert operation.

(by yangbinnnnkevinadi)

參考文件

  1. Mongod slow query be happend when replicate set sync (CC BY‑SA 2.5/3.0/4.0)

#database-replication #mongoDB #performance






相關問題

C# 移動設備應用程序中的 SQL 複製 (SQL Replication in C# mobile device application)

在主文件日誌中獲得最後位置(MySQL 複製)? (Getting last position in master-file-log (MySQL replication)?)

複製集同步時發生Mongod慢查詢 (Mongod slow query be happend when replicate set sync)

sql server 2005 複製文章衝突 (sql server 2005 replication article conflict)

SQL 合併複製中“邏輯記錄”的未來 (Future of "Logical Records" in SQL Merge Replication)

GAE:關於高複制數據的使用 (GAE: About the Usage of High Replication Data)

在兩個不同的 PostgreSQL 數據庫服務器中更新數據 (Update data in two differents PostgreSQL database servers)

刪除 Datastax Advanced Replication 生成的重新日誌 (Deleting replogs generated by Datastax Advanced Replication)

我們可以在不同版本的 marklogic 之間進行森林或數據複製嗎? (Can we have forests or data replication between different versions of marklogic?)

MongoDB Atlas 輔助分片保持空閒 (MongoDB Atlas secondary shards remain idle)

升級過程中從 5.6 到 5.7 的 AWS RDS MySQL 複製 (AWS RDS MySQL replication from 5.6 to 5.7 during the upgrade process)

我可以編寫一個 activerecord 範圍,在查詢時將結果包裝在一個塊中嗎? (Can I write an activerecord scope which wraps the result in a block at query time?)







留言討論