Skip to contentSkip to conversation

PROBLEM: CephFS write performance drops by 90%

DISCUSSION Ilya Dryomov 4 participants 10 messages Dec 15, 2022 – Dec 23, 2022 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 3 lines · Marco

Dear Ilya,
I'm using Ubuntu and a CephFS mount. I had a more than 90% write performance decrease after changing the kernels main version ( <10MB/s vs. 100-140 MB/s). The problem seems to exist in Kernel major versions starting at v5.4. Ubuntu mainline version v5.4.25 is fine, v5.4.45 (which is next available) is "bad".

Hi Marco,

What is the workload?

Quoted 2 lines

After a git bisect with the "original" 5.4 kernels I get the following result:

Can you describe how you performed bisection? Can you share the reproducer you used for bisection?

Quoted 20 lines

ed24820d1b0cbe8154c04189a44e363230ed647e is the first bad commit commit ed24820d1b0cbe8154c04189a44e363230ed647e

Author: Ilya Dryomov <[email protected]>
Date:   Mon Mar 9 12:03:14 2020 +0100

ceph: check POOL_FLAG_FULL/NEARFULL in addition to OSDMAP_FULL/NEARFULL

commit 7614209736fbc4927584d4387faade4f31444fce upstream.

CEPH_OSDMAP_FULL/NEARFULL aren't set since mimic, so we need to consult per-pool flags as well. Unfortunately the backwards compatibility here is lacking:

- the change that deprecated OSDMAP_FULL/NEARFULL went into mimic, but was guarded by require_osd_release >= RELEASE_LUMINOUS
- it was subsequently backported to luminous in v12.2.2, but that makes no difference to clients that only check OSDMAP_FULL/NEARFULL because require_osd_release is not client-facing -- it is for OSDs

Quoted 7 lines

Since all kernels are affected, the best we can do here is just start checking both map flags and pool flags and send that to stable.

These checks are best effort, so take osdc->lock and look up pool flags just once. Remove the FIXME, since filesystem quotas are checked above and RADOS quotas are reflected in POOL_FLAG_FULL: when the pool reaches its quota, both POOL_FLAG_FULL and POOL_FLAG_FULL_QUOTA are set.

The only suspicious thing I see in this commit is osdc->lock semaphore which is taken for read for a short period of time in ceph_write_iter(). It's possible that that started interfering with other code paths that take that semaphore for write and read-write lock fairness algorithm is biting...

Can you confirm the result by manually checking out the previous commit and verifying that it's "good"?

    commit 44960e1c39d807cd0023dc7036ee37f105617ebe
    RDMA/mad: Do not crash if the rdma device does not have a umad interface
        (commit 5bdfa854013ce4193de0d097931fd841382c76a7 upstream)

Thanks,

Ilya

#2 lore raw

Hi Roose,

I think this should be similar with https://tracker.ceph.com/issues/57898, but it's from 5.15 instead.

Days ago just after Ilya rebased to the 6.1 without changing anything in ceph code the xfstest tests were much faster.

I just checked the difference about the 5.4 and 5.4.45 and couldn't know what has happened exactly. So please share your test case about this.

- Xiubo

Quoted 54 lines · Ilya Dryomov
Quoted 2 lines · Marco

Dear Ilya,
I'm using Ubuntu and a CephFS mount. I had a more than 90% write performance decrease after changing the kernels main version ( <10MB/s vs. 100-140 MB/s). The problem seems to exist in Kernel major versions starting at v5.4. Ubuntu mainline version v5.4.25 is fine, v5.4.45 (which is next available) is "bad".

Hi Marco,

What is the workload?

Quoted 1 line

After a git bisect with the "original" 5.4 kernels I get the following result:

Can you describe how you performed bisection? Can you share the reproducer you used for bisection?

Quoted 19 lines

ed24820d1b0cbe8154c04189a44e363230ed647e is the first bad commit commit ed24820d1b0cbe8154c04189a44e363230ed647e

Author: Ilya Dryomov <[email protected]>
Date:   Mon Mar 9 12:03:14 2020 +0100

ceph: check POOL_FLAG_FULL/NEARFULL in addition to OSDMAP_FULL/NEARFULL

commit 7614209736fbc4927584d4387faade4f31444fce upstream.

CEPH_OSDMAP_FULL/NEARFULL aren't set since mimic, so we need to consult per-pool flags as well. Unfortunately the backwards compatibility here is lacking:

- the change that deprecated OSDMAP_FULL/NEARFULL went into mimic, but was guarded by require_osd_release >= RELEASE_LUMINOUS
- it was subsequently backported to luminous in v12.2.2, but that makes no difference to clients that only check OSDMAP_FULL/NEARFULL because require_osd_release is not client-facing -- it is for OSDs

Quoted 7 lines

Since all kernels are affected, the best we can do here is just start checking both map flags and pool flags and send that to stable.

These checks are best effort, so take osdc->lock and look up pool flags just once. Remove the FIXME, since filesystem quotas are checked above and RADOS quotas are reflected in POOL_FLAG_FULL: when the pool reaches its quota, both POOL_FLAG_FULL and POOL_FLAG_FULL_QUOTA are set.

The only suspicious thing I see in this commit is osdc->lock semaphore which is taken for read for a short period of time in ceph_write_iter(). It's possible that that started interfering with other code paths that take that semaphore for write and read-write lock fairness algorithm is biting...

