Configure and Maximize Laptop on Ubuntu Desktop as Daily Marketing Activity.

Your new/first Tips, tricks and tutorial forum.
Post Reply
User avatar
admin
Site Admin
Posts: 24
Joined: March 7th, 2022, 1:09 am

Configure and Maximize Laptop on Ubuntu Desktop as Daily Marketing Activity.

Post by admin »

I would like to share my marketing activity using my Laptop:
hp EliteBook 2450p, using Ubuntu desktop 20.04.5 LTS.

Code: Select all

jerry@hp-2540p:~$ hostnamectl
   Static hostname: hp-2540p
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: 1536efa361084xxxad8183c2aebaec8b
           Boot ID: a10be3562xxx475696f0911b3a271659
  Operating System: Ubuntu 20.04.5 LTS
            Kernel: Linux 5.15.0-56-generic
      Architecture: x86-64
jerry@hp-2540p:~$ 
Opening a lot of multiple tab at the same browser in my daily activity, As a marketer... this is a normal habit,
but most of the time...
We've got a lot of problems with our device,
such as:
> The laptop hang due too many open multiple tab,
> The laptop running effects... very slow,
> The laptop running load average very high then shutdown unexpectedly.

To resolve the problems...

#1. Reduce the overheating:

There are two tools which you can use to reduce overheating
and thus get a better system performance in Ubuntu...
TLP and CPUFREQ.

Code: Select all

sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tlp tlp-rdw
sudo tlp start
To install CPUFREQ indicator use the following command:

Code: Select all

sudo apt-get install indicator-cpufreq
also...

Code: Select all

sudo apt-get install cpupower-gui
Restart your computer and use the powersave mode in it.
and looks like this:

Code: Select all

jerry@hp-2540p:~$ cpupower frequency-info
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us
  hardware limits: 1.20 GHz - 2.13 GHz
  available frequency steps:  2.13 GHz, 2.13 GHz, 2.00 GHz, 1.87 GHz, 1.73 GHz, 1.60 GHz, 1.47 GHz, 1.33 GHz, 1.20 GHz
  available cpufreq governors: conservative ondemand userspace powersave performance schedutil
  current policy: frequency should be within 1.20 GHz and 2.13 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 1.58 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    33999 MHz max turbo 4 active cores
    33999 MHz max turbo 3 active cores
    33999 MHz max turbo 2 active cores
    33999 MHz max turbo 1 active cores
jerry@hp-2540p:~$
#2. Install MSI Fan control within your Gnome Extention
(Edit: Since Jan-2023 I'm not using it anymore...)

Just start using powersave mode only (to reduce the heat rise up)
For your reference:
https://extensions.gnome.org/

#3. update your Ubuntu grub using this configuration:

Make sure GRUB_CMDLINE_LINUX_DEFAULT asserted with "intel_pstate=disable acpi-cpufreq=enable"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_pstate=disable acpi-cpufreq=enable"

Code: Select all

sudo nano /etc/default/grub

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT="0"
#GRUB_HIDDEN_TIMEOUT="0"
GRUB_HIDDEN_TIMEOUT_QUIET="true"
GRUB_TIMEOUT="20"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_pstate=disable acpi-cpufreq=enable"
GRUB_CMDLINE_LINUX=""
acpi_osi=Linux

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL="console"

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE="640x480"
GRUB_GFXMODE="1280x800"
#GRUB_GFXMODE="1366x768"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID="true"

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

# Uncomment to get a theme
export GRUB_COLOR_NORMAL="light-gray/black"
#GRUB_THEME="/usr/share/grub/themes/Tela/theme.txt"
# or
#GRUB_THEME="/usr/share/grub/themes/Stylish/theme.txt"
# or
#GRUB_THEME="/usr/share/grub/themes/Vimix/theme.txt"

# End default grub
Save file.

Tweaking kernel for maximum concurrency.:

Code: Select all

sudo nano /etc/sysctl.conf

Code: Select all

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

#kernel.domainname = example.com

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

##############################################################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
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#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
#  Enabling this option disables Stateless Address Autoconfiguration
#  based on Router Advertisements for this host
#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.
# 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
#
# Increase the tcp-time-wait buckets pool size to prevent simple DOS attacks
net.ipv4.tcp_max_tw_buckets = 1440000
#net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
#
### TUNING NETWORK PERFORMANCE ###

# Default Socket Receive Buffer
net.core.rmem_default = 31457280

# Maximum Socket Receive Buffer
net.core.rmem_max = 12582912

# Default Socket Send Buffer
net.core.wmem_default = 31457280

# Maximum Socket Send Buffer
net.core.wmem_max = 12582912

# Increase number of incoming connections
net.core.somaxconn = 4096

# Increase number of incoming connections backlog
net.core.netdev_max_backlog = 65536

# Increase the maximum amount of option memory buffers
net.core.optmem_max = 25165824

# Increase the maximum total buffer-space allocatable
# This is measured in units of pages (4096 bytes)
net.ipv4.tcp_mem = 65536 131072 262144
net.ipv4.udp_mem = 65536 131072 262144

# Increase the read-buffer space allocatable
net.ipv4.tcp_rmem = 8192 87380 16777216
net.ipv4.udp_rmem_min = 16384

# Increase the write-buffer-space allocatable
net.ipv4.tcp_wmem = 8192 65536 16777216
net.ipv4.udp_wmem_min = 16384

###################################################################
# Magic system request Key
# 0=disable, 1=enable all, >1 bitmask of sysrq functions
# See https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html
# for what other values do
#kernel.sysrq=438

#
#Reduce Swappiness to set the ram compatibility for 8gb
vm.swappiness=20
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
#
#
Save file.
To make sure it'll be running properly, run this command in terminal:

Code: Select all

sudo sysctl -p
#4. Reduce Swappiness:
We want to change this swappiness value to 20. (8GB RAM)
To do this,
you will need to edit the sysctl.conf file.
Just enter the following command into the terminal to open the file:

Code: Select all

sudo nano /etc/sysctl.conf
Now add the line :

Code: Select all

vm.swappiness=20 
to the bottom of the file.
Save file and You should update the grub.

type in terminal:

Code: Select all

echo FRAMEBUFFER=y | sudo tee /etc/initramfs-tools/conf.d/splash && 
sudo update-initramfs -u && 
sudo update-grub
#5. Install Psensors, makes use of lm-sensors and hddtemp to get the temperatures:

Code: Select all

sudo apt-get install psensor
and setup preferences and sensor preferences with your device.

#6. MTU Setting

MTU stands for Maximum Transmission Unit and it is basically a parameter that determines the maximum size of data packets
that are allowed to be transferred from the network to your system.
If the MTU value is too small, then you are crippling your speed by dealing with large number of packages, and if it is too large, you are letting the data transmission occupy significant portions of your bandwidth for larger periods of time, essentially causing lag.
So, there is a golden ratio as in everything and if you want to squeeze the maximum performance out of your internet connection,
you can determine and set your MTU to an optimal value.
Open a new terminal session and start ping tests to see what the optimal MTU value is.
Use the following command:

Code: Select all

ping -M do -s 1470 google.com
Start with 1480 and drop 10 by 10 until you find the highest value
that is indicating 0% packet loss, using “Ctrl+C” to cancel each ping.
After you have determined the optimal MTU value, go to /etc/network/interfaces:

Code: Select all

sudo nano /etc/network/interfaces
And add a line “mtu 1470” without quotation marks "..."
(or whatever value you found as the best) and save the file.
Note that you need to open the configuration file as the system administrator
or else you won't be able to save your changes.

#7. Install preload

preload is an adaptive readahead daemon. It monitors applications that users run, and by analyzing this data, predicts what applications users might run, and fetches those binaries and their dependencies into memory for faster startup times.

Update apt database:

Code: Select all

sudo apt-get update
Install preload:

Code: Select all

sudo apt-get -y install preload
You need to restart/reboot your ubuntu system.

And make sure your esm-infra and Livepatch status are enabled:
For your reference:
https://auth.livepatch.canonical.com/?u ... buntu-user

Code: Select all

jerry@hp-2540p:~$ sudo ua status
[sudo] password for jerry:            
SERVICE          ENTITLED  STATUS    DESCRIPTION
esm-infra        yes       enabled   Expanded Security Maintenance for Infrastructure
fips             yes       disabled  NIST-certified core packages
fips-updates     yes       disabled  NIST-certified core packages with priority security updates
livepatch        yes       enabled   Canonical Livepatch service
usg              yes       disabled  Security compliance and audit tools

Enable services with: pro enable <service>

     Account: xxxxxxxxxx@emailprovider.com
Subscription: Ubuntu Pro - free personal subscription
jerry@hp-2540p:~$
Your Pro version:

Code: Select all

jerry@hp-2540p:~$ pro --version
27.12~20.04.1
jerry@hp-2540p:~$
and your pro security-status:

Code: Select all

jerry@hp-2540p:~$ pro security-status
2198 packages installed:
     1656 packages from Ubuntu Main/Restricted repository
     237 packages from Ubuntu Universe/Multiverse repository
     244 packages from third parties
     61 packages no longer available for download

To get more information about the packages, run
    pro security-status --help
for a list of available options.

Main/Restricted packages receive updates with LTS until 2025.

jerry@hp-2540p:~$ 
Last but not least... Turn on your air conditioner too, Make it cooler...
Hopefully, this will speed things up a bit without causing network data package errors,
and your daily marketing activity running smoothly as well.

Have take a look... Stable performance! 23 tabs opened at the same time session:
Image Image
Post Reply