This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Best strategy to identify cause for large swap - or whatever it is that's making the system sluggish

cbhcbh Member
edited December 2017 in Questions & Help
Hi,
noticed my system is building a large swap file - and it seems like the system is congested from time to time.
Homey fw 1.5.6-rc7
All apps updated to newest version (beta in case that's available)


Looked at the z-wave log at developer.athom.com and Homey Logger in order to identify processes "running wild" - but it is somewhat difficult to figure out when much is too much...

Any advice on how the best way is to identify the cause?
Disabling all apps and then enable them each after each and see what happens?
Same strategi for flows?
Or something else?
All suggestions welcome!

Regards,
Chr.

Comments

  • canedjecanedje Member
    edited December 2017
    In this  discussion (see link) there is a solution to write a script for checking every night and if swap file is above 150Mb it will restart your Homey.
    For me it workes fine:
    https://forum.athom.com/discussion/comment/64670/#Comment_64670
  • Thanks - actually, I already tried it.
    However, if possible, I'd like to find the cause and look into the origin instead of having to reboot the system frequently...
  • cbh said:
    Thanks - actually, I already tried it.
    However, if possible, I'd like to find the cause and look into the origin instead of having to reboot the system frequently...
    I agree. I will follow this item to hopefully find a solution.
    my Homey did crash already once because of the swap size (i think)
  • tb1962tb1962 Member
    edited December 2017
    @cbh and @canedje

    You can loop through the installed apps like this:
    const apps = await Homey.apps.getApps( );
    
    let totalSwap = 0;
    _.forEach(apps, (app) => {
        totalSwap += app.usage.swapPss;
        console.log(app.id + ', pss: ' + app.usage.pss  + ', swapPss: ' + app.usage.swapPss + ', mem: ' + app.usage.mem + ', total: ' + (app.usage.swapPss + app.usage.pss));
    
        //console.log(a);
    })
    console.log('totalSwap: ' + (totalSwap / (1024*1024)) + 'MB')

    Now, i'am a little unsure what the meaning is of swapPss and pss. But as you can see the total of these values equals <mem>

    The last line (totalSwap is not the same as the swap you see in the system page. This is because this code only count the installed apps, not swap space used by Homey itself

    swapPss has something to do with swap space usage. Maybe someone knows enough from linux to explain what this is?



  • djeskodjesko Member
    edited December 2017
    when i asked about this before i got this link  https://www.linuxatemyram.com

    my swap is 300 and is running fine 


  • app.usage.pss + app.usage.swapPss is the same as app.usage.mem and (app.usage.mem / (1000*1000)) is the same as memory usage given per app on the system page. So I think swappPss is nothing special. It is the swap usage in bites. I was a bit misleaded by this info: https://stackoverflow.com/questions/9922928/what-does-pss-mean-in-proc-pid-smaps wich i did not understand completly
  • Well, even if https://www.linuxatemyram.com/ says my RAM is fine, the problem still is, that somethings going on at the system is getting sluggish...
    It might be, that the size of the swap file isn't part of the problem, only a symptom and that rebooting cleans up stuff - and that is just a co-incidental thing with the swap file - and that's fine with me - wich leaves me to rephrase the question:
    Best strategy to identify cause for large swap - or whatever it is that's making the system sluggish?
  • @cbh

    Well, another thing you could look at is de app.usage.cpu. This value should be as low as possible (between 0... 1) but it can be more than 1. That doesn't have to be a bad thing but if that's for a longer periode of time maybe you should restart that app.

    In Settings -> System -> Stuff for geeks there is a loadavg. This shows 3 values. The first is the current cpu load and the last is the average for the last 15 minutes. You could also take a look at these values.


Sign In or Register to comment.