NanoPi R4S-RK3399 is a great new OpenWrt device

No it is the standard rc4 version from openwrt downloads…

Ok, but still i gave 3 more reasons to why yours is different right now.

Yeah but I did not touch anything, waited more than 10sec, did not install irqbalance etc
But anyway, my question was more to know if we can hope to have the right settings done in future official release or we will have to either manage it manually or through irqbalance?

I use R4S 4Gb only for 2 docker images (using as managed switch).
What is the best way to divide CPU load in this case?
Do I even need to divide it (I am not using R4S as a router)?

I was thinking something like this:

eth0 IRQ on A53 core - core0 --> I don't use eth0 (deleted wan/wan6)
eth0 queues on A53 core - core1 --> I don't use eth0 (deleted wan/wan6)
eth0 queues on A53 core - core2
eth1 IRQ on A53 core - core3

Docker1 (Unifi Controller) --> cores 0-2 (or 0-3 if I don't need IRQ on separate core)
Docker2 (HomeAssistant) --> cores 4-5

core0 --> docker1 (Unifi), eth0 IRQ (eth0 is not in use)
core1 --> docker1 (Unifi), eth0 queues (eth0 is not in use)
core2 --> docker1 (Unifi), eth1 queues
core3 --> eth1 IRQ (or also with Unifi)
core4 --> docker2 (HA)
core5 --> docker2 (HA)

docker1 (Unifi) - 1.2gb RAM
docker2 (HA) - 2gb RAM

Unifi - 2 AP, 10 devices (6 IoT, 2 phones, 2 notebooks)
HA - 6 IoT devices, 1 integration

My questions:

  1. Does dividing IRQ and queues make sense in my case?
  2. Is CPU dividing ok for these 2 containers (Unifi -> 0-2 or 0-3 and HA 4-5)?
  3. Is RAM dividing ok for these 2 containers (Unifi 1.2gb and HA 2gb)?

Has this changed in official builds? I'm running 22.03-SNAPSHOT r19509 (I built it yesterday), and rps_cpus is seems to be 3f by default now:

root@router:~# cat /sys/class/net/eth0/queues/rx-0/rps_cpus
3f
root@router:~# cat /sys/class/net/eth1/queues/rx-0/rps_cpus
3f
root@router:~#

BTW, just out of curiosity I've decided to compare the NanoPi R4S CPU performance with some other devices I have.

First I tried using openssl speed to do the benchmark, but the results were inconsistent and unreliable - I believe this might be due to the fact that openssl might use some sort of cryto acceleration depending on the SoC and algorithm.

So I decided to use coremark, which is available via opkg install. While it is a single-core benchmark, it gives a good insight about the relative CPU performance. I also installed and used taskset to benchmark both A53 and A72 NanoPi R4S cores. Below are the results of my benchmarks. It is possible to see that the A72 core has basically double the performance compared with the A53 cores.

PS: The Odroid C2 is running Odroid's Linux, while the other devices are running OpenWrt 22.03-SNAPSHOT r19509 (NanoPi) and r19512 (AX6S).

----------------------------------------------------------------------
Device       SoC                Cores       Clock       Coremark 1.0
----------------------------------------------------------------------
Odroid C2    Amlogic S905       4xA53       1.50 GHz      4997.917534
Redmi AX6S   MediaTek MT7622BV  2xA53       1.35 GHz      4681.282671
NanoPI R4S   Rockchip RK3399    4xA53+2xA72 1.4/1.8 GHz   4990.435000 (1)-A53
NanoPI R4S   Rockchip RK3399    4xA53+2xA72 1.4/1.8 GHz  10535.742506 (2)-A72
----------------------------------------------------------------------

(1) A53 core: taskset 0x000000001 coremark
(2) A75 core: taskset 0x000000010 coremark
2 Likes

Idk about this "right settings" situation....

Cause you see, each person will have its own necessity = demanding different settings.

One thing is for sure, the current default for openwrt is enough to do gigabit speed for basic router stuff, but no one would buy a device like this just to do basic router stuff, so yeah default might not be enough and might need adjustments! So, i really don't know if a PR should be made to change anything or not.

Are you using default settings? Or did you change anything before checking those? Ext4 or squashfs?

Anyway i dont see any PR or code changes in openwrt github, that would indicate this behavior tbh.

It could be related to this like i said:

A device like the nanopi r4s as managed swtich? Which has only 2 ports? Why?

Why not install linux with docker and run those, instead of running them using openwrt?

Yes, default settings (of course I changed various configurations after a clean install but I not change anything related to CPU affinity).

I'm using squashfs.

Because I am more familiar with it. I need multiple VLANs and in Openwrt I know how to configure them (container works). I am also not sure how compatible each distro is with R4S and how much (more) resources will it need...

What linux distro would you recommend? Can you help me regarding CPU dividing in my previous post?

Ill flash a 22.03 snapshot on a testing sd card later and ill report back what i find.

1 Like

I stand corrected. I did change one configuration that could have affected this - I have enabled "Packet Steering" (but I have not installed irqbalance).

Sorry for missing this in my previous post.

Reading NanoPi R4S specs I had the understanding that the CPU clocks were supposed to be 1.5GHz for the little cores (A53) and 2.0GHz for the big cores (A72).

However, at least running the official OpenWrt build the clocks seems to be actually 1.4GHz (A53) and 1.8GHz (A72):

root@router:~# cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_max_freq
1416000
1416000
1416000
1416000
1800000
1800000

Is anyone running FriendlyElec just to check if the clocks are the same?

1 Like

That's the official specs by Rockchip

1 Like

@dsouza Like @diizzy said those are official specs for the rk3399, but friendlyelec lists the nano r4s which uses a rk3399 with 1.5 Ghz on the a53 cores and 2.0 Ghz on the a72 cores cause they did a little bit of overclock, in other words, if you use friendlywrt instead of openwrt you will get those clocks as promised by friendlyelec.

BTW some ppl push the rk3399 even higher with 2.2 GHz on the a72 cores and 1.8 GHz on the a53 cores like the chinese with immortalwrt, but than the vcore is high and some ppl say its dangerous whiles others don't!

You can safely use 1.6 Ghz on the a53 cores and 2.0 on the a72 cores and that is what i am using:

3 Likes

Vendors being 'innovative' in the marketing blurbs and inventing cores or 'finding' more MHz out of thin air isn't exactly rare.
…nor would be overclocking.

Can you post info how to change freq (can you do this after build)?

I have a similar setup but I am also using mine as a router. I think you will be fine leaving IRQs and queues on default. If you are only using yours as a controller for other devices, you are not going to be pushing high bandwidth, and SQM is not needed, so your IRQs and queues are going to use very little cpu.

I am running a Unifi controller docker with 1GB ram and the two A72 cpus. I have 3 sites and 6 APs and have never had trouble with it. I set unifi/data/system.properties to allocate less memory by adding the lines "unifi.xms=256" and "unifi.xmx=512"

My 2nd docker is set to 1.5GB plus another 512MB for the database. I originally set it to 2GB + 512MB and would occasionally run out of memory so I brought it down a bit. But I am also running adblock with an XXL list.

I started having problems with docker total memory at 3.5GB, but again that's also with routing + adblock. So I think you will be fine with your proposed setup using 3.2GB total. But again, unifi controller seems to be perfectly happy on 1GB if you adjust the config file. So that would get you down to 3GB which should be very safe.

3 Likes

Ibh, i don't know if you can do that after building! You probably can but i don't know how, since i used a patch while building to do it.