0

我不明白为什么辅助服务器上的存储大小比主服务器上的大得多(450 GB 对 375 GB)。

  • 硬件、操作系统、文件系统和 mongodb 配置在主要和次要上是相同的
  • 存储引擎是有线老虎
  • 每天都会创建一个新数据库,其中存储当天的历史数据
  • 保留最后 14 天(数据库)
  • 最旧的数据库在一天之后被删除
  • 文档永远不会更新或删除,它们只会被插入和读取
  • 过去没有初级/次级开关

正如您在集合统计中看到的那样,主要countavgObjectSize次要之间是相同的,但storageSize有所不同。为什么会这样?可以修复(如何)?

offerHistory02:SECONDARY> db.offerHistory.stats()
{
    "ns" : "log-2021-03-27.offerHistory",
    "size" : NumberLong("1147404775489"),
    "count" : 1293199443,
    "avgObjSize" : 887,
    "storageSize" : 483053527040,
    "capped" : false,
    "wiredTiger" : {
        "metadata" : {
            "formatVersion" : 1
        },
        "creationString" : "access_pattern_hint=none,allocation_size=4KB,app_metadata=(formatVersion=1),assert=(commit_timestamp=none,read_timestamp=none),block_allocation=best,block_compressor=snappy,cache_resident=false,checksum=on,colgroups=,collator=,columns=,dictionary=0,encryption=(keyid=,name=),exclusive=false,extractor=,format=btree,huffman_key=,huffman_value=,ignore_in_memory_cache_size=false,immutable=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=q,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=64MB,log=(enabled=true),lsm=(auto_throttle=true,bloom=true,bloom_bit_count=16,bloom_config=,bloom_hash_count=8,bloom_oldest=false,chunk_count_limit=0,chunk_max=5GB,chunk_size=10MB,merge_custom=(prefix=,start_generation=0,suffix=),merge_max=15,merge_min=0),memory_page_image_max=0,memory_page_max=10m,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,source=,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,type=file,value_format=u",
        "type" : "file",
        "uri" : "statistics:table:collection-2583--5720839012155665746",
        "LSM" : {
            "bloom filter false positives" : 0,
            "bloom filter hits" : 0,
            "bloom filter misses" : 0,
            "bloom filter pages evicted from cache" : 0,
            "bloom filter pages read into cache" : 0,
            "bloom filters in the LSM tree" : 0,
            "chunks in the LSM tree" : 0,
            "highest merge generation in the LSM tree" : 0,
            "queries that could have benefited from a Bloom filter that did not exist" : 0,
            "sleep for LSM checkpoint throttle" : 0,
            "sleep for LSM merge throttle" : 0,
            "total size of bloom filters" : 0
        },
        "block-manager" : {
            "allocations requiring file extension" : 72040317,
            "blocks allocated" : 72069969,
            "blocks freed" : 32831,
            "checkpoint size" : 483052630016,
            "file allocation unit size" : 4096,
            "file bytes available for reuse" : 880640,
            "file magic number" : 120897,
            "file major version number" : 1,
            "file size in bytes" : 483053527040,
            "minor version number" : 0
        },
        "btree" : {
            "btree checkpoint generation" : 322002,
            "column-store fixed-size leaf pages" : 0,
            "column-store internal pages" : 0,
            "column-store variable-size RLE encoded values" : 0,
            "column-store variable-size deleted values" : 0,
            "column-store variable-size leaf pages" : 0,
            "fixed-record size" : 0,
            "maximum internal page key size" : 368,
            "maximum internal page size" : 4096,
            "maximum leaf page key size" : 2867,
            "maximum leaf page size" : 32768,
            "maximum leaf page value size" : 67108864,
            "maximum tree depth" : 5,
            "number of key/value pairs" : 0,
            "overflow pages" : 0,
            "pages rewritten by compaction" : 0,
            "row-store internal pages" : 0,
            "row-store leaf pages" : 0
        },
        "cache" : {
            "bytes currently in the cache" : 427430184,
            "bytes read into cache" : 1750413,
            "bytes written from cache" : NumberLong("1163389289271"),
            "checkpoint blocked page eviction" : 11018,
            "data source pages selected for eviction unable to be evicted" : 924534,
            "eviction walk passes of a file" : 10012883,
            "eviction walk target pages histogram - 0-9" : 2069657,
            "eviction walk target pages histogram - 10-31" : 886769,
            "eviction walk target pages histogram - 128 and higher" : 0,
            "eviction walk target pages histogram - 32-63" : 433587,
            "eviction walk target pages histogram - 64-128" : 6622870,
            "eviction walks abandoned" : 44203,
            "eviction walks gave up because they restarted their walk twice" : 1968,
            "eviction walks gave up because they saw too many pages and found no candidates" : 1804734,
            "eviction walks gave up because they saw too many pages and found too few candidates" : 14522,
            "eviction walks reached end of tree" : 1818021,
            "eviction walks started from root of tree" : 1866522,
            "eviction walks started from saved location in tree" : 8146361,
            "hazard pointer blocked page eviction" : 73210,
            "in-memory page passed criteria to be split" : 923037,
            "in-memory page splits" : 147932,
            "internal pages evicted" : 531175,
            "internal pages split during eviction" : 5277,
            "leaf pages split during eviction" : 170222,
            "modified pages evicted" : 184054588,
            "overflow pages read into cache" : 0,
            "page split during eviction deepened the tree" : 2,
            "page written requiring cache overflow records" : 0,
            "pages read into cache" : 137,
            "pages read into cache after truncate" : 1,
            "pages read into cache after truncate in prepare state" : 0,
            "pages read into cache requiring cache overflow entries" : 0,
            "pages requested from the cache" : 3732724262,
            "pages seen by eviction walk" : 992177213,
            "pages written from cache" : 72067093,
            "pages written requiring in-memory restoration" : 142958112,
            "tracked dirty bytes in the cache" : 0,
            "unmodified pages evicted" : 60247131
        },
        "cache_walk" : {
            "Average difference between current eviction generation when the page was last considered" : 0,
            "Average on-disk page image size seen" : 0,
            "Average time in cache for pages that have been visited by the eviction server" : 0,
            "Average time in cache for pages that have not been visited by the eviction server" : 0,
            "Clean pages currently in cache" : 0,
            "Current eviction generation" : 0,
            "Dirty pages currently in cache" : 0,
            "Entries in the root page" : 0,
            "Internal pages currently in cache" : 0,
            "Leaf pages currently in cache" : 0,
            "Maximum difference between current eviction generation when the page was last considered" : 0,
            "Maximum page size seen" : 0,
            "Minimum on-disk page image size seen" : 0,
            "Number of pages never visited by eviction server" : 0,
            "On-disk page image sizes smaller than a single allocation unit" : 0,
            "Pages created in memory and never written" : 0,
            "Pages currently queued for eviction" : 0,
            "Pages that could not be queued for eviction" : 0,
            "Refs skipped during cache traversal" : 0,
            "Size of the root page" : 0,
            "Total number of pages currently in cache" : 0
        },
        "compression" : {
            "compressed pages read" : 63,
            "compressed pages written" : 61677121,
            "page written failed to compress" : 32009,
            "page written was too small to compress" : 10311695,
            "raw compression call failed, additional data available" : 0,
            "raw compression call failed, no additional data available" : 0,
            "raw compression call succeeded" : 0
        },
        "cursor" : {
            "bulk-loaded cursor-insert calls" : 0,
            "close calls that result in cache" : 0,
            "create calls" : 61,
            "cursor operation restarted" : 176248823,
            "cursor-insert key and value bytes inserted" : 1087461754174,
            "cursor-remove key bytes removed" : 0,
            "cursor-update value bytes updated" : 0,
            "cursors reused from cache" : 211664692,
            "insert calls" : 1220619643,
            "modify calls" : 0,
            "next calls" : 397,
            "open cursor count" : 0,
            "prev calls" : 1,
            "remove calls" : 0,
            "reserve calls" : 0,
            "reset calls" : 539520296,
            "search calls" : 76,
            "search near calls" : 0,
            "truncate calls" : 0,
            "update calls" : 0
        },
        "reconciliation" : {
            "dictionary matches" : 0,
            "fast-path pages deleted" : 0,
            "internal page key bytes discarded using suffix compression" : 60661951,
            "internal page multi-block writes" : 28312,
            "internal-page overflow keys" : 0,
            "leaf page key bytes discarded using prefix compression" : 0,
            "leaf page multi-block writes" : 150396,
            "leaf-page overflow keys" : 0,
            "maximum blocks required for a page" : 1,
            "overflow values written" : 0,
            "page checksum matches" : 90452,
            "page reconciliation calls" : 226401610,
            "page reconciliation calls for eviction" : 176333404,
            "pages deleted" : 41475470
        },
        "session" : {
            "object compaction" : 0
        },
        "transaction" : {
            "update conflicts" : 0
        }
    },
    "nindexes" : 2,
    "totalIndexSize" : 59087273984,
    "indexSizes" : {
        "_id_" : 34540539904,
        "offerId_1" : 24546734080
    },
    "ok" : 1,
    "operationTime" : Timestamp(1617146426, 6416),
    "$gleStats" : {
        "lastOpTime" : Timestamp(0, 0),
        "electionId" : ObjectId("7fffffff000000000000000b")
    },
    "$configServerState" : {
        "opTime" : {
            "ts" : Timestamp(1617146426, 4484),
            "t" : NumberLong(23)
        }
    },
    "$clusterTime" : {
        "clusterTime" : Timestamp(1617146426, 6443),
        "signature" : {
            "hash" : BinData(0,"o3Sx+m0MnfXkEQkfdUHHJWnlRl8="),
            "keyId" : NumberLong("6899518352868248974")
        }
    }
}

