craftbeerpi / craftbeerpi4

GNU General Public License v3.0
134 stars 83 forks source link

About the problem of abnormal display after adding icons to the homepage #85

Closed jsbjx closed 2 years ago

jsbjx commented 2 years ago

During the debugging phase, it often shuts down abnormally. After adding the icon, the system reacts very slowly. Real-time temperature data can be updated within 10-20 seconds. You can only use it by deleting the icon. Try to add the chart again today. The curves are not displayed, and then go to the Analytics menu to clear all the data. A miracle happened, the curve on the page can be displayed, and the real-time data can be updated normally. Analysis of the cause of the problem: The system keeps recording data when it is turned on, resulting in huge data. There is also an abnormal shutdown that leads to database damage. Cause the system to be abnormal solution:

  1. Go to the Analytics menu every time you use it and clear all data. Perfect solution: ask the developer to modify the software
  2. After power on, no data is recorded when it is not working.
  3. After starting Mosh Steps, perform all data clearing. Then start recording data (don't record irrelevant data such as fermentation data, etc.) after the work is completed, stop recording and save a file.
  4. It would be better if the saved file can be loaded and reproduced.

I used 16 sensors on cbpi3 today, a few hours after I started it. View curve is not displayed. However, it can be displayed in a browser via a PC via a network. Is there too much data to process?

avollkopf commented 2 years ago

I assume you are talking about the situation where you have added one or more charts to a dashboard.

I just looked briefly into it and can confirm that also my Pi4B is becomming unresponsive if I add one chart.

The main issue is that for each chart up to 4 Mb will be read, merged and converted per diagram you add to a dashboard. I have tested that with one chart and added some log events to the logfile controller:

2021-12-06:17:56:25,380 INFO     [log_file_controller.py:39] Start Log for CFHCsGHzKJEcHU5F92RLwx
2021-12-06:17:56:30,744 INFO     [log_file_controller.py:73] Read all files for {'CFHCsGHzKJEcHU5F92RLwx'}
2021-12-06:17:56:30,836 INFO     [log_file_controller.py:77] Sampled now for {'CFHCsGHzKJEcHU5F92RLwx'}
2021-12-06:17:56:30,876 INFO     [log_file_controller.py:91] Send Log for {'CFHCsGHzKJEcHU5F92RLwx'}

As you can see, reading the log files (in this example a bit more than 3 Mb) consumes most of the time: 5 seconds. This operation is done with the pandas package that merges in this case all 4 log files and converts them into sort of an array.

This operation drives the CPU load to ~100% and the system becomes unresponsive.

  PID USER      PR  NI   VIRT    RES    SHR  S  %CPU   %MEM  ZEIT+    BEFEHL
 2426 root      20   0  165360  70280  22808 R  103,3   3,7  0:14.45  cbpi

The subsequent operations are pretty fast. However, I think the chart function is not really recommended to be used in a dahsboard where you also want to operate kettles. I think, it has been only tested on a PC/Mac during development where CPU power might be sufficent.

The only recommendation for now is to use the analytics page.

avollkopf commented 2 years ago

Chart functions won't be changed at this point of time