NanoPi R4S-RK3399 is a great new OpenWrt device

Well, I understand your point but it's irrelevant as I suspect the majority here have already bought it.

2 Likes

No, my topology is
ISP -> NanoPi_R4S -> MikroTik CSS610-8G-2S -> TP-LINK EAP 225 Wifi-AP (about 15 wifi devices) + my PC + bunch of SBC "servers"
R210II was used instead of R4S

MikroTik CSS610-8G-2S is swOS lite only device. It can work only as a managed switch.

I advise you go elsewhere then. You are not the end user for this device Nor are you here for advice. If you wish to use vastly powersucking devices to run your infrastructure that is your choice. You are derailing the thread and your "advice" is unwanted.

1 Like

Its not switch os, its swOS lite.It does not allow routing.


You are comparing 100$ switch to $650 "cloud" switch/router

1 Like

you're just a troll is what you are.

2 Likes

Don't feed.
Plz keep focus on the goal of the thread: share xp, knowledge and tips as gentlemens do.

3 Likes

Hi. Why are your Dockers limited to cpus 4-5?

Its the A72 cores, if you read his posts, he tells us that the applications are more "responsive" when using the a72 cores.

1 Like

My internet is only 100mb so the A53 cores can easily handle all the networking. I run docker on the A72 cores because I have it doing motion detection on security cameras. As long as my internet stays below 800mb or so, this setup should work. But if I upgrade to gigabit I will need the A72 cores for networking and move docker to A53.

I’m still confused on how to assign cpu cores. I want to assign the low power cores 0-3 only to docker apps with the high power cores 4-5 for everything else. Is there an easy guide on how to do this?

https://openwrt.org/toh/friendlyarm/nanopi_r4s_v1#cpu_management - right there on the wiki.

(edit)
My bad. i misread. You want this from the docker docs.

https://docs.docker.com/config/containers/resource_constraints/#configure-the-default-cfs-scheduler - Specifically the option below:

--cpuset-cpus Limit the specific CPUs or cores a container can use. A comma-separated list or hyphen-separated range of CPUs a container can use, if you have more than one CPU. The first CPU is numbered 0. A valid value might be 0-3 (to use the first, second, third, and fourth CPU) or 1,3 (to use the second and fourth CPU).

I’ve tried using cpuset. I was wondering how walmartshopper was isolating cpus from docker and everything else. If there is a easy way of doing? Ill keep experimenting, that’s that fun part I guess :joy:

1 Like

What do you think is the maximum number of cameras that can be connected when running with your setup (fps, the cores that you use)?

I'm using cpuset: 4-5 in my docker-compose.yml and I put the networking IRQs and queues on cores 0-3. The docker cores are not necessarily isolated for docker only... other system processes like luci might still use them. In your case, you could use cpuset: 0-3 in docker and put networking IRQs and queues on 4-5. Cores 4-5 alone should be enough for networking unless you have symmetrical gigabit, in which case they can struggle a bit if both directions are loaded.

1 Like

It's hard to say since it will vary a lot depending on the resolution, fps, motion detection settings, buffer sizes, and how much cpu power you need to leave for your networking.

I am currently running one 1080p camera and doing motion detection on 90% of the frame. Docker is set to only use the A72 cores. Here are my load stats for reference:

  • 5 fps: cpu load 20% and 25%
  • 10 fps: cpu load 25% and 40%
  • 20 fps: cpu load 40% and 50%
  • my buffer size is 46-92 frames and memory usage for the one camera is 600MB-1.25GB
  • total memory usage for the zoneminder container is currently 1.25GB plus another 200MB for the mariadb container

Using only the A72 cores for cameras, I would estimate you might be able to run three 1080p cameras at 5 fps, two 1080p cameras at 10fps, or one 1080p camera at 20-30fps. If you allowed docker to use some of the A53 cores, you could bump up those numbers.

Using only two A53 cores, I would probably drop the numbers by one camera at each framerate, so 2@5fps or 1@10-15fps.

If you use all cores, you could increase the numbers a bit, but you might run out of ram before you run out of cpu. For example, five 1080p cameras with a buffer size of 46 frames would use 3GB, plus with the PHP and mariadb processes, you would already be close to using all 4GB of ram. If you still had some cpu power to spare at that point, you could bump up the fps to use more cpu without increasing memory usage.

720p cameras would be about the half the pixels, so you could probably roughly double the numbers above. I would guess you could do somewhere around a maximum of 10 720p cameras if you keep the fps low and use all the cores.

Again, my estimates are based on what I've seen with 1 camera. I know the memory usage per camera is fairly predictable based on resolution and buffer size, but I'm not sure how well the cpu usage scales, especially if you have more cameras than cores. If it doesn't scale well, then maybe it would be more like 4 1080p cameras or 6 720p cameras.

Sorry I can't give you better numbers, but hopefully that helps.

Definitely, thanks a lot! I've ordered a R4S and I'll check your config with my 1080p cams when it arrives, provided that I can copy your setup.

Forgot to mention, I'm running the OC patch at 2.2 / 1.8ghz which might make a slight difference vs stock. Here is my docker-compose.yml for reference... you may want to tweak cpuset and memory limits:

version: '3.6'

services:
  # !! WARNING: !!
  # If using linuxserver/mariadb, you will need to add
  # skip-log-bin to mysqld and disable all log_bin options
  db:
    image: mariadb
    restart: always
    networks:
      - zoneminder
    volumes:
      - ./zm/db:/var/lib/mysql
    environment:
      - MYSQL_DATABASE=zm
    env_file:
      - ./.env

  zoneminder:
    image: ghcr.io/zoneminder-containers/zoneminder-base:1.36.12
    restart: always
    stop_grace_period: 45s
    depends_on:
      - db
    mem_limit: '2560M'
    shm_size: '1536M'
    cpuset: 4-5
    ports:
      - 18580:80
    networks:
      - zoneminder
    volumes:
      - ./zm/data:/data
      - ./zm/config:/config
      - ./zm/log:/log
      - type: tmpfs
        target: /dev/shm
        tmpfs:
          size: 1000000000
    env_file:
      - ./.env
#    environment:
#      - ZM_SERVER_HOST=zoneminder1


networks:
  zoneminder:

Hello to all!
Have R4S 4GB. Used image from @anaelorlinski
have some issue with LUCI and IPSec tab at VPN section

@anaelorlinski wrote that we haven't package for strongswan and LUCI.

I fell back to using the friendlywrt build. The snapshots were always cause some little issues that annoyed me. This build does everything I needed and so far completely stable. Taxing cpu for 12+ hrs at a time, no issues. And no problems with ntfs usb storage either