相对:

offerHistory02:PRIMARY> db.offerHistory.stats()
{
    "ns" : "log-2021-03-27.offerHistory",
    "size" : NumberLong("1147404775489"),
    "count" : 1293199443,
    "avgObjSize" : 887,
    "storageSize" : 403410546688,
    "capped" : false,
    "wiredTiger" : {
        "metadata" : {
            "formatVersion" : 1
        },
        "creationString" : "access_pattern_hint=none,allocation_size=4KB,app_metadata=(formatVersion=1),assert=(commit_timestamp=none,read_timestamp=none),block_allocation=best,block_compressor=snappy,cache_resident=false,checksum=on,colgroups=,collator=,columns=,dictionary=0,encryption=(keyid=,name=),exclusive=false,extractor=,format=btree,huffman_key=,huffman_value=,ignore_in_memory_cache_size=false,immutable=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=q,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=64MB,log=(enabled=true),lsm=(auto_throttle=true,bloom=true,bloom_bit_count=16,bloom_config=,bloom_hash_count=8,bloom_oldest=false,chunk_count_limit=0,chunk_max=5GB,chunk_size=10MB,merge_custom=(prefix=,start_generation=0,suffix=),merge_max=15,merge_min=0),memory_page_image_max=0,memory_page_max=10m,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,source=,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,type=file,value_format=u",
        "type" : "file",
        "uri" : "statistics:table:collection-2583--1868846566931849507",
        "LSM" : {
            "bloom filter false positives" : 0,
            "bloom filter hits" : 0,
            "bloom filter misses" : 0,
            "bloom filter pages evicted from cache" : 0,
            "bloom filter pages read into cache" : 0,
            "bloom filters in the LSM tree" : 0,
            "chunks in the LSM tree" : 0,
            "highest merge generation in the LSM tree" : 0,
            "queries that could have benefited from a Bloom filter that did not exist" : 0,
            "sleep for LSM checkpoint throttle" : 0,
            "sleep for LSM merge throttle" : 0,
            "total size of bloom filters" : 0
        },
        "block-manager" : {
            "allocations requiring file extension" : 47004346,
            "blocks allocated" : 47029067,
            "blocks freed" : 32112,
            "checkpoint size" : 403410251776,
            "file allocation unit size" : 4096,
            "file bytes available for reuse" : 278528,
            "file magic number" : 120897,
            "file major version number" : 1,
            "file size in bytes" : 403410546688,
            "minor version number" : 0
        },
        "btree" : {
            "btree checkpoint generation" : 329809,
            "column-store fixed-size leaf pages" : 0,
            "column-store internal pages" : 0,
            "column-store variable-size RLE encoded values" : 0,
            "column-store variable-size deleted values" : 0,
            "column-store variable-size leaf pages" : 0,
            "fixed-record size" : 0,
            "maximum internal page key size" : 368,
            "maximum internal page size" : 4096,
            "maximum leaf page key size" : 2867,
            "maximum leaf page size" : 32768,
            "maximum leaf page value size" : 67108864,
            "maximum tree depth" : 5,
            "number of key/value pairs" : 0,
            "overflow pages" : 0,
            "pages rewritten by compaction" : 0,
            "row-store internal pages" : 0,
            "row-store leaf pages" : 0
        },
        "cache" : {
            "bytes currently in the cache" : 519160231,
            "bytes read into cache" : 108549491,
            "bytes written from cache" : NumberLong("1161908962381"),
            "checkpoint blocked page eviction" : 4910,
            "data source pages selected for eviction unable to be evicted" : 241550,
            "eviction walk passes of a file" : 5058704,
            "eviction walk target pages histogram - 0-9" : 1441924,
            "eviction walk target pages histogram - 10-31" : 706198,
            "eviction walk target pages histogram - 128 and higher" : 0,
            "eviction walk target pages histogram - 32-63" : 324631,
            "eviction walk target pages histogram - 64-128" : 2585951,
            "eviction walks abandoned" : 62344,
            "eviction walks gave up because they restarted their walk twice" : 0,
            "eviction walks gave up because they saw too many pages and found no candidates" : 1249672,
            "eviction walks gave up because they saw too many pages and found too few candidates" : 23472,
            "eviction walks reached end of tree" : 1139902,
            "eviction walks started from root of tree" : 1335874,
            "eviction walks started from saved location in tree" : 3722830,
            "hazard pointer blocked page eviction" : 9346,
            "in-memory page passed criteria to be split" : 551341,
            "in-memory page splits" : 148613,
            "internal pages evicted" : 247462,
            "internal pages split during eviction" : 2425,
            "leaf pages split during eviction" : 167334,
            "modified pages evicted" : 57437477,
            "overflow pages read into cache" : 0,
            "page split during eviction deepened the tree" : 2,
            "page written requiring cache overflow records" : 0,
            "pages read into cache" : 8699,
            "pages read into cache after truncate" : 1,
            "pages read into cache after truncate in prepare state" : 0,
            "pages read into cache requiring cache overflow entries" : 0,
            "pages requested from the cache" : 3808973750,
            "pages seen by eviction walk" : 569860253,
            "pages written from cache" : 47026827,
            "pages written requiring in-memory restoration" : 50006230,
            "tracked dirty bytes in the cache" : 0,
            "unmodified pages evicted" : 39345995
        },
        "cache_walk" : {
            "Average difference between current eviction generation when the page was last considered" : 0,
            "Average on-disk page image size seen" : 0,
            "Average time in cache for pages that have been visited by the eviction server" : 0,
            "Average time in cache for pages that have not been visited by the eviction server" : 0,
            "Clean pages currently in cache" : 0,
            "Current eviction generation" : 0,
            "Dirty pages currently in cache" : 0,
            "Entries in the root page" : 0,
            "Internal pages currently in cache" : 0,
            "Leaf pages currently in cache" : 0,
            "Maximum difference between current eviction generation when the page was last considered" : 0,
            "Maximum page size seen" : 0,
            "Minimum on-disk page image size seen" : 0,
            "Number of pages never visited by eviction server" : 0,
            "On-disk page image sizes smaller than a single allocation unit" : 0,
            "Pages created in memory and never written" : 0,
            "Pages currently queued for eviction" : 0,
            "Pages that could not be queued for eviction" : 0,
            "Refs skipped during cache traversal" : 0,
            "Size of the root page" : 0,
            "Total number of pages currently in cache" : 0
        },
        "compression" : {
            "compressed pages read" : 3402,
            "compressed pages written" : 44862562,
            "page written failed to compress" : 3760,
            "page written was too small to compress" : 2135269,
            "raw compression call failed, additional data available" : 0,
            "raw compression call failed, no additional data available" : 0,
            "raw compression call succeeded" : 0
        },
        "cursor" : {
            "bulk-loaded cursor-insert calls" : 0,
            "close calls that result in cache" : 0,
            "create calls" : 376,
            "cursor operation restarted" : 8863521,
            "cursor-insert key and value bytes inserted" : NumberLong("1151926070153"),
            "cursor-remove key bytes removed" : 0,
            "cursor-update value bytes updated" : 0,
            "cursors reused from cache" : 133353675,
            "insert calls" : 1291054491,
            "modify calls" : 0,
            "next calls" : 1,
            "open cursor count" : 17699,
            "prev calls" : 1,
            "remove calls" : 0,
            "reserve calls" : 0,
            "reset calls" : 266569743,
            "search calls" : 4385,
            "search near calls" : 0,
            "truncate calls" : 0,
            "update calls" : 0
        },
        "reconciliation" : {
            "dictionary matches" : 0,
            "fast-path pages deleted" : 0,
            "internal page key bytes discarded using suffix compression" : 79075940,
            "internal page multi-block writes" : 25191,
            "internal-page overflow keys" : 0,
            "leaf page key bytes discarded using prefix compression" : 0,
            "leaf page multi-block writes" : 151115,
            "leaf-page overflow keys" : 0,
            "maximum blocks required for a page" : 1,
            "overflow values written" : 0,
            "page checksum matches" : 182737,
            "page reconciliation calls" : 64953107,
            "page reconciliation calls for eviction" : 56370626,
            "pages deleted" : 7290000
        },
        "session" : {
            "object compaction" : 0
        },
        "transaction" : {
            "update conflicts" : 0
        }
    },
    "nindexes" : 2,
    "totalIndexSize" : 57366028288,
    "indexSizes" : {
        "_id_" : 33265238016,
        "offerId_1" : 24100790272
    },
    "ok" : 1,
    "operationTime" : Timestamp(1617146426, 6443),
    "$gleStats" : {
        "lastOpTime" : Timestamp(0, 0),
        "electionId" : ObjectId("7fffffff000000000000000c")
    },
    "$configServerState" : {
        "opTime" : {
            "ts" : Timestamp(1617146426, 4501),
            "t" : NumberLong(23)
        }
    },
    "$clusterTime" : {
        "clusterTime" : Timestamp(1617146426, 6443),
        "signature" : {
            "hash" : BinData(0,"o3Sx+m0MnfXkEQkfdUHHJWnlRl8="),
            "keyId" : NumberLong("6899518352868248974")
        }
    }
}
4

0 回答 0