HowTo Improve system responsiveness [tweak] (liquorix)

Archived topics about LMDE 1 and LMDE 2
Locked
kwevej

HowTo Improve system responsiveness [tweak] (liquorix)

Post by kwevej »

Under high I/O loads, this seems to improve the desktop reactions:

Code: Select all

 su
echo 'vm.swappiness=10' >> /etc/sysctl.conf
echo 'vm.vfs_cache_pressure=1000' >> /etc/sysctl.conf
echo 'vm.dirty_background_ratio=10' >> /etc/sysctl.conf
echo 'vm.dirty_ratio=30' >> /etc/sysctl.conf
sysctl -p
You can invoke high hdd activity by:

Code: Select all

dd if=/dev/zero of=tmp bs=1024k count=1024
Don't forget to delete the tmp file.


Try to interact with your desktop under high HDD act. before applying the 'tweak' and after. (needs reboot)

It worked for me.
It is intended for liqorix users, but it could help vanilla kernel users as well, I guess


Source: http://forums.debian.net/viewtopic.php? ... 20#p313472

EDIT: A good test seems to be just opening the home folder in Nautilus during the load.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 3 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Halzen

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by Halzen »

Interesting. I noticed no slowdown on my machine with that HDD load script, but I am using a particularly modern laptop. This could be very helpful for those running older systems. Thanks for posting. :)
wyrdoak

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by wyrdoak »

Seems to have sped up my Chrome browser on my netbook, pages seem to be loading faster. It's been a pain on some web sites. Using cable broadband I know it's not a slow ISP.
LifeInTheGrey
Level 3
Level 3
Posts: 145
Joined: Thu Apr 28, 2011 4:38 pm
Location: Boston

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by LifeInTheGrey »

While I've only done limited testing, seems to work pretty well. I ripped a movie with Handbrake and CPU usage was around 85-90% the whole time, but the system was still very responsive. No slowdown, no stuttering graphics, so far so good.

I should mention I'm on the stock .39-3 kernel, not on liquorix. Thanks for the tip!
the beauty of linux is that the rabbit hole goes as deep as you want it to go.
wyrdoak

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by wyrdoak »

Just watch a mkv movie with no stuttering on my netbook.

BTW, I'm running an Atom N450 CPU 1.6ghz 2gbs of RAM on a stock 2.6.39-3 64bit kernel.
Brian49

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by Brian49 »

kwevej - These look like good tweaks, but it would be helpful if you could explain some of the technical terms, please. What exactly are the "dirty ratio" and "dirty background ratio"? Many thanks.
LifeInTheGrey
Level 3
Level 3
Posts: 145
Joined: Thu Apr 28, 2011 4:38 pm
Location: Boston

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by LifeInTheGrey »

Brian49 wrote:kwevej - These look like good tweaks, but it would be helpful if you could explain some of the technical terms, please. What exactly are the "dirty ratio" and "dirty background ratio"? Many thanks.
after some googling, I found http://artipc10.vub.ac.be/wordpress/201 ... rovements/ on VM dirty ratio

By default the VM dirty ratio is set to 20% and the background dirty ratio is set to 10%. This means that when 10% of memory is filled with dirty pages (cached data which has to be flushed to disk), the kernel will start writing out the data to disk into the background, without interrupting processes. If the amount of dirty pages raises up to 20%, processes will be forced to write out data to disk and cannot continue other work before they have done so.

By increasing these values, more data will be cached into memory, and data will be written out in larger I/O streams. This can be a good thing on servers with fast storage and lots of memory.

To increase these values, create a file /etc/sysctl.d/dirty_ratio.conf with these contents:

vm.dirty_ratio = 40
vm.dirty_background_ratio = 15

Then with the command sysctl -p /etc/sysctl.d/dirty_ratio.conf you make these settings become in effect immediately.

On desktop systems, the default dirty_ratio of 20 and dirty_background_ratio of 10 should be reasonable. You do not want a too high dirty_ratio on desktop systems, because applications will stall for too long if they have to write out all these dirty pages at once.

I'm going to fiddle around with these settings, see if it really makes a difference.
the beauty of linux is that the rabbit hole goes as deep as you want it to go.
User avatar
linuxviolin
Level 8
Level 8
Posts: 2081
Joined: Tue Feb 27, 2007 6:55 pm
Location: France

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by linuxviolin »

