Commit a34e347
committed
Readahead rawlog to make -b operation faster
1, use posix_fadvise POSIX_FADV_SEQUENTIAL to double kernel readahead buffer.
2, HDD typically has a 100~200 IOPS, atop needs to read raw records more fastly
under low IOPS. So use pread syscall to load a large area(default every 4M) in
page-cache.
Test env:
set disk iops as 200 for a virtual machine(KVM).
virsh blkdeviotune stretch sdb --write-iops-sec 200 --read-iops-sec 200 --live
Test cases:
1, test upstream atop without any page cache
~# vmtouch -e /var/log/atop/atop_20190916
~# time /root/atop-upstream -r /var/log/atop/atop_20190916 -b 18:00
real 0m54.639s
user 0m0.094s
sys 0m0.321s
2, test upstream atop with full page cache
~# vmtouch -t /var/log/atop/atop_20190916
~# time /root/atop-upstream -r /var/log/atop/atop_20190916 -b 18:00
real 0m1.266s
user 0m0.004s
sys 0m0.021s
3, test new atop without any page cache
~# vmtouch -e /var/log/atop/atop_20190916
~# time /root/atop-new -r /var/log/atop/atop_20190916 -b 18:00
real 0m3.818s
user 0m0.023s
sys 0m0.170s
case 1 & case 2: speed of reading rawlog effects atop performance a lot.
case 1 & case 3: readahead makes performance better.
Signed-off-by: zhenwei pi <[email protected]>1 parent a802f1a commit a34e347
1 file changed
+22
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
514 | 516 | | |
515 | 517 | | |
516 | 518 | | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
517 | 523 | | |
518 | 524 | | |
519 | 525 | | |
| |||
644 | 650 | | |
645 | 651 | | |
646 | 652 | | |
647 | | - | |
648 | | - | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
649 | 669 | | |
650 | 670 | | |
651 | 671 | | |
| |||
0 commit comments