Computers and modern gadgets

It began to slow down noticeably. This is very annoying, since I often work very quickly, automatically, and any brakes simply disrupt the rhythm. But why can Linux slow down? How to speed up Linux? How to optimize Linux?

There are several points here that I want to draw attention to. Each of them affects the speed of Linux to some extent, albeit slightly. But if you optimize everything together, it can give a performance boost. And believe me, it’s not difficult, most often you don’t even need to go into the console... I will show everything on Linux Mint, but all this can be done by analogy on other Linux systems.

1. Linux startup optimization.

The first thing you need to pay attention to is what is loaded when the system starts. Go to MENU - SETTINGS - RUN APPLICATIONS.

Here you can disable everything unnecessary, in my case it’s almost everything. This way you get rid of unnecessary processes and programs that are loaded when Linux starts. This Linux optimization will also help you speed up the system boot time. Done? Go ahead.

2. Server shutdown

Did you know that by default, your Linux can have many servers installed: print server, samba server, apache server, ssh server and so on. It is possible that you do not need them for a hundred years, then all these processes are constantly hanging in your memory. You can simply disable them, but most often it is easier to delete unnecessary servers. How to find them?

Open Synaptic and enter the word in the search server:

We look, read what is installed and what we really don’t need - delete it. But you shouldn’t delete everything unless you know what it is and why it is. I have already removed a lot of unnecessary stuff, but most likely there is still a lot of junk. You can also type in the word demon and see which services are installed, but we don’t need them. Deleted? Let's move on...

3. Disable unnecessary services

Previously, in Ubuntu, in a graphical environment, it was possible to disable and enable services, but then the guys from Ubuntu decided that we, losers, did not need this - they would suddenly disable something important, and then they would say that Ubuntu is buggy!

But maybe they are right, but for us this is not a problem, since Linux is a console, a terminal, and only then a graphical shell. Install the required package:

Sudo apt-get install sysv-rc-conf

Open a terminal and use sudo to issue the command sysv-rc-conf:

Sudo sysv-rc-conf

Now, using the arrows on the keyboard and using the space bar, we turn off everything unnecessary. But be careful, you are in the heart of Linux and if you disable something important, your system may not boot - and don't say I didn't warn you!

There are a lot of instructions on the Internet that describe in detail what each service is responsible for, and which can be disabled and which cannot. Seek and you will find!

How to speed up Ubuntu?

Why Ubuntu? Just for example. Ubuntu uses their proprietary Unity as a working environment. In my experience, the brake is still the same. Therefore, you can speed up Ubuntu simply by installing a lighter working environment - XFCE4, E17, LXDE and so on. Or you can just immediately download a version of the same Ubuntu with a light desktop, for example, Lubuntu:

Nice and easy! There will be almost all the same functionality, maybe just fewer bells and whistles. But do we really need them?

And finally, one more question:

Which Linux to install on an old computer?

Here you shouldn’t rely on a light working environment, here you need LIGHT Linux! Light on the inside, not just the outside- remember this truth. What are the options? , Slackware, Slax and so on. Here you need to try, because you will have to pay something for ease - but what did you want?


Did not find an answer to your question? Use the search...

8 comments

8 comments to the article “Optimizing Linux - it’s simple!”

    But my Windows doesn’t slow down! Maybe your computer is weak? After all, modern operating systems are developed and tested on modern processors with a supply of RAM.

    Lubuntu is indeed faster. But I encountered some glitches there. Still, I settled on Ubuntu Gnome + Cairo-Dock
    It turns out stable, without glitches. And fast enough. The main thing is not to install 64-bit on an old computer with 2 gigs of memory. 32-bit will work much faster.

    I agree, all mini OS sometimes have hidden shortcomings. But yesterday there was a pleasant exception, I installed Linux on a friend’s laptop, Mint did not work AT ALL, which is strange, but BackBox installed like native and the speed is SUPER! I want to write a review about it today maybe.

    I used Ubuntu for a while, then, with the release of newer versions, my computer simply stopped running it. I switched to Debian and am happy, the only thing bad there is the graphical environment and fonts - they are better in Ubuntu, but this is perhaps only one of their advantages in my opinion. Now version 8 of Debian has been released, there you can install any working environment and almost any software that you are used to.

    By the way, there is a mistake in the post: not Pappy, but Puppy.

    I agree that Debian is easier, but sometimes you have to sacrifice speed for convenience. Previously, I also practiced a lot with lightweight distributions, and then I realized: it’s easier to buy a normal powerful computer and rack your brains, since any minimalism carries with it a bunch of other problems.

    Thanks for the mistake, I corrected it ;)

    Well, if I’m an ordinary teapot, what will I rely on when deleting servers?

    Dummies should not deal with servers; this is a very complex and responsible matter.

    “There are a lot of instructions on the Internet that describe in detail what each service is responsible for, and which can be disabled and which cannot. Search and you will find!”

    Always perplexed by such instructions! You are interesting people!
    Why is your article needed on the Internet? To send those who are looking for information, as they say, to 3 Soviet ones?
    I think - if a person undertakes to write instructions, or something similar - write as clearly and comprehensively as possible, or attach a link to third-party resources.


