How to reduce CPU usage? (Docker, Raspberry Pi)

593 views
Skip to first unread message

Lindsay Ward

unread,
Mar 30, 2021, 1:14:10 AM3/30/21
to rtl_433
Hi there.
I would like to know how I can reduce CPU usage for my instance of rtl_433 running on my Raspberry Pi.

I have been using rtl_433 for a year or so, listening to my Efergy energy monitor as well as a couple of generic 433 remotes. 
I recently reinstalled my home automation system on my Raspberry Pi 4 using docker and a rtl_433 container built on debian:buster-slim (Dockerfile at bottom), which works well, but with high CPU usage.
My command is like:

rtl_433 -f 433818000 -s 960000 -R 30 -R 36 -R 86 -F mqtt://mosquitto...

(I'm no expert, but this frequency and sample rate catch both the energy monitor and the remotes.)
When I run htop, rtl_433 is almost always the most CPU-intensive... it's at the top!
So, is there any way I can reduce this and still have the system work as expected?
I heard something about compiling with optimising in this issue:  https://github.com/merbanan/rtl_433/issues/47#issuecomment-52392985 but not sure whether I'm already OK or need to do something with that.

Thank you very much!

Dockerfile:
FROM debian:buster-slim
ENV MQTT_ADDRESS mosquitto
ENV MQTT_PORT 1883
ENV MQTT_USER ""
ENV MQTT_PASSWORD ""
ENV MQTT_TOPIC RTL_433
ENV RTL_PARAMS "-C si"
RUN apt-get update && apt-get install -y git libtool libusb-1.0.0-dev librtlsdr-dev rtl-sdr cmake automake && \
git clone https://github.com/merbanan/rtl_433.git /tmp/rtl_433 && \
cd /tmp/rtl_433/ && \
mkdir build && \
cd build && \
cmake ../ && \
make && \
make install
CMD ["sh", "-c", "rtl_433 ${RTL_PARAMS} -F mqtt://${MQTT_ADDRESS}:${MQTT_PORT},events=${MQTT_TOPIC},user=${MQTT_USER},pass=${MQTT_PASSWORD}"]

Lindsay Ward

unread,
Mar 30, 2021, 1:42:01 AM3/30/21
to rtl_433
A bit more info:
I tried it without specifying the frequency and sample rate. It doesn't catch my signals at all, but the CPU usage is about 17-25%.
With the working -f and -s options as above, the usage is about 55-80%.

Christian Z.

unread,
Mar 30, 2021, 2:14:21 AM3/30/21
to rtl_433
Using -R, like you do, and then picking the lowest working sample rate, is ideal.

- samplerate equals the processing load, default is 250k
- if the selected -R don't use the FSK (pseudo-FFT) demod then only OOK (envelope only) will run -- a much lighter load.

Reply all
Reply to author
Forward
0 new messages