I agree with things like swappiness, although I always set up it on my systems at 0, not 10, as on a desktop computer, you want swappiness to be as close to zero as possible. But vfs_cache_pressure = 1000? :shock: Hmm, mine is always at 50 and no problem with "the desktop reactions", at the contrary. :D To increase the speed of browsing files and folders again and again, we should decrease vfs_cache_pressure. Not sure there is a real need to touch to dirty_background_ratio and to dirty_ratio. You can find good advices here: Tales from responsivenessland: why Linux feels slow, and how to fix that

Problem, bug, with Liquorix kernel(s)? :roll: In the link you give, we read:
There are a lot of complaints about the system being unresponsive when copying large files
Maybe also something to see with the file system. Try XFS and/or JFS instead ext4. I use them exclusively for a long time now and never had a problem like this one whatever the distro... At the contrary.

Just one example. On my 'test' PC, I use Mageia Cauldron (future Mageia 2). It is setup as I always do with vm.swappiness = 0 and vm.vfs_cache_pressure = 50. The / partition is JFS and /home is XFS. Well, there is absolutely no problem of "desktop reactions", system responsiveness or some problem copying large files. At the contrary. E.g. when I'm browsing files and folders, the system is quite fast and when I copy a large file like a 4 GB or more ISO or a quite big MKV file, more 5 GB at least, from a folder to another, well, the copy just takes some seconds... :D
K.I.S.S. ===> "Keep It Simple, Stupid"
"Simplicity is the ultimate sophistication." (Leonardo da Vinci)
"Everything should be made as simple as possible, but no simpler." (Albert Einstein)
Brian49

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by Brian49 »

Thanks for the pointers. The value of 1000 for cache pressure has to be a typo; as far as I know, all these VM parameters are on a scale of 0 to 100.
User avatar
linuxviolin
Level 8
Level 8
Posts: 2081
Joined: Tue Feb 27, 2007 6:55 pm
Location: France

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by linuxviolin »

Brian49 wrote:Thanks for the pointers. The value of 1000 for cache pressure has to be a typo; as far as I know, all these VM parameters are on a scale of 0 to 100.
Maybe, probably. But 100 is the defaults for vfs_cache_pressure. So, if you want the defaults, there is no need for adding something about them in sysctl.conf... You must add a line just if you want to change them.
K.I.S.S. ===> "Keep It Simple, Stupid"
"Simplicity is the ultimate sophistication." (Leonardo da Vinci)
"Everything should be made as simple as possible, but no simpler." (Albert Einstein)
Smiff2

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by Smiff2 »

i think numbers of 1000 are valid, but probably a bad idea

you can test these by typing e.g.

Code: Select all

sudo sysctl -w vm.vfs_cache_pressure=50
no need or even dangerous to add to your .conf immediately, where it'll be permanent..
LifeInTheGrey
Level 3
Level 3
Posts: 145
Joined: Thu Apr 28, 2011 4:38 pm
Location: Boston

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by LifeInTheGrey »

Smiff2 wrote:i think numbers of 1000 are valid, but probably a bad idea

you can test these by typing e.g.

Code: Select all

sudo sysctl -w vm.vfs_cache_pressure=50
no need or even dangerous to add to your .conf immediately, where it'll be permanent..
I must admit I'm having more success now after removing the dirty components and reducing vfs_cache to 50.
the beauty of linux is that the rabbit hole goes as deep as you want it to go.
sanda

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by sanda »

old thread? The OP mentions liquorix and nautilus, neither of which are present in the LMDE I recently installed.
The tip regarding swappiness tweak is relavent to any kernel?

After decking out my xfce with plugins, I'm not finding it to be "remarkably" lighter than the other, heavy-hitter, DEs

