Why Raspberry pi becomes slow while running for a long time?

Oh, following my number 1 rule... Know what you don't know... We suspect this is a resource problem. So I would do the following:

  1. using top, atop, or whatever, watch the 4 big resources, CPU, memory, disk IO and network IO. These 4 are often the clue that shows the light at the end of the tunnel. Resource consumption often has a cascade affect, not effect. Such as when memory use is extreme, there is a following disk IO increase as SWAP is engaged (significantly).

  2. Watch dmesg... watch for driver, device, component errors or warnings. At times, components of the OS or even the hardware can do odd things, this might be the case here, given the issue consistently happens after a relatively consistent time period after the last restart, if I recall right?

This situation reminds me how we could find why a given virtual machine was not behaving like we expected after we migrated applications from a physical server to a virtual server. The cause was at times pretty odd once we found it.

There was one time when I discovered a a specific code function in an application that on hardware worked fine, but same lines of code, in a virtual machine was slow beyond belief. The developer denied that it was the code for months, I found it using the above methods, in less than 1 day... the developer finally accepted the test results, reworked the function, and 2 days later, the application was just about as fast on a virtual machine, as full hardware.

Months of wasted time because the analysis team believed it was a OS or virtualized hardware/driver issue. The assumption was wrong, and because the developer refused to do time/speed validation. Moreover, my peers, get pain from me... because they did not do the first rule... know what you don't know. They assumed the developer declaration that the code can't run different on a virtual machine as hardware was true.

You just don't know where the evidence is going to lead you. :slight_smile:

I have had this happen when using charts. Charts plot many point and over time those point start hogging resources. Try disabling the charts to see if that solves it.
I try to write data to the charts once every 10 minutes or even once an hour if possible to avoid massive data point being stored on the charts.
Grafana might also be your solution, it stores data point in a data base so you won't be trying to store all those data point in the browser's ram allotment.

Just last night... I got my first ever... "Not Enough Memory..." warning from the dashboard. Never seen it before, and it was on a Pi3, that I had a LOT of demanding flows on.

Thank you all guys. The problem is solved (Still under observation). I have done several changes.
First, I removed the chart ( I think, this was the main reason).
Secondly, I have disabled the desktop. Now node-RED running on startup.
Thirdly, I added some extra Swap space.
My previous Flows and some more details can be found in the link.
And the video documentation is here: https://youtu.be/Tg_MPyfzhts
Thanks for the support.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.