Linux users, by definition, have access to a more powerful system compared to Windows. However, if you use a heavyweight desktop environment such as Unity, for example, performance may suffer somewhat.

Everyone prefers that programs and documents open not after 10-20 seconds, but immediately. At the same time, it is desirable that the appearance of the working environment does not resemble the early nineties, because we spend a lot of time in the interface of our system, which means we should be comfortable inside.

You don't have to go to the extreme of completely abandoning a beautiful desktop environment in favor of ascetic window managers. Finding a compromise between performance and good looks is not a difficult task at all.

In this article, we'll look at speeding up Ubuntu in four simple ways. While these tips will also apply to older releases, we'll look specifically at speeding up Ubuntu 16.04.

A positive result will be clearly visible on old low-power computers or on VirtualBox. The tips are relevant and effective even if your Ubuntu is installed on an SSD.

1. Remove unnecessary programs from startup.

Ubuntu 16.04, at startup, loads a large number of different applications, many of which you most likely do not need. To speed up Ubuntu, you can simply disable them.

However, many startup programs are hidden, and in order to see them you need to run the following command:
sudo sed -i "s/NoDisplay=true/NoDisplay=false/g" /etc/xdg/autostart/*.desktop

Now open "Automatically Started Apps" from Unity Dash...

And just uncheck unnecessary items.

You can speed up Ubuntu 16.04 by disabling unnecessary features. Here's a list of services and programs you probably won't need.

Accessibility Profile Manager(Accessibility Manager).
Used to display the accessibility icon on the login screen. If you don't need the on-screen keyboard and voice assistant, simply turn them off.

Backup Monitor(Backup).
Creating backups using deja-dup-monitor. If you do not plan to make backups of any data, feel free to disable it.

Desktop Sharing(Remote desktop control).
Designed for incoming VNC connections. If you know that you can handle your system without anyone’s help, then you can turn it off. The ability to act as a remote assistant yourself and control other computers via VNC does not disappear anywhere.

Gnome Software(Software Center).
You can disable it if you prefer to install programs through the terminal, without using the GUI Software Center.

Personal File Sharing(Sharing personal files).
It should be left only if you need to transfer files via Bluetooth.

Update Notifier(Update Notice).
If you do not want to receive notifications about available updates, then you can disable it.

2. Adjust Swappiness.

We all know that the speed of data exchange with RAM is much higher than with a hard drive. How to speed up Ubuntu given this fact?

Let's do a little experiment: start your system, open several programs, say: Firefox, LibreOffice, Mozilla Thunderbird, Evince... and just leave them open without performing any actions. Do not put the system into either sleep or standby mode. Come back in a few hours and notice how clumsy the running programs have become, how slowly they respond to our mouse actions. This is because they went into idle mode (inactivity), and the system sent them to swap, that is, to a specially designated space on the hard drive.
Using System Monitor, you can find that Ubuntu is using swap, regardless of whether there is a lot of free RAM.
This is due to the default swappiness settings. Swappiness is a kernel parameter that controls how often Linux will send idle applications to swap, which is the hard drive.

The swappiness value can be set in the range from 0 to 100. Low values ​​instruct to use swapping less often, high values ​​- more often. The default value in Ubuntu is 60. This means that when RAM consumption reaches 40%, the Linux kernel activates the use of swap.

You can check the current value using the command:
cat /proc/sys/vm/swappiness

How to speed up Ubuntu? It is recommended to set swappiness to a lower value so that the kernel uses as much RAM as possible. For example, to set the value to 10, you would run the following command:
sudo sysctl vm.swappiness=10

Do not put spaces before or after the "=" sign. This command tells the kernel to use swap only when memory is 90% occupied. This setting lasts until reboot.

To make the configuration permanent, you need to edit a special file.
sudo nano /etc/sysctl.d/99-sysctl.conf

At the end of this file you need to add the line:
vm.swappiness=10

Save the file and close the editor (Press Ctrl+O to save and Ctrl+X to exit). All these steps apply to Ubuntu Server 16.04.

Our goal is to speed up Ubuntu. Of course, who would like the launch speed of Firefox or other heavy applications? There is a small software tool known as preload that remembers the programs you use most often, preloads their associated libraries and executables into RAM, making those heavyweight programs run much faster.

You can install preload on Ubuntu 16.04 using the command:
sudo apt install preload

Once the installation is complete, the preload daemon will start automatically, you can verify this by running the command:
systemctl status preload

If, for some reason, it is not running, run the command:
sudo systemctl start preload

Now just go about your business - preload will work without your participation.

4. Turn off effects.

The effects are undoubtedly pleasing to the eye, breaking up a boring workspace. However, they also require valuable system resources to operate. How to speed up Ubuntu 16.04? Using compizconfig-settings-manager, effects can be disabled, thereby increasing performance.
You can install compizconfig-settings-manager using the command:
sudo apt install compizconfig-settings-manager

Launch it from Unity Dash, then select the Effects section on the left and disable the ones you don't need. If you want, you can turn off absolutely everything.

You can also turn off background blur in Unity Dash using the Unity Tweak Tool. This will make Unity Dash more responsive.

Installing Unity Tweak Tool:
sudo apt install unity-tweak-tool

Once installed, open it and select the "Search" tab, then switch the "Background blur" button to "Off." (OFF).

In general, many people like a transparent background, what about you?

After:

Bonus tip: Find the main culprit behind slow loading times.

You can find out how long it takes to start each of the loaded services by running the following command:
systemd-analyze blame

As you can see in the picture above, the mnt-pi.mount and vboxadd.service services are the very culprits. I know that mnt-pi.mount is responsible for mounting NFS (Network File System) on my Raspberry Pi, but I no longer need it, so I can safely remove it from the /etc/fstab file. I also know that the vboxadd.service daemon is only needed for the virtual machine, which is, again, unnecessary for me.

Disable:
sudo systemctl disable vboxadd.service

Checking the loading time:
systemd-analyze time

After:

Other ways to speed up Ubuntu 16.04

Do you know other ways to speed up Ubuntu 16.04? Share them in the comments.

It is known that modern operating systems use technology such as virtual memory, designed for multitasking operating systems.

In Windows operating systems, the file used to store unused RAM in the hard drive area is called the “swap file” (pagefile.sys).

Its organization is far from being implemented in the best way (to put it mildly!). In Linux OS, even during installation, a separate swap partition is created - “Swap”, which is much better.

The Windows and Linux-swap swap file is located on the HDD (hard drive). When there is not enough RAM, pages of memory are swapped out of RAM onto the hard drive, and when you access files in the swap partition again, they are loaded back into RAM.

The whole problem is that the read-write speed of the HDD hard drive (even the fastest) FACTOR OF less than RAM speed. This is what leads to a slower computer and decreased performance in general.

There are two ways to solve this problem: use large amounts of RAM or properly configure the system to work with the page file and swap.

So, in Ubuntu there is a parameter that controls the percentage of free memory at which dumping of memory pages into swap will begin - vm.swappiness.

In Ubuntu, by default, it has a value of - 60. This means that when 40% of the RAM is occupied, active dumping of memory pages into the swap section will begin, i.e. 100% - 60% = 40%.

You can check what the parameter value is for you as follows.

Open the terminal using a key combination Ctrl+Alt+T and run the command:

cat /proc/sys/vm/swappiness

This parameter value can only be useful for computers with a small amount of RAM (512 -1024 MB).

If you have a modern computer or laptop with a large amount of RAM (4-6, or even 8 GB), then this is unlikely to suit you.

Many Ubuntu forums and blogs recommend setting vm.swappiness = 10 (i.e. 100% - 10% = 90%). But, in my personal experience, if you have 6 GB of RAM, you can behave more aggressively by setting the value to 0. In this case, the system will access the swap partition only as a last resort.

I recommend experimenting with this parameter in the current session (after a reboot everything will return to the default value), without changing anything in the system configuration files for now, in order to find the most optimal parameter. And here everything is individual...

You can do it like this.

Again, open the almighty terminal with a key combination Ctrl+Alt+T and run the following command in it:

sudo sysctl vm.swappiness=

After the equal sign, set the value from 100 to 0 (depending on the amount of your RAM).

After this, try to “boot” your system: open several browsers with a large number of tabs, copy large files to external media (this, by the way, is the sore point of Linux systems - the speed of copying to external media. But more on that next time ) etc.

After you have selected the most suitable value for yourself, you need to set the new value as a constant. Copy and run the following command in the terminal:

sudo gedit /etc/sysctl.conf

A configuration file will open in front of you in a text editor gedit. At the end of this file we insert the following two parameters without a hash in front of them:

vm.swappiness=0 vm.vfs_cache_pressure = 1000

Save the file. It should look like the screenshot below:

Reboot the computer. After rebooting, execute in the terminal:

sudo sysctl -p

I, as noted above, chose the parameter equal to 0, essentially disabling the swap partition, since for my computer with six gigabytes of RAM it turned out to be the most optimal. You can set the parameter value to 10, as recommended on numerous forums.

As an example, I would like to demonstrate RAM loading in Ubuntu 12.10 x64 with 6 GB RAM.
So, I opened three browsers - the standard Mazilla Firefox, Opera and Google Chrome with a total of about 40 tabs, the Clementine audio player (by the way, quite demanding on computer resources), Skype, and the qBittorrent torrent client.
And here is a screenshot htop(this is a fairly advanced console process monitor). To install, type in the terminal

sudo apt-get install htop


I think everything is becoming clear: less than half of the installed RAM is occupied.
Therefore, if you have a lot of RAM, then using a swap partition makes no sense. This will only slow down the speed of your computer!
In conclusion, I can say that this is not the only thing that can be done to speed up Ubuntu. More on this in the following articles. Subscribe to the RSS channel!
Have a great mood, fast computer operation and Happy New Year!
As a pleasant surprise, today there is a video about how Google employees saw the past year.

Before we move on to speeding up Ubuntu, let's figure out why the system becomes slower over time. There may be several reasons for this. You may have a weak computer with a normal configuration. You might have installed several applications that eat up resources during system startup. In fact, the reasons are endless.

Below are various tricks that will help speed up Ubuntu a little. These are some of the best options you can take to make your system run smoother and better. You can follow all of the tips presented or just some of them. When using them, Ubuntu speed increases noticeably.

I used these tricks with an older version of Ubuntu, but I think they can be used on other versions as well as other Linux distributions that are based on Ubuntu: Linux Mint, Elementary OS Luna, etc.

Reduce the loading time of the selection screen.

This screen gives you 10 seconds to select your operating system, enter recovery mode, etc. I think this is too much time. If you follow this system, you need to sit next to your computer and press the right key to log into Ubuntu as quickly as possible. It takes a while, doesn't it? The first trick is to change the timing of this selection screen. If you're more comfortable using a GUI tool, you can read about changing the boot time and order in Grub Customizer.

Everyone else can simply enter the following command to open the boot screen configuration settings:

Sudo gedit /etc/default/grub &

You need to replace GRUB_TIMEOUT=10 with GRUB_TIMEOUT=2 . Then the loading time will be 2 seconds. It is better not to select 0 seconds, because then you will not be able to choose between entering the OS and recovery mode. After changing the configuration, enter the following command, which will commit the changes:

Sudo update-grub

Set up auto-start applications.

Over time, you start installing applications. Some of them run every time the OS boots. Of course, running these applications takes resources.

The result: the computer slows down for a long period of time after startup. Go to Unity Dash and find Startup Applications there:

There you will see all startup applications. Think about whether there are applications there that you do not need when starting the OS? They can be removed from this list.


What if you don’t want to turn off autoloading? For example, if you installed some kind of indicator application for Ubuntu, you will want it to automatically launch when you start your computer.

In this case, you can delay the launch of applications. Then you will free up a certain amount of resources that are used when loading the OS, and after some time the necessary applications will be launched automatically. On the screen from the previous picture, click the “Edit” button and change the start time using the sleep option.

For example, if you want to delay the launch of the Dropbox indicator for, say, 20 seconds, you just need to add this to the existing command:

Sleep 10;

Then the dropbox start -i command changes to sleep 20; dropbox start -i. This means that Dropbox will now launch with a 20-second delay. Similarly, you can change the start time of other applications.


Install preload for applications to speed up their launch.

Preloading is a background process that analyzes user behavior and loads applications frequently. Open a terminal and enter the following command to install preboot:

Sudo apt-get install preload

After installation, restart your computer and forget about this process. It will work in the background.

Choose the best mirrors for updates.

It's a good idea to make sure you're using the best mirror versions to update your apps. The software repository is “mirrored” around the world in the case of Ubuntu. Optimization is to use a server that is geographically closer to you. Thanks to this, the system will be updated faster, because the time it takes to send packets to the server is reduced.

IN Software & Updates -> Ubuntu Software tab -> Download From select Other, and then click on Select Best Server:


After this, a check will start and you will be offered the best mirror. Usually it is already installed, but it is better to double-check just in case. If the mirror that contains the repository is not updated frequently, then system updates may be delayed. This tip will be useful for people with relatively slow Internet speeds.

For faster updates, use apt-fast rather than apt-get.

Apt-fast is a shell script for apt-get. It improves the speed of updating and downloading packages, since it downloads packages simultaneously across multiple connections. If you frequently use the terminal and apt-get to install and update these packages, consider trying apt-fast. It can be installed from the official PPA using the following commands:

Sudo add-apt-repository ppa:apt-fast/stable sudo apt-get update sudo apt-get install apt-fast

Remove ign from apt-get updates, which refers to languages.

Ever notice what sudo apt-get update says? It contains three types of strings: hit, ign, get. If you look at the ign strings, you will notice that they are mainly related to language translation. If you use applications and packages in one language, you do not need translation into the same language.

If you remove language-related updates from apt-get, apt-get's speed will increase slightly. To do this, open the following file:

Sudo gedit /etc/apt/apt.conf.d/00aptitude

Add the following line at the end of this file:

Acquire::Languages ​​"none";

Reduce overheating.

Overheating is a common problem that occurs in most computers. An overheated computer is quite slow. Opening a program takes centuries, with the CPU fan spinning at Usain Bolt speeds. There are 2 ways to reduce the degree of heating, and therefore increase the efficiency of Ubuntu, optimization will also be better. These are TLP and CPUFREQ.

To install and use TLP, enter the following commands into the terminal:

Sudo add-apt-repository ppa:linrunner/tlp sudo apt-get update sudo apt-get install tlp tlp-rdw sudo tlp start

Once installed, you don't need to do anything. TLP runs in the background.

To set the CPUFREQ indicator, use the following command:

Sudo apt-get install indicator-cpufreq

Restart your computer and turn on power saving mode:


Customize LibreOffice to make these programs run faster.

If you use office programs frequently, then you might want to set up LibreOffice to speed up your work. Memory will be configured here. Open LibreOffice, go to Tools -> Options. There, from the left column, select Memory and enable Systray Quickstarter, increase memory allocation.


If possible, use a lighter interface.

If you're using the regular Unity or GNOME interface, you might be interested in switching to simpler interfaces like Xfce or LXDE.

These interfaces use less RAM and waste less CPU power. They also have small programs that can also speed up Ubuntu.

Of course, these interfaces may not look as modern as Unity or GNOME. This is the compromise you will have to make.

Use lighter-sized versions of applications.

This is rather just a suggestion, so this question depends on personal preferences. Many standard or popular applications consume a lot of resources and may not be suitable for a low-power computer. In this case, you should look for alternatives to such applications. For example, you can use AppGrid instead of Ubuntu Software Center. Gdebi is suitable for installing packages. Instead of LibreOffice Writer, you can use AbiWord.

This concludes the collection of tips that will help make Ubuntu 14.04, 16.04 and other versions stronger. I am sure that by performing these tricks the system will work much better.

While our gentush brothers spend weeks compiling their system, we will apply a couple of tips and will definitely overtake the fastest penguin on the planet. Ubuntu was already almost on par with Gentoo, but our changes will allow us to snatch victory from the clutches of Pygoscelis papua. Buckle up, we're speeding up!

Disabling Compiz

Compiz is a composite window manager for the X Window System that uses OpenGL to accelerate 3D graphics. It provides many new graphical effects available in all desktop environments, including GNOME and KDE. If you have drivers for your video card installed, then most likely the manager is enabled. Remember that a video card with Compiz enabled in the “Performance on Demand” mode is constantly running at full load and is not going to slow down the fan speed. If you want silence from your video card or save kilowatts, I advise you to simplify the Compiz effects or disable it completely. In the first case, you need to install the compizconfig-settingsmanager package via Synaptic or command in the Terminal:

$ sudo aptitude install
compizconfig-settings-manager

To access the capabilities of Compiz and simplify the effects to your liking, follow the route: Menu („ System „„ Options „ | Compiz Config Settings Manager. If you just want to disable Compiz, you can do this through the Menu item „ | System „ Options r „ Appearance, in the “Appearance” tab, set “No effects”.

Reducing GTK Latency

In Ubuntu, the desktop environment is Gnome, where GTK plays an important role. By changing the settings of this toolkit, we affect all applications that use it. I suggest tweaking the parameters responsible for delays:

$ gedit ~/.gtkrc-2.0
### Minimum time, in milliseconds, that the pointer must remain on a menu item before a submenu appears
gtk-menu-popup-delay = 0
### Time in milliseconds before submenus are hidden when the pointer moves to a submenu
gtk-menu-popdown-delay = 0
### Delay in milliseconds before submenus appear after the menu bar
gtk-menu-bar-popup-delay = 0

Gnome Jewelry Customization

In Gnome, settings are stored similarly to the MS Windows registry, with the only difference being that the Gnome “registry” is an XML file. They can be accessed through the configuration editor gconf-editor or by calling the gconftool-2 command. To speed up the response time of the “registry”, we will take the following steps:

1. Let's tell Metacity not to use animation effects, thereby reducing resource consumption:

$ gconftool-2 --type bool --set /apps/metacity/general/reduced_resources true

The only thing that will change visually is that when moving windows, the contents will not be displayed;

2. Turn off the panel on/off animation:

$ gconftool-2 --type bool --set /apps/panel/global/enable_animations false

3. Let's disable assistive technologies of keyboards, mice, etc., intended for people with disabilities:

$ gconftool-2 --type bool --set /desktop/gnome/interface/accessibility false

4. Let's set the animation speed of the "Fast" panels:

$ gconftool-2 --type string --set /apps/panel/global/panel_animation_speed panel-speed-fast

If you have a mode set in which when you hover the mouse over the window of an open application, the latter moves to the foreground, then you can toggle the auto_raise_delay parameter, which controls the delay between hovering the mouse and raising the window:

$ gconftool-2 --type integer --set /apps/metacity/general/auto_raise_delay 100

XML optimization

Many Ubuntu programs store settings and data in structured XML files. It is possible to convert XML from a human-readable format to a computer-friendly format. Converted XML files load faster and take up less RAM. Scripts that can be downloaded from: www.gnomefiles.org/app.php?soft_id=1397 will help with this conversion. We unpack the resulting archive (desktop-optimizations.tar.gz) and run the scripts one by one from a regular account:

  1. rhythmbox-quickstart optimizes Rhythmbox music player files;
  2. evolution-optimize optimizes Evolution mail program files;
  3. gnome-optimize optimizes Gnome files;
  4. openoffice-optimize optimizes OpenOffice office suite files. org;
  5. doc-optimize optimizes Gnome help files;
  6. gconf-optimize optimizes Gnome configuration files (the "registry" of Gnome).

If there are several accounts in the system, then the rhythmbox-quickstart and gconf-optimize scripts must be run from each account. Nothing bad will happen if you run the scripts several times - optimizing what is “already optimized” is not destructive. It is advisable to re-login after optimizing the XML for the changes to take effect.

The scripts optimize both files in the home directory and system files by requesting privileges via sudo. The scripts make backup copies, but if during a lengthy optimization procedure your computer reboots due to a power failure, the results may be ambiguous and disastrous. The presence of a UPS is welcome.

Speeding up the launch of programs using QT

The traditional view is that Gnome is GTK and KDE is Qt, but there is nothing stopping the user from running GTK programs in KDE and Qt programs in Gnome. Even more! The authors of Gnome and KDE have done a lot to make “foreign” programs look the same as “native” ones. Now we will look at how to speed up the launch of programs written using Qt in Gnome. In fact, a Qt program may not depend on KDE, but use the capabilities of this environment. To do this, at startup it must receive the “minimum set of KDE”. How to find out which programs depend on KDE? In the Terminal we issue the command:

$ sudo aptitude search "~i!~nlib(~Dqt|~Dkde)"

It will display packages that are installed ("~i") AND this is not a library ("!~nlib") AND the dependencies include Qt ("~Dqt") OR the dependencies include KDE ("~Dkde"). By running the “minimum KDE set” in advance and keeping the corresponding libraries in memory, we will achieve a speedup when starting these programs. The trick is very simple: in the DE Menu System „t Options „‘ Launched applications, add the startup program /usr/bin/kdeinit under the name FastQt. That's it, after restarting the computer, your Qt programs will start faster.

Speed ​​up program launches using Preload

Preload is a daemon that runs in the background and collects information about the most frequently used programs, caches them and the libraries they use, resulting in faster loading times for programs. You just need to install preload with the command:

$ sudo aptitude install preload

Or run Synaptic, find preload in it and install it. The default preload settings are suitable for most users, so there is no need to change anything in the /etc/preload.conf file.

Easy optimization of SQLITE files

Many programs in Ubuntu store their data not in text files, but in databases, and SQLite is often the latter. Using the tools of such DBMSs, you can clean up empty records and create indexes of the database file again. First of all, install sqlite3 via Synaptic or type in the Terminal:

$ gedit ~/bin/optimizer.sh
#!/bin/sh
### Optimization for Firefox
find ~/.mozilla/ -name "*.sqlite" -print -exec
sqlite3() "VACUUM; REINDEX;" > /dev/null 2>&1 \;
### Optimization for Epiphany
find ~/.gnome2/epiphany -name "*.sqlite"
-print -exec sqlite3() "VACUUM; REINDEX;" >
/dev/null 2>&1 \;
### Optimization for Liferea
sqlite3 ~/.liferea*/liferea.db "VACUUM;
REINDEX;" > /dev/null 2>&1
exit 0

