Systen gets very slow / IO wait time
- Rava
- Contributor
- Posts: 4650
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.0 x86_64 + 4.0 i586
- Location: Forests of Germany
Systen gets very slow / IO wait time
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?
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
Yours Rava
- fanthom
- Moderator Team
- Posts: 5591
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Re: Systen gets very slow / IO wait time
@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 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.
-
- Shogun
- Posts: 333
- Joined: 26 Jan 2011, 16:15
- Distribution: Porteus 3.2 and 4.0 64bit KDE
- Location: Malaysia
Re: Systen gets very slow / IO wait time
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.
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.
- fanthom
- Moderator Team
- Posts: 5591
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Re: Systen gets very slow / IO wait time
@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
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.
- Rava
- Contributor
- Posts: 4650
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.0 x86_64 + 4.0 i586
- Location: Forests of Germany
Re: Systen gets very slow / IO wait time
Where do I place such a script?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)
This I will put in the same script.cttan wrote:I keep the system going by clearing the memory. I did swapoff and swapoff.

Cheers!
Yours Rava
Yours Rava
-
- Shogun
- Posts: 333
- Joined: 26 Jan 2011, 16:15
- Distribution: Porteus 3.2 and 4.0 64bit KDE
- Location: Malaysia
Re: Systen gets very slow / IO wait time
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.
@Rava, typo error. Correction made. Should be swapoff and then swapon.
- Rava
- Contributor
- Posts: 4650
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.0 x86_64 + 4.0 i586
- Location: Forests of Germany
Re: Systen gets very slow / IO wait time
Thanks for the correction, cttan.
Do you know where to put such a script for suspend?
Do you know where to put such a script for suspend?
Cheers!
Yours Rava
Yours Rava
-
- Shogun
- Posts: 333
- Joined: 26 Jan 2011, 16:15
- Distribution: Porteus 3.2 and 4.0 64bit KDE
- Location: Malaysia
Re: Systen gets very slow / IO wait time
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.
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.
- fanthom
- Moderator Team
- Posts: 5591
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Re: Systen gets very slow / IO wait time
see Arch wiki link i posted above and let us know if it worked for you (never tried myself).Do you know where to put such a script for suspend?
Please add [Solved] to your thread title if the solution was found.
- Rava
- Contributor
- Posts: 4650
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.0 x86_64 + 4.0 i586
- Location: Forests of Germany
Re: Systen gets very slow / IO wait time
How to calculate the size? Is there a rule of thumb? Like, 33% of physical RAM or such?cttan wrote:Swap on the zram should be quite standard on x64 but maybe you need to adjust the size.
I sure will!fanthom wrote:see Arch wiki link i posted above and let us know if it worked for you (never tried myself).
Cheers!
Yours Rava
Yours Rava
-
- Shogun
- Posts: 333
- Joined: 26 Jan 2011, 16:15
- Distribution: Porteus 3.2 and 4.0 64bit KDE
- Location: Malaysia
Re: Systen gets very slow / IO wait time
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%
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%
- Rava
- Contributor
- Posts: 4650
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.0 x86_64 + 4.0 i586
- Location: Forests of Germany
Re: Systen gets very slow / IO wait time
I created this script:
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
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
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
Yours Rava
- Rava
- Contributor
- Posts: 4650
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.0 x86_64 + 4.0 i586
- Location: Forests of Germany
Re: Systen gets very slow / IO wait time
Update
I did a minor change to the script, changing the 'echo "' parts into 'logger "':
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:
and when reuming, it also logs just OK:
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...
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
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!
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...
It now takes a little while longer to shut down for suspend to RAM, but not annoyingly so...
Cheers!
Yours Rava
Yours Rava