Open qkrorlqr opened 4 months ago
----------- TCompactionMap_Load ---------------
samples: 20
iterations: 276
iterations hr: 276
run time: 5.382796512
per iteration: 40401205.65 (40.4M) cycles
With optimization:
----------- TCompactionMap_Load ---------------
samples: 93
iterations: 5460
iterations hr: 5.46K
run time: 5.020265303
per iteration: 1911153.698 (1.91M) cycles
1) Old filesystems have ranges in CompactionMap with 0 BlobCount and DeletionCount. We need to create background process to delete this ranges in CompactionMap table.
2) Now loading of CompactionMap chunk restarts several times before finish. Need to add precharge for reading CompactionMap chunks from local db. Like in blockstore https://github.com/ydb-platform/nbs/blob/4d4630beb459b439b774f3c48a8057a21ceb14a0/cloud/blockstore/libs/storage/partition/part_database.cpp#L608
Right now a 16TiB FS may have a CompactionMap with 150'000'000 ranges which takes more than a minute to load (sometimes several minutes) - during this time the FS rejects most of the write operations. The majority of the time is spent here https://github.com/ydb-platform/nbs/blob/21fecf561656ed70f05892e59a1f4e15f21d88a0/cloud/filestore/libs/storage/tablet/tablet_state_data.cpp#L1117. We need a Y_BENCHMARK for this function and we need to optimize this function. The benchmark can generate random data, compaction map groups should be approximately 50% filled (each group should have around 32 ranges out of the maximum 64 ranges per group). One simple way to optimize this function is to batch range loading - to load each group at once, not via up-to-64 separate calls.