Code Monkey home page Code Monkey logo

Comments (6)

josephhz avatar josephhz commented on May 30, 2024

使用的 Alibaba Cloud Linux 3 吗?实现跟 Alibaba Cloud Linux 2 是一样的。
确认下是否已经在启动参数中打开了 cgwb_v1,按照文档检查下具体那一步不符合预期。

from cloud-kernel.

SweetPine1 avatar SweetPine1 commented on May 30, 2024

是使用release-5.10分支源码编译的内核,确认启动参数cgwb_v1打开。
memcg和blkcg映射关系:
# cat /sys/kernel/debug/bdi/bdi_wb_link memory <---> blkio memcg1: 4470 <---> blkcg1: 1819
iostat测试结果不符合预期,测试4.19分支是符合预期的。所以不清楚5.10内核是否需要其他配置?

from cloud-kernel.

josephhz avatar josephhz commented on May 30, 2024

hi,我使用 Alibaba Cloud Linux 3 的内核(5.10.84-10.3.al8.x86_64),测试是正常的。我的步骤如下:
1)在启动参数中增加 cgwb_v1,重启;
2)执行测试脚本(以 vdb 盘为例,主次设备号为 253:16,挂载目录为 /mnt/vdb):
cgcreate -g blkio:blkcg1
cgcreate -g memory:memcg1
echo 253:16 10485760 > /sys/fs/cgroup/blkio/blkcg1/blkio.throttle.write_bps_device
cgexec -g blkio:blkcg1 -g memory:memcg1 fio -name=test -filename=/mnt/vdb/testfile -iodepth=32 -thread -rw=randwrite -ioengine=libaio -direct=0 -bs=4k -size=1G -numjobs=1
3)查看 iostat -xdm 1 vdb,会发现缓存回刷开始后基本维持在 10MB/s。

from cloud-kernel.

SweetPine1 avatar SweetPine1 commented on May 30, 2024

按照您的方法使用fio测试结果符合预期,感谢大佬解惑

from cloud-kernel.

josephhz avatar josephhz commented on May 30, 2024

如果你说的不符合预期是指 iostat 观测到的值不是那么准确,那应该是跟顺序 io 的合并有关系。
因为内部是通过时间片来计算的,举个例子,在某一秒最后一个时间片之前已经下发 9MB 了,而接下来的 io 是 2MB 的大小,这种情况下就不是每秒显示的数据都是稳定在 10MB,但从一个时间跨度来看,平均下来的数据还是比较准确的。

from cloud-kernel.

SweetPine1 avatar SweetPine1 commented on May 30, 2024

是这样,按照那个文档使用dd+iostat进行测试时,按照如下操作:
配置内核启动参数 cgwb_v1,重启;
mkdir /sys/fs/cgroup/blkio/blkcg1
mkdir /sys/fs/cgroup/memory/memcg1
bash -c "echo $$ > /sys/fs/cgroup/blkio/blkcg1/cgroup.procs"
bash -c "echo $$ > /sys/fs/cgroup/memory/memcg1/cgroup.procs"
echo 8:0 10485760 > /sys/fs/cgroup/blkio/blkcg1/blkio.throttle.write_bps_device
dd if=/dev/zero of=/data/test bs=4k count=10000
iostat -xdm 1 sda查看结果如下:

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
sda              0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
sda              4.00   11.00      0.02      7.43     0.00     0.00   0.00   0.00    0.00    2.36   0.03     4.00   692.00   2.40   3.60

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
sda              0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
sda              0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
sda              0.00   20.00      0.00     24.57     0.00     0.00   0.00   0.00    0.00   18.90   0.38     0.00  1258.00   5.20  10.40

from cloud-kernel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.