Using the command “chmod +x ~/bin/optimizer.sh” we make the file executable.
We can periodically call this script when programs whose database files we want to optimize are closed.

Total optimization of SQLITE files

In the previous section, we optimized the SQLite data files of the Firefox, Epiphany browsers and the Liferea RSS reader. Now let's complicate the task a little. Let's find all the SQLite files in the home directory and optimize them specifically :). What do we need?

1. Install sqlite3 via Synaptic or in the Terminal if you have not already done so:

$ sudo aptitude install sqlite3

2. Create a file ~/bin/sqlite_shrink.sh with the following content:

$ gedit ~/bin/sqlite_shrink.sh
#!/bin/sh
find ~/ -size +100k -type f -print0 | \
while read -d "" FILE; do
abs_file_name=$(readlink -f "$FILE")
headfile=`head -c 15 "$abs_file_name"`;
if [ "$headfile" = "SQLite format 3" ]; then
file_size_do=`du -b "$abs_file_name"|cut
-f1`;
sqlite3 "$abs_file_name" "VACUUM; REINDEX;" >/
dev/null 2>&1
file_size_posle=`du -b "$abs_file_name"|cut -f1`;
echo "$abs_file_name";
echo "Size DO $file_size_do";
echo "Size AFTER $file_size_postle";
echo -n "Percentage"
echo "scale=2; ($file_size_postle/$file_size_
do)*100"|bc -l
fi
done
sleep 2
exit 0

