Created
July 1, 2016 05:28
-
-
Save t0mab/160aa9f24b6800f8828a94fee44202dc to your computer and use it in GitHub Desktop.
Optimise linux ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stolen from https://adrhc.go.ro/wordpress/ thanks man !!!!! | |
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 http://kb.mozillazine.org/Browser.cache.memory.capacity | |
# see 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/ | |
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 https://wiki.archlinux.org/index.php/Chromium/Tips_and_tricks#Tmpfs | |
# Chromium with 1G RAM cache; modify in any chromium-browser.desktop (Exec=chromium-browser lines): | |
chromium-browser --disk-cache-size=1073741824 --disk-cache-dir=/tmp/chromium-cache ... | |
Improve chrome performance | |
Navigate to chrome://flags. | |
# enable these: | |
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: | |
Enable touch events | |
Enable pinch scale | |
# startup parameters | |
Exec=chromium-browser --process-per-site --disk-cache-size=1073741824 %U | |
Firefox & Chromium profile | |
# see http://ubuntuforums.org/showthread.php?t=1921800&page=2 | |
# see 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="*** *******" | |
USE_OVERLAYFS="yes" | |
BROWSERS="chromium" | |
USE_BACKUPS="yes" | |
# Add to /etc/sudoers (required by psd.service USE_OVERLAYFS="yes"): | |
*** 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 /usr/lib/systemd/user/psd.service | |
systemctl --user start 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 http://www.hecticgeek.com/2012/10/defragment-ext4-file-systems-using-e4defrag-ubuntu/ | |
HDD performance | |
# see https://www.kernel.org/doc/Documentation/block/queue-sysfs.txt | |
# see also https://wiki.mikejung.biz/Ubuntu_Performance_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 | |
sudo blockdev --getra /dev/sda -> default 256 | |
sudo blockdev --setra 128 /dev/sda | |
cat /sys/block/sda/queue/read_ahead_kb | |
sudo blockdev --getra /dev/sdb | |
sudo blockdev --setra 256 /dev/sdb | |
# persist using /etc/rc.local | |
blockdev --setra 128 /dev/sda | |
echo 0 > /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 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment