Systen gets very slow / IO wait time

Please reproduce your error on a second machine before posting, and check the error by running without saved changes or extra modules (See FAQ No. 13, "How to report a bug"). For unstable Porteus versions (alpha, beta, rc) please use the relevant thread in our "Development" section.
Post Reply
User avatar
Rava
Contributor
Contributor
Posts: 1319
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 3.1.0 x86-64 XFCe
Location: Germany

Systen gets very slow / IO wait time

Post#1 by Rava » 07 Dec 2013, 01:00

My issue, on my single core non 64 bit Samsung Q40 sup notebook...

After a while, after days of suspend and working and suspend, and firing it up again, the system gets slower and slower, up to the point it seems not to react at all.
First it helps to just kill all Firefox'es, but later I need to kill and re-start X to get back it's initial performance. O__o


All I could figure out is, that it must be some IO issue. The 3rd line when running top, the one starting with Cpu(s), lists about 70 to 90% of wa, I googeled that, and it means the waiting time for IO is too long, one discussion thread meant that the system resources are to much used, and therefore the IO wait time got from, like factor 2 (when 50% of system resources are used), to 50 and up to 100... (when 95% are used)
It was about a server in that thread, and on that machine I not even run Thunderbird any more on that machine, cause it has a too weak CPU and not enough RAM for FFx and Thunderbird...

How can I figure out which process might be the one doing it?
Cheers!
Yours Rava

User avatar
fanthom
Site Admin
Site Admin
Posts: 4623
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland, currently - Cork, IE
Contact:

Re: Systen gets very slow / IO wait time

Post#2 by fanthom » 07 Dec 2013, 03:38

@Rava
please post the screenshot from 'top' showing all processes.
also - install 'iotop' (need python) and check if you can get something useful from it.
Please add [Solved] to your thread title if the solution was found.

cttan
Shogun
Shogun
Posts: 332
Joined: 26 Jan 2011, 16:15
Distribution: Porteus 3.2 64bit KDE
Location: Malaysia

Re: Systen gets very slow / IO wait time

Post#3 by cttan » 07 Dec 2013, 15:47

Hi Rava,

I do a lot of sleep and wake as well using my laptop.

I keep the system going by clearing the memory. I did swapoff and swapon.
Some program will tend to have memory leaks. I observed that Qbittorrent is one such program.
Just delete the downloaded files and do a swapoff and swapoff and you are OK.

If the system still felt slow, I will do a telinit 3 && telinit 4 from the terminal if you still can reach your script or terminal.
If system freeze use Ctrl-Alt-Bksp and re-login to X again.
Last edited by cttan on 09 Dec 2013, 03:09, edited 1 time in total.

User avatar
fanthom
Site Admin
Site Admin
Posts: 4623
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland, currently - Cork, IE
Contact:

Re: Systen gets very slow / IO wait time

Post#4 by fanthom » 07 Dec 2013, 21:07

@cttan
good point. i would also add 'echo 3 > /proc/sys/vm/drop_caches' command to a script which runs before laptop goes sleep or wakes up (which ever works better). more info at Arch wiki:
https://wiki.archlinux.org/index.php/Pm ... _own_hooks
Please add [Solved] to your thread title if the solution was found.

User avatar
Rava
Contributor
Contributor
Posts: 1319
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 3.1.0 x86-64 XFCe
Location: Germany

Re: Systen gets very slow / IO wait time

Post#5 by Rava » 08 Dec 2013, 05:25

fanthom wrote:@cttan
good point. i would also add 'echo 3 > /proc/sys/vm/drop_caches' command to a script which runs before laptop goes sleep or wakes up (which ever works better)
Where do I place such a script?
cttan wrote:I keep the system going by clearing the memory. I did swapoff and swapoff.
This I will put in the same script. :)
Cheers!
Yours Rava

cttan
Shogun
Shogun
Posts: 332
Joined: 26 Jan 2011, 16:15
Distribution: Porteus 3.2 64bit KDE
Location: Malaysia

Re: Systen gets very slow / IO wait time

Post#6 by cttan » 09 Dec 2013, 03:12

Thanks fanthom. Great suggestion. Has been looking for such command that clears up the cache.

@Rava, typo error. Correction made. Should be swapoff and then swapon.

User avatar
Rava
Contributor
Contributor
Posts: 1319
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 3.1.0 x86-64 XFCe
Location: Germany

Re: Systen gets very slow / IO wait time

Post#7 by Rava » 09 Dec 2013, 05:42

Thanks for the correction, cttan.

Do you know where to put such a script for suspend?
Cheers!
Yours Rava

cttan
Shogun
Shogun
Posts: 332
Joined: 26 Jan 2011, 16:15
Distribution: Porteus 3.2 64bit KDE
Location: Malaysia

Re: Systen gets very slow / IO wait time

Post#8 by cttan » 09 Dec 2013, 07:04

You run the command whenever your system feel sluggish.

Here is a one liner with fanthom suggestion as well:-
free && swapoff -a && swapon /mnt/<your swap drive>/<your swap file> && swapon -p 100 /dev/zram0 && echo 3 > /proc/sys/vm/drop_caches && free

Swap on the zram should be quite standard on x64 but maybe you need to adjust the size.

User avatar
fanthom
Site Admin
Site Admin
Posts: 4623
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland, currently - Cork, IE
Contact:

Re: Systen gets very slow / IO wait time

Post#9 by fanthom » 09 Dec 2013, 21:35

Do you know where to put such a script for suspend?
see Arch wiki link i posted above and let us know if it worked for you (never tried myself).
Please add [Solved] to your thread title if the solution was found.

User avatar
Rava
Contributor
Contributor
Posts: 1319
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 3.1.0 x86-64 XFCe
Location: Germany

Re: Systen gets very slow / IO wait time

Post#10 by Rava » 13 Dec 2013, 15:13

cttan wrote:Swap on the zram should be quite standard on x64 but maybe you need to adjust the size.
How to calculate the size? Is there a rule of thumb? Like, 33% of physical RAM or such?
fanthom wrote:see Arch wiki link i posted above and let us know if it worked for you (never tried myself).
I sure will!
Cheers!
Yours Rava

cttan
Shogun
Shogun
Posts: 332
Joined: 26 Jan 2011, 16:15
Distribution: Porteus 3.2 64bit KDE
Location: Malaysia

Re: Systen gets very slow / IO wait time

Post#11 by cttan » 14 Dec 2013, 14:41

Hi Rava,

I am not sure of any rule around. Try to tweak your system to your liking.

I have 4GB RAM and I use copy2ram option. I am using ramsize=75% zram=25%

User avatar
Rava
Contributor
Contributor
Posts: 1319
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 3.1.0 x86-64 XFCe
Location: Germany

Re: Systen gets very slow / IO wait time

Post#12 by Rava » 15 Dec 2013, 15:32

I created this script:

Code: Select all

#!/bin/bash
# info and swap clearing script for hibernate / suspend 
# put this file into  /etc/pm/sleep.d/
# by Rava, V0.0
# sources:	https://wiki.archlinux.org/index.php/Pm-utils#Creating_your_own_hooks
# other:	cttan / fanthom: http://forum.porteus.org/viewtopic.php?f=117&t=2895&p=20208#p20075
SWAPFILE=/mnt/sda1/.MYLINUXSWAPFILE
case $1 in
    hibernate)
		free && swapoff -a && swapon $SWAPFILE && swapon -p 100 /dev/zram0 && echo 3 > /proc/sys/vm/drop_caches && free
        echo "/etc/pm/sleep.d/77_pm-hibernate.suspend : Going to suspend to disk!"
    ;;
    suspend)
		free && swapoff -a && swapon $SWAPFILE && swapon -p 100 /dev/zram0 && echo 3 > /proc/sys/vm/drop_caches && free
        echo "/etc/pm/sleep.d/77_pm-hibernate.suspend : Going to suspend to RAM!"
    ;;
    thaw)
        echo "/etc/pm/sleep.d/77_pm-hibernate.suspend : Suspend to disk is over, we are resuming..."
    ;;
    resume)
        echo "/etc/pm/sleep.d/77_pm-hibernate.suspend : Suspend to RAM is over, we are resuming..."
    ;;
    *)  echo "/etc/pm/sleep.d/77_pm-hibernate.suspend : A script or user is calling me totally wrong. The given parameter was: $1"
    ;;
esac
but, unlike what it says on the wiki page, I don't find any info if it is really run when going into suspend or hibernate...

I called it 77_pm-hibernate.suspend ... I am free to name it how I like, yes?
And it's rwx for root...

How to check if it's really run? Do I need to tweak another linux system file to actually run my script on suspend/hibernate/wakeup? O___o
Last edited by Rava on 17 Dec 2013, 05:34, edited 1 time in total.
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 1319
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 3.1.0 x86-64 XFCe
Location: Germany

Re: Systen gets very slow / IO wait time

Post#13 by Rava » 17 Dec 2013, 05:32

Update

I did a minor change to the script, changing the 'echo "' parts into 'logger "':

Code: Select all

#!/bin/bash
# info and swap clearing script for hibernate / suspend 
# put this file into  /etc/pm/sleep.d/
# by Rava, V0.1
# sources:	https://wiki.archlinux.org/index.php/Pm-utils#Creating_your_own_hooks
# other:	cttan / fanthom: http://forum.porteus.org/viewtopic.php?f=117&t=2895&p=20208#p20075
SWAPFILE=/mnt/sda1/.MYLINUXSWAPFILE
case $1 in
    hibernate)
		free && swapoff -a && swapon $SWAPFILE && swapon -p 100 /dev/zram0 && echo 3 > /proc/sys/vm/drop_caches && free
        logger "/etc/pm/sleep.d/77_pm-hibernate.suspend : Going to suspend to disk!"
    ;;
    suspend)
		free && swapoff -a && swapon $SWAPFILE && swapon -p 100 /dev/zram0 && echo 3 > /proc/sys/vm/drop_caches && free
        logger "/etc/pm/sleep.d/77_pm-hibernate.suspend : Going to suspend to RAM!"
    ;;
    thaw)
        logger "/etc/pm/sleep.d/77_pm-hibernate.suspend : Suspend to disk is over, we are resuming..."
    ;;
    resume)
        logger "/etc/pm/sleep.d/77_pm-hibernate.suspend : Suspend to RAM is over, we are resuming..."
    ;;
    *)  logger "/etc/pm/sleep.d/77_pm-hibernate.suspend : A script or user is calling me totally wrong. The given parameter was: $1"
    ;;
esac
It logs just OK, so I presume it did it's on liner as well, as seen by the log info about the swap space:

Code: Select all

Dec 16 07:09:25 porteus -- MARK --
Dec 16 07:20:04 porteus NetworkManager[1742]: <info> sleep requested (sleeping:
no  enabled: yes)
Dec 16 07:20:04 porteus NetworkManager[1742]: <info> sleeping or disabling...
Dec 16 07:20:04 porteus NetworkManager[1742]: <info> (eth0): device state change: activated -> unmanaged (reason 'sleeping') [100 10 37]
Dec 16 07:20:04 porteus NetworkManager[1742]: <info> (eth0): deactivating device (reason 'sleeping') [37]
Dec 16 07:20:04 porteus dhcpcd[20357]: received SIGTERM, stopping
Dec 16 07:20:04 porteus dhcpcd[20357]: eth0: removing interface
Dec 16 07:20:04 porteus NetworkManager[1742]: <info> (eth0): canceled DHCP transaction, DHCP client pid 20357
Dec 16 07:20:04 porteus NetworkManager[1742]: <info> (eth0): cleaning up...
Dec 16 07:20:04 porteus NetworkManager[1742]: <info> (eth0): taking down device.Dec 16 07:20:04 porteus dbus[1238]: [system] Activating service name='org.freedesktop.nm_dispatcher' (using servicehelper)
Dec 16 07:20:04 porteus dbus[1238]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Dec 16 07:20:13 porteus kernel: [37867.006879] Adding 740308k swap on /mnt/sda1/.MYLINUXSWAPFILE.  Priority:-1 extents:2 across:745824k
Dec 16 07:20:13 porteus kernel: [37867.009077] Adding 617524k swap on /dev/zram0.  Priority:100 extents:1 across:617524k SS
Dec 16 07:20:13 porteus logger: /etc/pm/sleep.d/77_pm-hibernate.suspend : Going to suspend to RAM!
and when reuming, it also logs just OK:

Code: Select all

Dec 17 05:12:18 porteus logger: /etc/pm/sleep.d/77_pm-hibernate.suspend : Suspend to RAM is over, we are resuming...
So, seems all is well now, my script works, thanks to you cttan & fanthom, and thanks for the ones who wrote the wiki article...

It now takes a little while longer to shut down for suspend to RAM, but not annoyingly so...
Cheers!
Yours Rava

Post Reply