3. Make ~/bin/sqlite_shrink.sh executable via Nautilus or in the Terminal “chmod +x ~/bin/sqlite_shrink.sh”.

4. Now close your Ubuntu session and go to the console by clicking . Log in to the console and command:

$ sudo /etc/init.d/gdm stop
$ sudo /etc/init.d/kdm stop
$ ~/bin/sqlite_shrink.sh > ~/report_sqlite_shrink.txt

5. Wait for the script to finish running and reboot:

$ sudo shutdown -r +0

After total file reindexing, all programs using SQLite will benefit. Which ones exactly? Read ~/report_sqlite_shrink.txt, in it you will see the file names, size before and after cleaning and reindexing. Fans of Google Chrome and KDE will definitely be happy with this advice. Repeat the procedure periodically, and the refreshing effect is guaranteed.

Creating caches

GTK+ can use cache files created by gtk-update-iconcache to avoid unnecessary system calls and disk operations when running applications. Since the cache file format allows multiple applications (mmap()ed) to share them, overall memory consumption is also reduced. All we have to do is periodically run a script that calls gtk-update-icon-cache and create caches that speed up access to those icons. Let's also call fc-cache, which creates descriptions for fonts.

$ gedit ~/bin/rebuild_cache.sh
#!/bin/sh
###Updating the icon cache in your folder
for d in ~/.icons/*; do gtk-update-icon-cache -f $d;
done
###Updating the system icon cache
for d in /usr/share/icons/*; do sudo gtk-update-iconcache
-f $d; done
###Updating the font cache
sudo fc-cache -fv
fc-cache ~/.fonts

Make the file executable using the command “chmod +x ~/bin/rebuild_cache.sh”. If you add new Gnome fonts and themes to the system, then run the script ~/bin/rebuild_cache.sh, which will build caches for them.

Caching symbol tables

Create an empty directory

$ mkdir ~/.compose-cache

Now your Qt/GTK programs will start a little faster and consume less memory, thanks to the fact that libX11 will create caches of parsed information in ~/.compose-cache and reuse it.

Ubuntu swap

Modern operating systems use the concept of “paging”. Recall that this is a process that, when there is a shortage of RAM, pushes unused memory pages into an area called the swap partition. When the page is needed again, it is loaded back into RAM. Since the swap lives on the hard drive, which is many times slower than the RAM, actively moving pages back and forth slows down the computer as a whole. Conclusion? You need to have enough RAM in your computer for your tasks. The conclusion is banal, but it is true.

To top it off, let's slightly change Ubuntu's behavior regarding RAM usage and swap space. There is such a parameter vm.swappiness, by default it has a value of 60 and is used to determine the percentage of free memory at which active dumping of pages into the swap section will begin. In other words, when the memory is 40% occupied (100-60), Ubuntu will already start using the swap area. If there is a large amount of RAM in the computer, it is better to reduce the value of the vm.swappiness parameter to 10, thereby instructing the penguin not to use swap until the occupied amount of RAM reaches 90% (100-10). To make such a change, the easiest way is to launch the Terminal and enter the command:

$ sudo sh -c "vm.swappiness = 10" >> /etc/sysctl.conf

After a reboot, the fast RAM will be used more efficiently, and the slow swap will be used less often.

Conclusion

You should understand that the settings are always conservative by definition, and the OS/program developer strives for them to work on a wide range of systems. Therefore, tuning the operating system is not a matter of pressing one button with the inscription “Do everything quickly.” Understanding what is described in the advice and analyzing exactly how the acceleration is achieved, you carefully apply the commands and carefully monitor the behavior of the system. I hope that the tips were useful to you and that your penguin has become more responsive.

Info

  • GTKPerf will allow you to check the degree of responsiveness of the interface: linux.softpedia.com/progDownload/GtkPerfDownload-6715.html
  • Apply the tips one at a time, it is advisable to reboot the system each time. Test the influence of advice over time, do not rush.
  • There are no miracles. Tips either use free memory or disable something to speed things up.

If you notice an error, select a piece of text and press Ctrl+Enter
SHARE:
Computers and modern gadgets