Announcement

Collapse
No announcement yet.

High cpu usage

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    High cpu usage

    Hi Stef,

    I have seen a significant change in the cpu time used by the plugin that is 3 times more than before.
    I am not sure of the exact date but it is happening since 1-2 months. At that time it was a little lower than the jowihue plugin. It has also doubled the cpu time used by hs4 main process (i.e HSConsole.exe)


    Do you know anything that could cause that issue? I do not use any premade json file, my files are all customs. I also didn’t add any new device via this procedure since at least 4 months . I also use the trigger and action of the plugin in my events.

    If you need my .json files I can send them to you via pm/email.
    ——

    The other issue ( but maybe it is not ; and maybe we should focus on the first one in this thread) is that I think mqtt should use very little cpu ? Maybe more in line with the easytrigger ( I use that plugin a lot) plugin?



    thank you !!!

    Attached Files

    #2
    Hi! Yes, I see something similar on my system. Hadn't noticed before. I will look into it as soon as I have the time. Thanks!
    stefxx

    Comment


      #3
      I did some testing, and I noticed two things:

      - There is a direct relation between the CPU load and the number of devices configured. Off course that is exactly how it should be, but I also noticed that when no MQTT messages are coming in, the plugin CPU usage goes down to (nearly) 0%. So far so good. This also means no strange loops etc causing this.
      - The longer the plugin runs, the more CPU it consumes. Needs more testing, but there might be something here.

      So, how many MQTT devices and features do you have? And when you restart the plugin, does it indeed consume less CPU (after initial initialization) the first few hours?
      stefxx

      Comment


        #4
        I am currently testing 4.0.5.1 beta on my own system, where I have fixed an issue that would duplicate the internal MQTT device table every 12 hours. This might explain the high CPU.

        Feel free to help me testing!
        stefxx

        Comment


          #5
          Hi Stef,

          the issue is still there .

          Restarting the plugin makes no difference with the beta. I have set 42 features with the plugin (11 devices). I have made no change to any config since 3-4 month and the issue was not there (at least not as high) two months ago.The only change I made is add event triggers and actions based on mqtt topics. I had somewhat the exact same setup on mcsmqtt and the plugin used very little cpu.

          Comment


            #6
            I have turned on debug 2 or 3 time last month, but didn,t see anything spécial. I will try again ( or maybe you can send me a version with more debug).

            Comment


              #7
              11 devices is nothing, I have about 100 devices with over 600 features. So that should not be an issue.

              What happens if you disable event processing (in setup, disable "Enable Event Processing")? If that causes a drop in CPU usage for the plugin, that is a clear indication where to look for the issue.

              In the meantime I will look at event triggers and actions today, maybe I spot something obvious...
              stefxx

              Comment


                #8
                Thanks will try!

                Comment


                  #9
                  Disabled the event system but the issue is still there.

                  I see the cpu % going to 10% every 2-3 seconds

                  Comment


                    #10
                    Ok, so event triggers do not seem to cause this. I will look further. Thanks for testing.
                    stefxx

                    Comment


                      #11
                      Can you test beta 4.0.5.2?

                      Note that if you make changes to event triggers, you will have to restart the plugin (for now).
                      stefxx

                      Comment


                        #12
                        Hi Stef, unfortunately I see the same cpu usage with this beta.
                        I saw this in the log, is that only code transferred from the lgthinQ plugin?
                        Attached Files

                        Comment


                          #13
                          I think the issue lies in the link with the mqtt server.

                          If i set the mqtt server to a random ip , the issue ‘’disappear’’ .


                          Edit : Same issue if I disable mosquitto and use nodered mqtt server instead.

                          Comment


                            #14
                            Ok, it seems the plugin process the every payload sent to the broker. Even if it is a topic not configured into the plugin.

                            Would it be possible to completely isolate the plugin from the topic it does not listen too? I think that should resolve the issue.

                            edit: not sure. I need to try something first.

                            edit 2: Creating another daemon/service for mosquitto allowed me to isolate traffic. The cpu usage of the plugin is now a lot lower. I will keep that setup (mosquitto is not ressource heavy), but that confirms the plugin is processing everything that the broker receive (and maybe its own devices/topics it controls).

                            --

                            Server is up since 120 minutes: From the capture here, the plugin is receiving everything from mosquitto.conf process, and nothing from mosquitto1.conf
                            Attached Files

                            Comment


                              #15
                              Originally posted by pistacheL0 View Post
                              I saw this in the log, is that only code transferred from the lgthinQ plugin?
                              Yeah I guess the copy monster was here
                              stefxx

                              Comment

                              Working...
                              X