Can you confirm the result by manually checking out the previous commit and verifying that it's "good"?

     commit 44960e1c39d807cd0023dc7036ee37f105617ebe
     RDMA/mad: Do not crash if the rdma device does not have a umad interface
         (commit 5bdfa854013ce4193de0d097931fd841382c76a7 upstream)

Thanks,

Ilya

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 89 lines · Marco

Hi Ilya and Xiubo,
thanks for looking onto this. I try to answer you questions:

==============================

Quoted 1 line

What is the workload / test case?

I'm using a ~ 2G large test file which I rsync from local storage to the ceph mount. I'm using rsync for convinience as the --progress coammand line switch gives a good immidiate indicator if teh problem exists.

good Kernel (e.g. 5.6.0 RC7)

root@S1020-CephTest:~# uname -a
Linux S1020-CephTest 5.6.0-050600rc7-generic #202003230230 SMP Mon Mar 23
02:33:08 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
root@S1020-CephTest:~# ls tatort.mp4
tatort.mp4
root@S1020-CephTest:~# ls -la tatort.mp4
-rw-rw-r-- 1 nanoadmin nanoadmin 2106772019 Dec  7 11:25 tatort.mp4
root@S1020-CephTest:~# rsync -avh --progress tatort.mp4 /mnt/ceph/tatort.mp4
sending incremental file list
tatort.mp4
           2.11G 100%  138.10MB/s    0:00:14 (xfr#1, to-chk=0/1)

sent 2.11G bytes  received 35 bytes  135.95M bytes/sec total size is 2.11G  speedup is 1.00

bad Kernel (e.g. 5.6.0 FINAL)

root@S1020-CephTest:~# uname -a
Linux S1020-CephTest 5.6.0-050600-generic #202003292333 SMP Sun Mar 29
23:35:58 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
root@S1020-CephTest:~# rsync -avh --progress tatort.mp4 /mnt/ceph/tatort.mp4
sending incremental file list
tatort.mp4
          21.59M   1%    2.49MB/s    0:13:38

(see attached screen shot from netdata abour the difference in iowait for both test cases)

As Xiubo supposed I tested with the very last RC kernel, too. Same problem:

Latest 6.1. RC kernel

root@S1020-CephTest:~# uname -a
Linux S1020-CephTest 6.1.0-060100rc5-generic #202211132230 SMP
PREEMPT_DYNAMIC Sun Nov 13 22:36:10 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
root@S1020-CephTest:~# rsync -avh --progress tatort.mp4 /mnt/ceph/tatort.mp4
sending incremental file list
tatort.mp4
          60.13M   2%    3.22MB/s    0:10:20

(attached a netdata screenshot for that, too).

==================================================

Quoted 2 lines

Can you describe how you performed bisection?  Can you share the reproducer you used for bisection?

Took a commit from 5.4 which I had confirmed to be bad in earlier tests. Than took tag 5.4.25 which I confirmed to be good as first "good"

# git bisect log
git bisect start
# bad: [61bbc823a17abb3798568cfb11ff38fc22317442] clk: ti: am43xx: Fix clock
parent for RTC clock
git bisect bad 61bbc823a17abb3798568cfb11ff38fc22317442
# good: [18fe53f6dfbc5ad4ff2164bff841b56d61b22720] Linux 5.4.25
git bisect good 18fe53f6dfbc5ad4ff2164bff841b56d61b22720
# good: [59e4624e664c9e83c04abae9b710cd60cb908a82] ALSA: seq: oss: Fix
running status after receiving sysex
git bisect good 59e4624e664c9e83c04abae9b710cd60cb908a82
# good: [8dab286ab527dc3fa68e9705b0805f4d6ce10add] fsl/fman: detect FMan
erratum A050385
git bisect good 8dab286ab527dc3fa68e9705b0805f4d6ce10add
# bad: [160c2ffa701692e60c7034271b4c06b843b7249f] xfrm: add the missing
verify_sec_ctx_len check in xfrm_add_acquire
git bisect bad 160c2ffa701692e60c7034271b4c06b843b7249f
# bad: [174da11b6474200e2e43509ce2d34e62ecea9f4b] ARM: dts: omap5: Add
bus_dma_limit for L3 bus
git bisect bad 174da11b6474200e2e43509ce2d34e62ecea9f4b
# good: [65047f7538ba5c0edcf4b4768d942970bb6d4cbc] iwlwifi: mvm: fix
non-ACPI function
git bisect good 65047f7538ba5c0edcf4b4768d942970bb6d4cbc
# good: [10d5de234df4a4567a8da18de04111f7e931fd70] RDMA/core: Fix missing
error check on dev_set_name()
git bisect good 10d5de234df4a4567a8da18de04111f7e931fd70
# good: [44960e1c39d807cd0023dc7036ee37f105617ebe] RDMA/mad: Do not crash if
the rdma device does not have a umad interface
git bisect good 44960e1c39d807cd0023dc7036ee37f105617ebe
Quoted 8 lines
# bad: [7cdaa5cd79abe15935393b4504eaf008361aa517] ceph: fix memory leak in
ceph_cleanup_snapid_map()
git bisect bad 7cdaa5cd79abe15935393b4504eaf008361aa517
# bad: [ed24820d1b0cbe8154c04189a44e363230ed647e] ceph: check
POOL_FLAG_FULL/NEARFULL in addition to OSDMAP_FULL/NEARFULL
git bisect bad ed24820d1b0cbe8154c04189a44e363230ed647e
# first bad commit: [ed24820d1b0cbe8154c04189a44e363230ed647e] ceph: check
POOL_FLAG_FULL/NEARFULL in addition to OSDMAP_FULL/NEARFULL

Since you are here, could you try to revert this commit and have a try ?

Let's see whether is this commit causing it. I will take a look later this week.

Thanks

- Xiubo

Quoted 148 lines
Quoted 3 lines

Can you confirm the result by manually checking out the previous commit and verifying that it's "good"?

root@S1020-CephTest:~/src/linux# git checkout -b ceph_check_last_good
44960e1c39d807cd0023dc7036ee37f105617ebe
Checking out files: 100% (68968/68968), done.
Switched to a new branch 'ceph_check_last_good'
root@S1020-CephTest:~/src/linux# make clean
...
root@S1020-CephTest:~/src/linux# cp -a /boot/config-5.4.25-050425-generic
.config
root@S1020-CephTest:~/src/linux# make olddefconfig
...
root@S1020-CephTest:~/src/linux# make bindeb-pkg -j"$(nproc)"
...
dpkg-deb: building package 'linux-headers-5.4.28+' in
'../linux-headers-5.4.28+_5.4.28+-10_amd64.deb'.
dpkg-deb: building package 'linux-libc-dev' in
'../linux-libc-dev_5.4.28+-10_amd64.deb'.
dpkg-deb: building package 'linux-image-5.4.28+' in
'../linux-image-5.4.28+_5.4.28+-10_amd64.deb'.
dpkg-deb: building package 'linux-image-5.4.28+-dbg' in
'../linux-image-5.4.28+-dbg_5.4.28+-10_amd64.deb'.
  dpkg-genbuildinfo --build=binary
  dpkg-genchanges --build=binary >../linux-5.4.28+_5.4.28+-10_amd64.changes
dpkg-genchanges: info: binary-only upload (no source code included)
  dpkg-source --after-build linux
dpkg-buildpackage: info: binary-only upload (no source included)
root@S1020-CephTest:~/src/linux# cd ..
root@S1020-CephTest:~/src# ls
linux
  linux-5.4.28+_5.4.28+-10_amd64.changes
linux-image-5.4.28+_5.4.28+-10_amd64.deb
linux-libc-dev_5.4.28+-10_amd64.deb
linux-5.4.28+_5.4.28+-10_amd64.buildinfo
linux-headers-5.4.28+_5.4.28+-10_amd64.deb
linux-image-5.4.28+-dbg_5.4.28+-10_amd64.deb
root@S1020-CephTest:~/src# dpkg -i linux-image-5.4.28+*
...
root@S1020-CephTest:~/src# reboot
....
root@S1020-CephTest:~# uname -a
Linux S1020-CephTest 5.4.28+ #10 SMP Fri Dec 16 09:20:11 CET 2022 x86_64
x86_64 x86_64 GNU/Linux
root@S1020-CephTest:~# rsync -avh --progress tatort.mp4 /mnt/ceph/tatort.mp4
sending incremental file list
tatort.mp4
           2.11G 100%  135.15MB/s    0:00:14 (xfr#1, to-chk=0/1)

sent 2.11G bytes  received 35 bytes  135.95M bytes/sec total size is 2.11G  speedup is 1.00

As you can see the problem does not exist here.

Thanks again!
Marco
________________________________________
From: Xiubo Li <[email protected]>
Sent: Friday, December 16, 2022 3:20:46 AM
To: Ilya Dryomov; Roose, Marco
Cc: Ceph Development
Subject: Re: PROBLEM: CephFS write performance drops by 90%

Hi Roose,

I think this should be similar with
https://tracker.ceph.com/issues/57898, but it's from 5.15 instead.

Days ago just after Ilya rebased to the 6.1 without changing anything in ceph code the xfstest tests were much faster.

I just checked the difference about the 5.4 and 5.4.45 and couldn't know what has happened exactly. So please share your test case about this.

- Xiubo

Quoted 1 line · Ilya Dryomov

On Thu, Dec 15, 2022 at 3:22 PM Roose, Marco <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines

Dear Ilya,
I'm using Ubuntu and a CephFS mount. I had a more than 90% write

performance decrease after changing the kernels main version ( <10MB/s vs. 100-140 MB/s). The problem seems to exist in Kernel major versions starting at v5.4. Ubuntu mainline version v5.4.25 is fine, v5.4.45 (which is next available) is "bad".

Quoted 5 lines

Hi Marco,

What is the workload?

Quoted 1 line

After a git bisect with the "original" 5.4 kernels I get the following

result:

Quoted 9 lines

Can you describe how you performed bisection?  Can you share the reproducer you used for bisection?

Quoted 6 lines

ed24820d1b0cbe8154c04189a44e363230ed647e is the first bad commit commit ed24820d1b0cbe8154c04189a44e363230ed647e
Author: Ilya Dryomov <[email protected]>
Date:   Mon Mar 9 12:03:14 2020 +0100

      ceph: check POOL_FLAG_FULL/NEARFULL in addition to

OSDMAP_FULL/NEARFULL

Quoted 3 lines
Quoted 3 lines

      commit 7614209736fbc4927584d4387faade4f31444fce upstream.

      CEPH_OSDMAP_FULL/NEARFULL aren't set since mimic, so we need to

consult

Quoted 1 line
Quoted 1 line

      per-pool flags as well.  Unfortunately the backwards compatibility

here

Quoted 3 lines
Quoted 3 lines

      is lacking:

      - the change that deprecated OSDMAP_FULL/NEARFULL went into mimic,

but

Quoted 2 lines
Quoted 2 lines

        was guarded by require_osd_release >= RELEASE_LUMINOUS
      - it was subsequently backported to luminous in v12.2.2, but that

makes

Quoted 1 line
Quoted 1 line

        no difference to clients that only check OSDMAP_FULL/NEARFULL

because

Quoted 3 lines
Quoted 3 lines

        require_osd_release is not client-facing -- it is for OSDs

      Since all kernels are affected, the best we can do here is just

start

Quoted 3 lines
Quoted 3 lines

      checking both map flags and pool flags and send that to stable.

      These checks are best effort, so take osdc->lock and look up pool

flags

Quoted 1 line
Quoted 1 line

      just once.  Remove the FIXME, since filesystem quotas are checked

above

Quoted 1 line
Quoted 1 line

      and RADOS quotas are reflected in POOL_FLAG_FULL: when the pool

reaches

Quoted 7 lines
Quoted 1 line

      its quota, both POOL_FLAG_FULL and POOL_FLAG_FULL_QUOTA are set.

The only suspicious thing I see in this commit is osdc->lock semaphore which is taken for read for a short period of time in ceph_write_iter(). It's possible that that started interfering with other code paths that take that semaphore for write and read-write lock fairness algorithm is biting...

Quoted 5 lines

Can you confirm the result by manually checking out the previous commit and verifying that it's "good"?

      commit 44960e1c39d807cd0023dc7036ee37f105617ebe RDMA/mad: Do not crash if the rdma device does not have a umad

interface

Quoted 6 lines

          (commit 5bdfa854013ce4193de0d097931fd841382c76a7 upstream)

Thanks,

                  Ilya

#5 lore raw

Dear Xiubo,
my colleague Paul (in CC) tried to revert the commit, but it was'nt possible.

Kind regards,
Marco Roose

-----Original Message-----
From: Xiubo Li <[email protected]>
Sent: 19 December 2022 01:16
To: Roose, Marco <[email protected]>; Ilya Dryomov <[email protected]>
Cc: Ceph Development <[email protected]>
Subject: Re: PROBLEM: CephFS write performance drops by 90%

Quoted 8 lines · Marco

Hi Ilya and Xiubo,
thanks for looking onto this. I try to answer you questions:

==============================

Quoted 1 line

What is the workload / test case?

I'm using a ~ 2G large test file which I rsync from local storage to the ceph mount. I'm using rsync for convinience as the --progress coammand line switch gives a good immidiate indicator if teh problem

exists.

Quoted 30 lines

good Kernel (e.g. 5.6.0 RC7)

root@S1020-CephTest:~# uname -a
Linux S1020-CephTest 5.6.0-050600rc7-generic #202003230230 SMP Mon Mar 
23
02:33:08 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux 
root@S1020-CephTest:~# ls tatort.mp4
tatort.mp4
root@S1020-CephTest:~# ls -la tatort.mp4
-rw-rw-r-- 1 nanoadmin nanoadmin 2106772019 Dec  7 11:25 tatort.mp4 
root@S1020-CephTest:~# rsync -avh --progress tatort.mp4 
/mnt/ceph/tatort.mp4 sending incremental file list
tatort.mp4
           2.11G 100%  138.10MB/s    0:00:14 (xfr#1, to-chk=0/1)

sent 2.11G bytes  received 35 bytes  135.95M bytes/sec total size is 2.11G  speedup is 1.00

bad Kernel (e.g. 5.6.0 FINAL)

root@S1020-CephTest:~# uname -a
Linux S1020-CephTest 5.6.0-050600-generic #202003292333 SMP Sun Mar 29
23:35:58 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux 
root@S1020-CephTest:~# rsync -avh --progress tatort.mp4 
/mnt/ceph/tatort.mp4 sending incremental file list
tatort.mp4
          21.59M   1%    2.49MB/s    0:13:38
Quoted 5 lines

(see attached screen shot from netdata abour the difference in iowait for both test cases)

As Xiubo supposed I tested with the very last RC kernel, too. Same

problem:

Quoted 48 lines

Latest 6.1. RC kernel

root@S1020-CephTest:~# uname -a
Linux S1020-CephTest 6.1.0-060100rc5-generic #202211132230 SMP 
PREEMPT_DYNAMIC Sun Nov 13 22:36:10 UTC 2022 x86_64 x86_64 x86_64 
GNU/Linux root@S1020-CephTest:~# rsync -avh --progress tatort.mp4 
/mnt/ceph/tatort.mp4 sending incremental file list
tatort.mp4
          60.13M   2%    3.22MB/s    0:10:20

(attached a netdata screenshot for that, too).

==================================================

Quoted 2 lines

Can you describe how you performed bisection?  Can you share the reproducer you used for bisection?

Took a commit from 5.4 which I had confirmed to be bad in earlier tests. Than took tag 5.4.25 which I confirmed to be good as first "good"

# git bisect log
git bisect start
# bad: [61bbc823a17abb3798568cfb11ff38fc22317442] clk: ti: am43xx: Fix 
clock parent for RTC clock git bisect bad 
61bbc823a17abb3798568cfb11ff38fc22317442
# good: [18fe53f6dfbc5ad4ff2164bff841b56d61b22720] Linux 5.4.25 git 
bisect good 18fe53f6dfbc5ad4ff2164bff841b56d61b22720
# good: [59e4624e664c9e83c04abae9b710cd60cb908a82] ALSA: seq: oss: Fix 
running status after receiving sysex git bisect good 
59e4624e664c9e83c04abae9b710cd60cb908a82
# good: [8dab286ab527dc3fa68e9705b0805f4d6ce10add] fsl/fman: detect 
FMan erratum A050385 git bisect good 
8dab286ab527dc3fa68e9705b0805f4d6ce10add
# bad: [160c2ffa701692e60c7034271b4c06b843b7249f] xfrm: add the 
missing verify_sec_ctx_len check in xfrm_add_acquire git bisect bad 
160c2ffa701692e60c7034271b4c06b843b7249f
# bad: [174da11b6474200e2e43509ce2d34e62ecea9f4b] ARM: dts: omap5: Add 
bus_dma_limit for L3 bus git bisect bad 
174da11b6474200e2e43509ce2d34e62ecea9f4b
# good: [65047f7538ba5c0edcf4b4768d942970bb6d4cbc] iwlwifi: mvm: fix 
non-ACPI function git bisect good 
65047f7538ba5c0edcf4b4768d942970bb6d4cbc
# good: [10d5de234df4a4567a8da18de04111f7e931fd70] RDMA/core: Fix 
missing error check on dev_set_name() git bisect good 
10d5de234df4a4567a8da18de04111f7e931fd70
# good: [44960e1c39d807cd0023dc7036ee37f105617ebe] RDMA/mad: Do not 
crash if the rdma device does not have a umad interface git bisect 
good 44960e1c39d807cd0023dc7036ee37f105617ebe
# bad: [7cdaa5cd79abe15935393b4504eaf008361aa517] ceph: fix memory 
Quoted 8 lines
leak in
ceph_cleanup_snapid_map()
git bisect bad 7cdaa5cd79abe15935393b4504eaf008361aa517
# bad: [ed24820d1b0cbe8154c04189a44e363230ed647e] ceph: check 
POOL_FLAG_FULL/NEARFULL in addition to OSDMAP_FULL/NEARFULL git bisect 
bad ed24820d1b0cbe8154c04189a44e363230ed647e
# first bad commit: [ed24820d1b0cbe8154c04189a44e363230ed647e] ceph: 
check POOL_FLAG_FULL/NEARFULL in addition to OSDMAP_FULL/NEARFULL

Since you are here, could you try to revert this commit and have a try ?

Let's see whether is this commit causing it. I will take a look later this week.

Thanks

- Xiubo

Quoted 134 lines
Quoted 3 lines

Can you confirm the result by manually checking out the previous commit and verifying that it's "good"?

root@S1020-CephTest:~/src/linux# git checkout -b ceph_check_last_good 
44960e1c39d807cd0023dc7036ee37f105617ebe
Checking out files: 100% (68968/68968), done.
Switched to a new branch 'ceph_check_last_good'
root@S1020-CephTest:~/src/linux# make clean ...
root@S1020-CephTest:~/src/linux# cp -a 
/boot/config-5.4.25-050425-generic
.config
root@S1020-CephTest:~/src/linux# make olddefconfig ...
root@S1020-CephTest:~/src/linux# make bindeb-pkg -j"$(nproc)"
...
dpkg-deb: building package 'linux-headers-5.4.28+' in 
'../linux-headers-5.4.28+_5.4.28+-10_amd64.deb'.
dpkg-deb: building package 'linux-libc-dev' in 
'../linux-libc-dev_5.4.28+-10_amd64.deb'.
dpkg-deb: building package 'linux-image-5.4.28+' in 
'../linux-image-5.4.28+_5.4.28+-10_amd64.deb'.
dpkg-deb: building package 'linux-image-5.4.28+-dbg' in 
'../linux-image-5.4.28+-dbg_5.4.28+-10_amd64.deb'.
  dpkg-genbuildinfo --build=binary
  dpkg-genchanges --build=binary 
Quoted 1 line

../linux-5.4.28+_5.4.28+-10_amd64.changes

dpkg-genchanges: info: binary-only upload (no source code included)
 dpkg-source --after-build linux
dpkg-buildpackage: info: binary-only upload (no source included)

root@S1020-CephTest:~/src/linux# cd ..
root@S1020-CephTest:~/src# ls
linux
  linux-5.4.28+_5.4.28+-10_amd64.changes
linux-image-5.4.28+_5.4.28+-10_amd64.deb
linux-libc-dev_5.4.28+-10_amd64.deb
linux-5.4.28+_5.4.28+-10_amd64.buildinfo
linux-headers-5.4.28+_5.4.28+-10_amd64.deb
linux-image-5.4.28+-dbg_5.4.28+-10_amd64.deb
root@S1020-CephTest:~/src# dpkg -i linux-image-5.4.28+* ...
root@S1020-CephTest:~/src# reboot
....
root@S1020-CephTest:~# uname -a
Linux S1020-CephTest 5.4.28+ #10 SMP Fri Dec 16 09:20:11 CET 2022 
x86_64
x86_64 x86_64 GNU/Linux
root@S1020-CephTest:~# rsync -avh --progress tatort.mp4 
/mnt/ceph/tatort.mp4 sending incremental file list
tatort.mp4
           2.11G 100%  135.15MB/s    0:00:14 (xfr#1, to-chk=0/1)

sent 2.11G bytes  received 35 bytes  135.95M bytes/sec total size is 2.11G  speedup is 1.00

As you can see the problem does not exist here.

Thanks again!
Marco
________________________________________
From: Xiubo Li <[email protected]>
Sent: Friday, December 16, 2022 3:20:46 AM
To: Ilya Dryomov; Roose, Marco
Cc: Ceph Development
Subject: Re: PROBLEM: CephFS write performance drops by 90%

Hi Roose,

I think this should be similar with
https://tracker.ceph.com/issues/57898, but it's from 5.15 instead.

Days ago just after Ilya rebased to the 6.1 without changing anything in ceph code the xfstest tests were much faster.

I just checked the difference about the 5.4 and 5.4.45 and couldn't know what has happened exactly. So please share your test case about this.

- Xiubo

Quoted 2 lines · Ilya Dryomov

On Thu, Dec 15, 2022 at 3:22 PM Roose, Marco
<[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines

Dear Ilya,
I'm using Ubuntu and a CephFS mount. I had a more than 90% write

performance decrease after changing the kernels main version ( <10MB/s vs. 100-140 MB/s). The problem seems to exist in Kernel major versions starting at v5.4. Ubuntu mainline version v5.4.25 is fine, v5.4.45 (which is next
available) is "bad".

Quoted 6 lines

Hi Marco,

What is the workload?

Quoted 2 lines

After a git bisect with the "original" 5.4 kernels I get the following

result:

Quoted 9 lines

Can you describe how you performed bisection?  Can you share the reproducer you used for bisection?

Quoted 6 lines

ed24820d1b0cbe8154c04189a44e363230ed647e is the first bad commit commit ed24820d1b0cbe8154c04189a44e363230ed647e
Author: Ilya Dryomov <[email protected]>
Date:   Mon Mar 9 12:03:14 2020 +0100

      ceph: check POOL_FLAG_FULL/NEARFULL in addition to

OSDMAP_FULL/NEARFULL

Quoted 4 lines
Quoted 4 lines

      commit 7614209736fbc4927584d4387faade4f31444fce upstream.

      CEPH_OSDMAP_FULL/NEARFULL aren't set since mimic, so we need
to

consult

Quoted 2 lines
Quoted 2 lines

      per-pool flags as well.  Unfortunately the backwards
compatibility

here

Quoted 4 lines
Quoted 4 lines

      is lacking:

      - the change that deprecated OSDMAP_FULL/NEARFULL went into
mimic,

but

Quoted 3 lines
Quoted 3 lines

        was guarded by require_osd_release >= RELEASE_LUMINOUS
      - it was subsequently backported to luminous in v12.2.2, but
that

makes

Quoted 2 lines
Quoted 2 lines

        no difference to clients that only check
OSDMAP_FULL/NEARFULL

because

Quoted 4 lines
Quoted 4 lines

        require_osd_release is not client-facing -- it is for OSDs

      Since all kernels are affected, the best we can do here is
just

start

Quoted 4 lines
Quoted 4 lines

      checking both map flags and pool flags and send that to stable.

      These checks are best effort, so take osdc->lock and look up
pool

Quoted 10 lines

flags

Quoted 2 lines
Quoted 2 lines

      just once.  Remove the FIXME, since filesystem quotas are
checked

above

Quoted 2 lines
Quoted 2 lines

      and RADOS quotas are reflected in POOL_FLAG_FULL: when the
pool

reaches

Quoted 3 lines
Quoted 1 line

      its quota, both POOL_FLAG_FULL and POOL_FLAG_FULL_QUOTA are set.

The only suspicious thing I see in this commit is osdc->lock semaphore which is taken for read for a short period of time in

ceph_write_iter().

Quoted 16 lines
Quoted 9 lines

It's possible that that started interfering with other code paths that take that semaphore for write and read-write lock fairness algorithm is biting...

Can you confirm the result by manually checking out the previous commit and verifying that it's "good"?

      commit 44960e1c39d807cd0023dc7036ee37f105617ebe RDMA/mad: Do not crash if the rdma device does not have a umad

interface

Quoted 6 lines

          (commit 5bdfa854013ce4193de0d097931fd841382c76a7 upstream)

Thanks,

                  Ilya

#6 lore raw

Dear Xiubo,

Am 19.12.22 um 11:48 schrieb Roose, Marco:

Quoted 10 lines

my colleague Paul (in CC) tried to revert the commit, but it was'nt possible.

-----Original Message-----
From: Xiubo Li <[email protected]>
Sent: 19 December 2022 01:16
To: Roose, Marco <[email protected]>; Ilya Dryomov <[email protected]>
Cc: Ceph Development <[email protected]>
Subject: Re: PROBLEM: CephFS write performance drops by 90%

[…]

Quoted 4 lines

Since you are here, could you try to revert this commit and have a try ?

Let's see whether is this commit causing it. I will take a look later this week.

Unfortunately, reverting the commit is not easily possible, as the code was changed afterward too. It’d be great if you provided a git branch with the commit reverted.

Marco, if you have time, it’d be great if you tested Liunx 5.6-rc7 and 5.6, where the commit entered Linus’ master branch.

Kind regards,

Paul

#7 lore raw

[...]

Quoted 1 line

Marco, if you have time, it’d be great if you tested Liunx 5.6-rc7 and 5.6, where the commit entered Linus’ master branch.

already did it: as expected RC7 is fine 5.6 shows the exact problem

Kind regards,
Marco Roose

-----Original Message-----
From: Paul Menzel <[email protected]>
Sent: 19 December 2022 12:46
To: Xiubo Li <[email protected]>; Roose, Marco <[email protected]>
Cc: Ilya Dryomov <[email protected]>; [email protected]
Subject: Re: PROBLEM: CephFS write performance drops by 90%

Dear Xiubo,

Am 19.12.22 um 11:48 schrieb Roose, Marco:

Quoted 10 lines

my colleague Paul (in CC) tried to revert the commit, but it was'nt possible.

-----Original Message-----
From: Xiubo Li <[email protected]>
Sent: 19 December 2022 01:16
To: Roose, Marco <[email protected]>; Ilya Dryomov <[email protected]>
Cc: Ceph Development <[email protected]>
Subject: Re: PROBLEM: CephFS write performance drops by 90%

[…]

Quoted 4 lines

Since you are here, could you try to revert this commit and have a try ?

Let's see whether is this commit causing it. I will take a look later this week.

Unfortunately, reverting the commit is not easily possible, as the code was changed afterward too. It’d be great if you provided a git branch with the commit reverted.

Marco, if you have time, it’d be great if you tested Liunx 5.6-rc7 and 5.6, where the commit entered Linus’ master branch.

Kind regards,

Paul

#8 lore raw

Hi Marco,

Here is the revert on top of 6.1 (currently only build-tested):

https://github.com/ceph/ceph-client/commit/b45280b209388082a0880eb7d348436cc0a6ee6d

Also, can you share "ceph report | jq .osdmap" output captured before, during (in the middle of it going at <10M/s) and after the test?

Thanks,

Ilya

Quoted 47 lines · Marco

[...]

Quoted 1 line

Marco, if you have time, it’d be great if you tested Liunx 5.6-rc7 and 5.6, where the commit entered Linus’ master branch.

already did it: as expected RC7 is fine 5.6 shows the exact problem

Kind regards,
Marco Roose

-----Original Message-----
From: Paul Menzel <[email protected]>
Sent: 19 December 2022 12:46
To: Xiubo Li <[email protected]>; Roose, Marco <[email protected]>
Cc: Ilya Dryomov <[email protected]>; [email protected]
Subject: Re: PROBLEM: CephFS write performance drops by 90%

Dear Xiubo,

Am 19.12.22 um 11:48 schrieb Roose, Marco:

Quoted 10 lines

my colleague Paul (in CC) tried to revert the commit, but it was'nt possible.

-----Original Message-----
From: Xiubo Li <[email protected]>
Sent: 19 December 2022 01:16
To: Roose, Marco <[email protected]>; Ilya Dryomov <[email protected]>
Cc: Ceph Development <[email protected]>
Subject: Re: PROBLEM: CephFS write performance drops by 90%

[…]

Quoted 4 lines

Since you are here, could you try to revert this commit and have a try ?

Let's see whether is this commit causing it. I will take a look later this week.

Unfortunately, reverting the commit is not easily possible, as the code was changed afterward too. It’d be great if you provided a git branch with the commit reverted.

Marco, if you have time, it’d be great if you tested Liunx 5.6-rc7 and 5.6, where the commit entered Linus’ master branch.

Kind regards,

Paul

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw
Quoted 8 lines · Marco

Hi Ilya,
thanks for providing the revert. Using that commit all is fine:

~# uname -a
Linux S1020-CephTest 6.1.0+ #1 SMP PREEMPT_DYNAMIC Thu Dec 22 14:30:22 CET 2022 x86_64 x86_64 x86_64 GNU/Linux

Quoted 7 lines

~# rsync -ah --progress /root/test-file_1000MB /mnt/ceph/test-file_1000MB sending incremental file list
test-file_1000MB

          1.00G 100%   90.53MB/s    0:00:10 (xfr#1, to-chk=0/1)

I attach some ceph reports taking before, during and after an rsync on a bad kernel (5.6.0) for debugging.

I see two CephFS data pools and one of them is nearfull:

    "pool": 10,
    "pool_name": "cephfs_data",
    "create_time": "2020-11-22T08:19:53.701636+0100",
    "flags": 1,
    "flags_names": "hashpspool",

    "pool": 11,
    "pool_name": "cephfs_data_ec",
    "create_time": "2020-11-22T08:22:01.779715+0100",
    "flags": 2053,
    "flags_names": "hashpspool,ec_overwrites,nearfull",

How is this CephFS filesystem is configured? If you end up writing to cephfs_data_ec pool there, the slowness is expected. nearfull makes the client revert to synchronous writes so that it can properly return ENOSPC error when nearfull develops into full. That is the whole point of the commit that you landed upon when bisecting so of course reverting it helps:

- if (ceph_osdmap_flag(&fsc->client->osdc, CEPH_OSDMAP_NEARFULL))
+ if ((map_flags & CEPH_OSDMAP_NEARFULL) ||
+ (pool_flags & CEPH_POOL_FLAG_NEARFULL))

            iocb->ki_flags |= IOCB_DSYNC;

Thanks,

Ilya

#11 lore raw

Dear Ilya,

Am 22.12.22 um 16:25 schrieb Ilya Dryomov:

Quoted 37 lines · Marco
Quoted 7 lines

thanks for providing the revert. Using that commit all is fine:

~# uname -a
Linux S1020-CephTest 6.1.0+ #1 SMP PREEMPT_DYNAMIC Thu Dec 22 14:30:22 CET 2022 x86_64 x86_64 x86_64 GNU/Linux

Quoted 7 lines

~# rsync -ah --progress /root/test-file_1000MB /mnt/ceph/test-file_1000MB sending incremental file list
test-file_1000MB

           1.00G 100%   90.53MB/s    0:00:10 (xfr#1, to-chk=0/1)

I attach some ceph reports taking before, during and after an rsync on a bad kernel (5.6.0) for debugging.

I see two CephFS data pools and one of them is nearfull:

     "pool": 10,
     "pool_name": "cephfs_data",
     "create_time": "2020-11-22T08:19:53.701636+0100",
     "flags": 1,
     "flags_names": "hashpspool",

     "pool": 11,
     "pool_name": "cephfs_data_ec",
     "create_time": "2020-11-22T08:22:01.779715+0100",
     "flags": 2053,
     "flags_names": "hashpspool,ec_overwrites,nearfull",

How is this CephFS filesystem is configured? If you end up writing to cephfs_data_ec pool there, the slowness is expected. nearfull makes the client revert to synchronous writes so that it can properly return ENOSPC error when nearfull develops into full. That is the whole point of the commit that you landed upon when bisecting so of course reverting it helps:

Review

Quoted 4 lines
(quoted diff) +2 -1
-   if (ceph_osdmap_flag(&fsc->client->osdc, CEPH_OSDMAP_NEARFULL))
+   if ((map_flags & CEPH_OSDMAP_NEARFULL) ||
+       (pool_flags & CEPH_POOL_FLAG_NEARFULL))
             iocb->ki_flags |= IOCB_DSYNC;

Well, that effect is not documented in the commit message, and for the user it’s a regression, that the existing (for the user working) configuration performs worse after updating the Linux kernel. That violates Linux’ no-regression policy, and at least needs to be better documented and explained.

Kind regards,

Paul

#12 lore raw
Quoted 47 lines · Paul Menzel

Dear Ilya,

Am 22.12.22 um 16:25 schrieb Ilya Dryomov:

Quoted 37 lines · Marco
Quoted 7 lines

thanks for providing the revert. Using that commit all is fine:

~# uname -a
Linux S1020-CephTest 6.1.0+ #1 SMP PREEMPT_DYNAMIC Thu Dec 22 14:30:22 CET 2022 x86_64 x86_64 x86_64 GNU/Linux

Quoted 7 lines

~# rsync -ah --progress /root/test-file_1000MB /mnt/ceph/test-file_1000MB sending incremental file list
test-file_1000MB

           1.00G 100%   90.53MB/s    0:00:10 (xfr#1, to-chk=0/1)

I attach some ceph reports taking before, during and after an rsync on a bad kernel (5.6.0) for debugging.

I see two CephFS data pools and one of them is nearfull:

     "pool": 10,
     "pool_name": "cephfs_data",
     "create_time": "2020-11-22T08:19:53.701636+0100",
     "flags": 1,
     "flags_names": "hashpspool",

     "pool": 11,
     "pool_name": "cephfs_data_ec",
     "create_time": "2020-11-22T08:22:01.779715+0100",
     "flags": 2053,
     "flags_names": "hashpspool,ec_overwrites,nearfull",

How is this CephFS filesystem is configured? If you end up writing to cephfs_data_ec pool there, the slowness is expected. nearfull makes the client revert to synchronous writes so that it can properly return ENOSPC error when nearfull develops into full. That is the whole point of the commit that you landed upon when bisecting so of course reverting it helps:

Review

Quoted 4 lines
(quoted diff) +2 -1
-   if (ceph_osdmap_flag(&fsc->client->osdc, CEPH_OSDMAP_NEARFULL))
+   if ((map_flags & CEPH_OSDMAP_NEARFULL) ||
+       (pool_flags & CEPH_POOL_FLAG_NEARFULL))
             iocb->ki_flags |= IOCB_DSYNC;
Quoted 5 lines

Well, that effect is not documented in the commit message, and for the user it’s a regression, that the existing (for the user working) configuration performs worse after updating the Linux kernel. That violates Linux’ no-regression policy, and at least needs to be better documented and explained.

Hi Paul,

This isn't a regression -- CephFS has always behaved this way. In fact, these states (nearfull and full) used to be global meaning that filling up some random pool, completely unrelated to CephFS, still lead to synchronous behavior!

This was fixed in the Mimic release. These states became per-pool and the global CEPH_OSDMAP_NEARFULL and CEPH_OSDMAP_FULL flags were deprecated. The referenced commit just caught the kernel client up with that OSD-side change -- which is a definite improvement.

Unfortunately this catch up was almost two years late (Mimic went out in 2018). The users shouldn't have noticed: our expectation was that the global flags would continue to be set for older clients to ensure that such clients could revert to synchronous writes as before. However, as noted in the commit message, the deprecation change turned out to be backwards incompatible by mistake and the net effect was that the global flags just stopped being set. As a result, for a Mimic (or later) cluster + any kernel client combination, synchronous behavior just vanished and _this_ was a regression. After a while Yanhu noticed and reported it.

So the commit in question actually fixes a regression, not introduces one. You just happened to ran into a case of a nearfull pool with a newer cluster and an older kernel client. Had global -> per-pool flags change in Mimic been backwards compatible as intended, you would have encountered a performance drop immediately after cephfs_data_ec pool had exceeded nearfull watermark.

The reason for the synchronous behavior is that, thanks to an advanced caps system [1], CephFS clients can buffer pretty large amounts of data as well as carry out many metadata operations locally. If the pool is nearing capacity, determining whether there is enough space left for all that data is tricky. Switching to performing writes synchronously allows the client to generate ENOSPC error in a timely manner.

[1] https://www.youtube.com/watch?v=VgNI5RQJGp0

Hope this explanation helps!

Ilya