Every "launcher" item added to an xfce panel (scuse me if I'm using the wrong term)(xfApplet-}launcher) seems to act like a TSR process, each adding 1.5Mb RAM overhead... and, after having FINALLY gotten my sound working under LMDE (3rd install, no clue what the problem was previously) I'm noticing stutters during audio playback.

My system startup is blazingly fast, but immediately after starting an xfce session, 250Mb+ RAM is already consumed. Toward troubleshooting, I've already pruned (toggled off) most of the startup daemons/services.

I have disabled the xfce effects (shadows, etc) and I still need to check how much friendlier xRenderer vs openGL would be for my Radeon GT240... but, as is, I can't envision sticking with xfce unless I can *at least* overcome the audio stuttering (a hiccup which seems to occur every 10-15 seconds or so, happens in various audio player apps)

so thanks, in advance, for any further tips/suggestions
ej64
Level 4
Level 4
Posts: 323
Joined: Tue Nov 24, 2009 7:43 am
Location: somewhere in Germany

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by ej64 »

^ try

Code: Select all

sudo echo 0 > /sys/module/snd_hda_intel/parameters/power_save
= disable audio power saving. If it doesn't help enable it again by echoing the number of seconds until power saving (eg. echo 10 > ...)
Another reason can be a wireless controller/driver causing (or even any other driver/hw) bad latencies. Check dmesg for any quirks. Try sound with wireless disabled.

xRenderer will come with a severe performance hit. your 250 MB are somewhat unavoidable with a 3rd party closed source graphics driver. Do you really worry? Maybe you've installed something that pulls large dependencies (eg. a Qt = KDE app) ? Get rid of the launcher and configure keyboard shortcuts like Meta+w for the webbrowser. Keep your installation clean and simple ... :wink:
Thinkpad X220 with Samsung SSD running Xubuntu 13.04
I'm getting old gladly -- I don't like to die young ...
midnight gypsy

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by midnight gypsy »

i registered on the account of this post and the fact I'm impressed with LMDE. But, i'm very confused with the terminology. Could someone please speak in layman(redneck) terms. And explain in a understanding way. I have googled this quite a bit. If it helps, I have four gigs of ram. What I want to accomplish is to speed up the programs( apps). That I normally click on and use often. (ie home, firefox, control-center etc...). one of the terms I do not understand is dirty page. I think this means an app that was open. But now is closed. if this is true, wouldn't it make since to have a high dirty page ratio. To keep your normal everyday apps in ram. I hope someone can explain this to my understanding..... Thank you, Russ

If it helps, This is my settings are now. I do not have a swap partion in my hard-drive.

vm.swappiness=0
vm.vfs_cache_pressure=2000
vm.dirty_background_ratio=2
vm.dirty_ratio=20

These settings seem to be slower when I first open a page(app) ( ie home, firefox etc.) If closed and reopen seem to be faster.
ej64
Level 4
Level 4
Posts: 323
Joined: Tue Nov 24, 2009 7:43 am
Location: somewhere in Germany

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by ej64 »

midnight gypsy wrote:What I want to accomplish is to speed up the programs( apps). That I normally click on and use often. (ie home, firefox, control-center etc...).
install preload ("sudo apt-get install preload"), this loads your often used data and programs in advance. Boot time may suffer, though.
I do not have a swap partion in my hard-drive.
vm.swappiness=0
vm.vfs_cache_pressure=2000
vm.dirty_background_ratio=2
vm.dirty_ratio=20
If you don't have a swap partition these parameters are irrelevant to your system.
These settings seem to be slower when I first open a page(app) ( ie home, firefox etc.) If closed and reopen seem to be faster.
This has nothing to do with swapping. It's just when you once opened an app it has already read from your HD and is available now in the buffers (HD caching in spare RAM that is not used otherwise).
Thinkpad X220 with Samsung SSD running Xubuntu 13.04
I'm getting old gladly -- I don't like to die young ...
midnight gypsy

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by midnight gypsy »

I do run preload and readahead. Which helps load apps faster. I have tried quite a few settings. And you are right on those settings. They work that way on mine. I'm just a little confused. All the googling I've done.. Is always explainded in an unclear way. It reminds me of a union contract talking in circles..lol. I was hoping someone could explain it a lil better or easier... Russ
User avatar
ibm450
Level 5
Level 5
Posts: 650
Joined: Sun Jan 11, 2009 6:56 am
Location: Hamilton Hill, Western Australia

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by ibm450 »

would this work on mint 13 & ubuntu 1204

cheers
HP EILITE FOLIO 9470M i7-3667u x 4
GitHub: tolgaerok
Image Image
craigevil

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by craigevil »

ibm450 wrote:would this work on mint 13 & ubuntu 1204

cheers
Probably more or less.
my /etc/sysctl.conf

Code: Select all

# /etc/sysctl.conf - Configuration file for setting system variables
# See sysctl.conf (5) for information.
#

#kernel.domainname = example.com

# Uncomment the following to stop low-level messages on console
kernel.printk = 4 4 1 7

##############################################################3
# Functions previously found in netbase
#

# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
net.ipv4.conf.default.rp_filter=1
net.ipv4.conf.all.rp_filter=1

# Uncomment the next line to enable TCP/IP SYN cookies
#net.ipv4.tcp_syncookies=1

# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1

# Uncomment the next line to enable packet forwarding for IPv6
#net.ipv6.conf.all.forwarding=1


###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Ignore ICMP broadcasts
net.ipv4.icmp_echo_ignore_broadcasts = 1
#
# Ignore bogus ICMP errors
net.ipv4.icmp_ignore_bogus_error_responses = 1
# 
# Do not accept ICMP redirects (prevent MITM attacks)
net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
net.ipv4.conf.all.send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
net.ipv4.conf.all.accept_source_route = 0
net.ipv6.conf.all.accept_source_route = 0
#
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#
# The contents of /proc/<pid>/maps and smaps files are only visible to 
# readers that are allowed to ptrace() the process
# sys.kernel.maps_protect = 1

#sidux tweaks
net.core.rmem_default = 524288
net.core.rmem_max = 524288
net.core.wmem_default = 524288
net.core.wmem_max = 524288
net.ipv4.tcp_wmem = 4096 87380 524288
net.ipv4.tcp_rmem = 4096 87380 524288
net.ipv4.tcp_mem = 524288 524288 524288
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0

net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_ecn = 0


# swap/ram tweaks
vm.vfs_cache_pressure=50
vm.swappiness=20
vm.dirty_background_ratio=10
vm.dirty_ratio=30

User avatar
ibm450
Level 5
Level 5
Posts: 650
Joined: Sun Jan 11, 2009 6:56 am
Location: Hamilton Hill, Western Australia

Re: HowTo Improve system responsiveness [tweak] (liquorix)

Post by ibm450 »

craigevil wrote:
ibm450 wrote:would this work on mint 13 & ubuntu 1204

cheers
Probably more or less.
my /etc/sysctl.conf

Code: Select all

# /etc/sysctl.conf - Configuration file for setting system variables
# See sysctl.conf (5) for information.
#

#kernel.domainname = example.com

# Uncomment the following to stop low-level messages on console
kernel.printk = 4 4 1 7

##############################################################3
# Functions previously found in netbase
#

# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
net.ipv4.conf.default.rp_filter=1
net.ipv4.conf.all.rp_filter=1

# Uncomment the next line to enable TCP/IP SYN cookies
#net.ipv4.tcp_syncookies=1

# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1

# Uncomment the next line to enable packet forwarding for IPv6
#net.ipv6.conf.all.forwarding=1


###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Ignore ICMP broadcasts
net.ipv4.icmp_echo_ignore_broadcasts = 1
#
# Ignore bogus ICMP errors
net.ipv4.icmp_ignore_bogus_error_responses = 1
# 
# Do not accept ICMP redirects (prevent MITM attacks)
net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
net.ipv4.conf.all.send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
net.ipv4.conf.all.accept_source_route = 0
net.ipv6.conf.all.accept_source_route = 0
#
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#
# The contents of /proc/<pid>/maps and smaps files are only visible to 
# readers that are allowed to ptrace() the process
# sys.kernel.maps_protect = 1

#sidux tweaks
net.core.rmem_default = 524288
net.core.rmem_max = 524288
net.core.wmem_default = 524288
net.core.wmem_max = 524288
net.ipv4.tcp_wmem = 4096 87380 524288
net.ipv4.tcp_rmem = 4096 87380 524288
net.ipv4.tcp_mem = 524288 524288 524288
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0

net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_ecn = 0


# swap/ram tweaks
vm.vfs_cache_pressure=50
vm.swappiness=20
vm.dirty_background_ratio=10
vm.dirty_ratio=30


thankyou, and yes :mrgreen: made a notable difference to general responsiveness when opening up apps (libre, browsers and general operations)
HP EILITE FOLIO 9470M i7-3667u x 4
GitHub: tolgaerok
Image Image
Locked

Return to “LMDE Archive”