Make ubuntu or applications run faster

See also
https://doc.ubuntu-fr.org/optimisation

Check ubuntu startup times
systemd-analyze blame

/etc/fstab
http://www.lgqyc.com/move-tmp-to-ram/
http://jsmylinux.no-ip.org/performance/improving-performance/
http://askubuntu.com/questions/173094/how-can-i-use-ram-storage-for-the-tmp-directory-and-how-to-set-a-maximum-amount
http://www.digitalinternals.com/unix/linux-io-performance-tuning-noatime-nodiratime-relatime/388/

mount | grep -P "^tmpfs.+/(tmp|var/run)"
sudo du -sh /tmp /var/tmp; du -sh /********/apps/tmp /********/apps/var/run /run/user/`id -u` /tmp/tomcat 2>/dev/null

tmpfs /tmp tmpfs defaults,relatime,mode=1777,size=4G 0 0
tmpfs /var/tmp tmpfs defaults,relatime,mode=1777,size=99G 0 0
tmpfs /********/apps/tmp tmpfs defaults,relatime,mode=1777,size=2G 0 0
tmpfs /********/apps/run tmpfs rw,nosuid,noexec,relatime,mode=755,size=2G 0 0

Firefox cache
see also http://kb.mozillazine.org/Browser.cache.memory.capacity
see also https://wiki.archlinux.org/index.php/Firefox_on_RAM

Main disadvantages of this method are that the content of currently browsed web pages is lost if browser 
crashes or after a reboot, and that the settings need to be configured for each user individually.

Open the url: about:config.
browser.cache.disk.enable false
browser.cache.disk.capacity 512000 -> 500M
browser.cache.memory.max_entry_size 512000 -> 500M appcache
browser.cache.memory.enable true
browser.cache.memory.capacity 1048576 -> 1G RAM
See the result in about:cache?device=memory (might require a firefox restart).

Increase the Speed at Which Firefox loads pages
see also http://bgr.com/2009/01/25/a-handful-of-firefox-tweaks-that-will-double-your-browser-speed/
see also http://www.techfragments.com/481/the-12-best-firefox-aboutconfig-performance-tweaks/

1. Type “about:config” into the address bar and hit Enter.
(Normally the browser will make one request to a web page at a time. When you enable pipelining it will make several at once, which really speeds up page loading.)

2. Alter the entries as follows:
Set “network.http.pipelining” to “true”
Set "network.http.pipelining.ssl” to “true”
see also network.http.proxy.pipelining
network.http.pipelining.maxrequests -> default 32; modified to 6
content.notify.ontimer -> created with value true (default anyway)
content.notify.backoffcount -> created with value 3 (default -1)
content.notify.interval -> default 120 000 microseconds; modified to 500 000

Chromium cache
see also https://wiki.archlinux.org/index.php/Chromium/Tips_and_tricks#Tmpfs
see also the cache chrome://cache/ -> takes an age to load ...
Allocate Chromium 1G of disk cache by modifying in any chromium-browser.desktop (Exec=chromium-browser lines):
chromium-browser --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache ...
see also https://www.chromium.org/user-experience/user-data-directory

Improve chrome performance
Navigate to chrome://flags and chrome://gpu/.
See video card info at https://adrhc.go.ro/wordpress/ubuntu-errors-problems-tips-tricks/

Enable these in chrome://flags/:
Enable experimental canvas features
Override software rendering list - canceled
Number of raster threads - 4
Enable GPU rasterization
Enable zero-copy rasterizer
Simple Cache for HTTP
Disable touch adjustment
Enable TCP Fast Open
LCD text antialiasing
Enable Download Resumption

Disable these in chrome://flags/:
Enable touch events
Enable pinch scale

Startup parameters:
grep "Exec=" /usr/share/applications/chromium-browser.desktop
grep "Exec=" $HOME/.local/share/applications/chromium-browser.desktop
Exec=chromium-browser --process-per-site --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache --enable-native-gpu-memory-buffers %U
Exec=chromium-browser --process-per-site --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache --enable-native-gpu-memory-buffers
Exec=chromium-browser --process-per-site --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache --enable-native-gpu-memory-buffers --incognito
Exec=chromium-browser --process-per-site --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache --enable-native-gpu-memory-buffers --temp-profile

