Project

General

Profile

Actions

Enhancement #77909

open
DP

mds/journal: deep copy bufferlists to prevent raw ptrs pinning entire raw buffers when replaying the journal

Enhancement #77909: mds/journal: deep copy bufferlists to prevent raw ptrs pinning entire raw buffers when replaying the journal

Added by Dhairya Parmar 5 months ago. Updated 4 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Performance/Resource Usage
Target version:
Due date:
% Done:

0%

Source:
Development
Backport:
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
MDS, tools
Labels (FS):
offline
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

The context of this is https://tracker.ceph.com/issues/76422#note-10. Also attaching the heap call graph that was snapshotted at 100MiB.

The clear sign from tracker 76422's note-10 and also from its description is that bufferlists -- most prominently like dnbl keeps the encoded journal stream referenced even after all the events are decoded. The reason lies in how these bufferlists are decoded (shallow-copy) and especially how dnbl is an encoded blob of dentries that is lazily decoded only when the dentries are to be consumed. This has been discussed in the tracker referenced before and also in upstream ceph-devel channel (https://ceph-storage.slack.com/archives/C1HFZTW81/p1782409277065069). The core idea that is suggested is we deep copy these bufferlists so that it only keeps track of the dentry blob actually needed since referencing is not based on the view of the buffer i.e. even if the raw ptr is pointing to just 1 byte of raw buffer, it keeps a refcount on entire buffer.

From a small experiment I did today -- I found out from my workload:

#!/bin/bash

A200=$(printf 'A%.0s' {1..200})
X400=$(printf 'A%.0s' {1..400})

for w in {0..10}; do
(
    dir="w$w" 
    mkdir -p "$dir/a" "$dir/b" "$dir/c" 

    for ((i = 0 ; i < 1000 ; i++ )); do
        touch "$dir/a/${A200}_f${i}" 
        ln "$dir/a/${A200}_f${i}" "$dir/b/${A200}_l${i}" 
                mv "$dir/b/${A200}_l${i}" "$dir/c/${A200}_r${i}" 
        ln "$dir/a/${A200}_f${i}" "$dir/c/${A200}_h${i}" 
        mv "$dir/a/${A200}_f${i}" "$dir/b/${A200}_m${i}" 
        # setfattr -n user.chaos -v "$X400" "$dir/b/${A200}_m${i}" 
    done
) &
done
wait

is that the dnbl size out of the total events size is *52%* - meaning if we deep copy dnbl it means we should get approx ~50% of lesser encoded raw buffers pinning in memory. From the massif tool output in tracker 76422, given a similar improvement the RSS could've gone down by 25%.

This needs deeper discussion, on surface it looks very convincing but the workload i chose might not mimic real scenarios. We need to check how feasible is deep copying bufferlists. My major concern is if MDS spends too much time copying the encoded dentries then it might add more to the time it takes for MDS to come back up from up:replay to up:active. OR say it takes more time for journal tool to recover dentries.


Files


Related issues 1 (0 open — 1 closed)

Related to CephFS - Enhancement #76422: cephfs-journal-tool: avoid scanning full journal before replying entriesBackportingDhairya Parmar

Actions

DP Updated by Dhairya Parmar 5 months ago Actions #1

  • Subject changed from mds/journal: deep copy shallow lists to prevent raw ptrs pinning entire raw buffers when replaying the journal to mds/journal: deep copy bufferlists to prevent raw ptrs pinning entire raw buffers when replaying the journal

VS Updated by Venky Shankar 4 months ago Actions #2

  • Related to Enhancement #76422: cephfs-journal-tool: avoid scanning full journal before replying entries added

VS Updated by Venky Shankar 4 months ago Actions #4

  • Target version set to v22.0.0
  • Component(FS) tools added

VS Updated by Venky Shankar 4 months ago Actions #5

  • Category changed from Correctness/Safety to Performance/Resource Usage
Actions

Also available in: PDF Atom