Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 2550

Raspberry Pi OS • How to optimize real-time performance

$
0
0
I am using EtherCAT fieldbus on Raspberry Pi 4B. It has high requirements for real-time network communication.

I was based on the rpi-6.1.21 64 bit kernel.Then I patched the PREEMPT_RT patch named patch-6.1.26-rt8.patch, which could be downloaded here and activated “Fully Preemptible Kernel (Real-Time)” option.

After using the new kernel, query the kernel version as 6.1.21-rt8-v8+.
ver.png
I used stress-ng and cyclictest tools for testing, and compared the performance of no-PREEMPT_RT patched kernel with those that were patched PREEMPT_RT.

Test Command:

Code:

stress-ng --cpu 6 --io 4 --vm 2 --cpu-method allsudo cyclictest -t 6 -p 80
The result without PREEMPT_RT patched:

Code:

policy: fifo: loadavg: 15.42 13.11 7.19 2/183 10012T: 0 ( 4348) P:80 I:1000 C: 569122 Min:      6 Act:   18 Avg:   35 Max:     683T: 1 ( 4349) P:80 I:1500 C: 379415 Min:      6 Act:   12 Avg:   30 Max:     594T: 2 ( 4350) P:80 I:2000 C: 284561 Min:      6 Act:   10 Avg:   26 Max:     570T: 3 ( 4351) P:80 I:2500 C: 227648 Min:      8 Act:   10 Avg:   27 Max:     453T: 4 ( 4352) P:80 I:3000 C: 189707 Min:      8 Act:   16 Avg:   22 Max:     511T: 5 ( 4353) P:80 I:3500 C: 162606 Min:      7 Act:   10 Avg:   35 Max:     484
The result with PREEMPT_RT patched:

Code:

policy: fifo: loadavg: 11.39 11.45 9.24 1/386 1986T: 0 ( 1880) P:80 I:1000 C:1003821 Min:      6 Act:    7 Avg:   22 Max:     230T: 1 ( 1881) P:80 I:1500 C: 669214 Min:      6 Act:    7 Avg:   20 Max:     207T: 2 ( 1882) P:80 I:2000 C: 501910 Min:      7 Act:   10 Avg:   19 Max:     158T: 3 ( 1883) P:80 I:2500 C: 401528 Min:      8 Act:    9 Avg:   19 Max:     129T: 4 ( 1884) P:80 I:3000 C: 334607 Min:      7 Act:   10 Avg:   19 Max:     248T: 5 ( 1885) P:80 I:3500 C: 286806 Min:      7 Act:   11 Avg:   25 Max:     215
In addition, I disable the power saving modes in the kernel and scheduling governors.

Code:

sudo sh -c "echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
Most of the time, the real-time jitter is relatively stable, but after running for a period of time (possibly several tens of minutes), the jitter will suddenly increase.
Therefore, I would like to know if there are any real-time optimizations for network drivers or file system?

Statistics: Posted by FrankLee — Tue Jan 16, 2024 8:43 am



Viewing all articles
Browse latest Browse all 2550

Trending Articles