Firefox & Chromium profile
see also http://ubuntuforums.org/showthread.php?t=1921800&page=2
see also https://wiki.archlinux.org/index.php/Profile-sync-daemon
see also https://wiki.archlinux.org/index.php/Anything-sync-daemon
sudo add-apt-repository ppa:graysky/utils
sudo apt-get update
sudo apt-get install profile-sync-daemon
psd p -> creates /********/.config/psd/psd.conf
Primary configuration:
gedit /********/.config/psd/psd.conf
USERS="gigi bob"
USE_OVERLAYFS="yes"
BROWSERS="chromium"
USE_BACKUPS="yes"
Add to /etc/sudoers (required by psd.service USE_OVERLAYFS="yes"):
gigi ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper
secondary configuration
mkdir -p ~/.config/systemd/user/psd-resync.timer.d
gedit ~/.config/systemd/user/psd-resync.timer.d/frequency.conf
[Unit]
Description=Timer for Profile-sync-daemon
PartOf=psd.service
[Timer]
OnUnitActiveSec=10m
Enable & start the service:
systemctl --user enable psd
systemctl --user start psd
systemctl --user status psd
Stop & disable the service:
systemctl --user stop psd
systemctl --user disable psd
Check psd installation & configuration:
profile-sync-daemon parse
psd p
ls -l ~/.mozilla/firefox/
ls -l /run/user/`id -u`

Plex
Server -> Transcoder: /var/tmp/plex-transcoding

Linux hdd defragmentation
see also http://www.hecticgeek.com/2012/10/defragment-ext4-file-systems-using-e4defrag-ubuntu/

HDD performance
see also https://www.kernel.org/doc/Documentation/block/queue-sysfs.txt
see also https://wiki.mikejung.biz/Ubuntu_Performance_Tuning
see also https://wiki.mikejung.biz/OS_Tuning

hdd performance info
echo "queue_depth: $(cat /sys/block/sda/device/queue_depth)"; echo "nr_requests: $(cat /sys/block/sda/queue/nr_requests)"; echo "read_ahead_kb: $(cat /sys/block/sda/queue/read_ahead_kb)"
echo "queue_depth: $(cat /sys/block/sdb/device/queue_depth)"; echo "nr_requests: $(cat /sys/block/sdb/queue/nr_requests)"; echo "read_ahead_kb: $(cat /sys/block/sdb/queue/read_ahead_kb)"

Queue_depth (default 31)
cat /sys/block/sda/device/queue_depth
cat /sys/block/sdb/device/queue_depth

I/O scheduler queue size (default 128)
How many requests may be allocated in the block layer for read or write requests.
cat /sys/block/sda/queue/nr_requests
su  -> won't work using sudo ...
echo 1024 > /sys/block/sda/queue/nr_requests
cat /sys/block/sdb/queue/nr_requests
su
echo 1024 > /sys/block/sdb/queue/nr_requests

Maximum number of kilobytes to read-ahead
cat /sys/block/sda/queue/read_ahead_kb  -> default 128
cat /sys/block/sdb/queue/read_ahead_kb

Print readahead in 512-byte sectors (http://man7.org/linux/man-pages/man8/blockdev.8.html)
sudo blockdev --getra /dev/sda      -> default 256 (always double to read_ahead_kb above)
sudo blockdev --getra /dev/sdb

This file (/sys/block/sda/queue/add_random) allows to turn off the disk entropy contribution. Default value of this file is '1'(on).
cat /sys/block/sdb/queue/nr_requests
su  -> won't work using sudo ...
echo 1 > /sys/block/sdb/queue/nr_requests

Persist using /etc/rc.local
blockdev --setra 256 /dev/sda
echo 1 > /sys/block/sda/queue/add_random

Disable IPv6 support
Check ipv6 status (1 = disabled)
cat /proc/sys/net/ipv6/conf/all/disable_ipv6

Add to /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6=1  
net.ipv6.conf.default.disable_ipv6=1  
net.ipv6.conf.lo.disable_ipv6=1

Disable loading of ivp6 module into kernel during booting
see also http://linuxpoison.blogspot.com/2009/06/how-to-disable-loading-of-unnecessary.html
Edit /etc/modprobe.d/blacklist.conf
blacklist ipv6

/etc/sysctl.conf
vm.swappiness=1
This option controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects.
At the default value of vfs_cache_pressure=100 the kernel will attempt to reclaim dentries and inodes at a "fair" rate with respect to pagecache and swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer to retain dentry and inode caches. When vfs_cache_pressure=0, the kernel will never reclaim dentries and inodes due to memory pressure and this can easily lead to out-of-memory conditions. Increasing vfs_cache_pressure beyond 100 causes the kernel to prefer to reclaim dentries and inodes.
vm.vfs_cache_pressure=5

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.