Speeding up Linux Mint. Five Tips to Speed ​​Up Linux on Ubuntu


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.

How to map a Windows network drive in Linux Support for Windows network drives in Linux is provided by the cifs-utils package. If you don't already have it installed, type apt-get install cifs-utils at a command prompt as root. This command will check to see if the specified package is installed and, if not, install it. Create a folder in /mnt (or any other place) where we will mount the Windows network drive: mkdir /mnt/winshare And finally, the connection of the Windows network folder in Linux is done using the command mount.cifs mount.cifs //SERVER_IP/SHARE_NAME /mnt/winshare -o username=WIN_USER_NAME,password=WIN_USER_PASSWORD This command will attach to the Linux file system a Windows network drive with the name SHARE_NAME, located on a server with the IP address SERVER_IP under the name WIN_USER_NAME with the password WIN_USER_PASSWORD. It should be understood that on the Windows side, in a logical way, the specified folder should be shared and the rights to access it should belong to the specified user...

Managing virtual machines with virsh

Managing virtual machines using virsh The virsh text utility is designed to manage guest systems and the hypervisor. virsh uses the libvirt API and serves as an alternative to xm and the graphical virtual machine manager (virt-manager). Unprivileged users can access in read-only mode. With virsh you can run scripts on virtual machines. Overview of virsh Commands The following tables list the main virsh command line options. Description help command Quick help. listView all virtual machines. dumpxml Dump the XML configuration file for the given virtual machine. createCreate a virtual machine from an XML configuration file and launch it. startStart an inactive virtual machine. destroyForcibly stop the virtual machine. define Defines the XML configuration file for the given virtual machine. domidView virtual machine ID...

Automatically mounting disks and partitions in Linux or what is fstab? Debian problem

Automatically mounting disks and partitions in Linux or what is fstab?
There is an easy way remount all partitions from /etc/fstab without reboot the system.
Run the following command as root:
# mount -a
This simple command remounts All file systems specified in /etc/fstab, except sections with the noauto option.

As a result of normal mounting with the mount command, the parameters will be saved until the first OS reboot. For more information about using the mount command, you can read the article “The mount command in Linux or everything about mounting partitions, disks, ISO images and SMB resources.” After rebooting the OS, all these steps must be performed again. To mount automatically every time the operating system boots, you need to edit the configuration file fstab.
This article discusses the issue in detail automatic mounting hard disk partitions and other storage devices when the operating system starts Linux. 1. What is /…

There are a huge number of Linux distributions and many choose one or the other depending on their preferences or skills, knowledge, because not everyone can master the use or installation of Gentoo or Arch. Many Linux geeks assemble a distribution kit for themselves without unnecessary software on board, but such actions are beyond the capabilities of beginners - they have to be content with ready-made options, most often Ubuntu or distribution kits created on the basis of Ubuntu.

This article is intended to help the “ordinary” Linux user speed up his system a little. With the help of minor manipulations, additional caching and a few more settings, you can redistribute system resources for greater performance.

First, we will need Gedit, a text editor, since we will make most of the edits in the system using it. If you have Ubuntu, it is installed by default. To check for Gedit, open a terminal and enter:

If a text editor opens, then everything is in order, if not, install it with the command:

sudo apt-get install gedit

Preload

Now you can start setting up the system. The first step is to install Preload, which will cache the applications you launch most often and at the same time the system will start faster. For those who use an SSD instead of a HDD, this point may not be significant; you won’t notice much of a result.

sudo apt-get install preload

Prelink

Second, we will install another Prelink utility - with its help, the system will redistribute libraries and executable files in such a way that the number of requests to RAM will be reduced, and will also keep them in RAM to speed up the system when running programs again.

To run periodically, you need to edit one file:

sudo gedit /etc/default/prelink

Find the line:

PRELINKING=unknown

Change to

sudo /etc/cron.daily/prelink

After these manipulations, some time must pass until the utilities collect the necessary information and perform optimization.

Swappiness

Now let's configure the use of the swap partition. By default, swap is activated when RAM usage reaches 40%, but we need to use the RAM as much as possible. First, let’s check what value is set in our system; to do this, enter the command in the console:

cat /proc/sys/vm/swappiness

If you see the number 60, then the system is using only 40% of RAM, if 40, then 60% of RAM is being used. We need the number 10 - for this we enter in the console:

sudo gedit /etc/sysctl.conf

Looking for a string vm.swappiness and set the value to 10, if there is no such line, then add at the end:

vm.swappiness=10


We use all processor cores

The next step is to use all processor cores. Open the file:

sudo gedit /etc/init.d/rc

Looking for a string CONCURRENCY and give it a value:

CONCURRENCY=makefile

Using RAM for temporary files

We use TMPFS to reduce access to the /tmp partition, because temporary system files are stored here. Let's transfer them to RAM. In the console we enter:

sudo gedit /etc/fstab

At the end add:

# Move /tmp to RAM

tmpfs /tmp tmpfs defaults,noexec,nosuid 0 0

That's all, after these manipulations you will notice an increase in productivity. On some computers more, on others less, but there will definitely be an increase. As additional material, I advise you to study the manual for this one - you will find some more practical tips there. I hope the article helped you, a little later I will try to write something more interesting and useful.

Linux is getting heavier and heavier. Today, you won’t surprise anyone with applications that take a few minutes to launch, desktop environments that take up 500 MB of RAM, and sluggish loading of the OS, reminiscent of a woman’s shopping trip. Are there ways to optimize all this, is there a cure for penguin obesity, where can I get a knife to cut off all the excess? Let's try to figure it out.

Over the entire existence of fat penguins (a period counted approximately from the appearance of GTK+ 2.X, X Free 4.X and Linux 2.6), many ways have been invented to speed up the launch of applications and the entire OS.

Some of them have been successfully used in popular distributions for a long time, others are still considered experimental. In this article we will take a closer look at them and determine how justified their use may be.

Pre-linking or PRELINK

Pre-linking is nothing more than modifying the executable file to include the results of dynamic linking of libraries. What does it mean?

In ancient times, applications were simple and used only a few dynamically loaded system libraries. That was the time of dominance of the a.out executable file format, the peculiarity of which was its extreme simplicity.

a.out files always knew exactly at which address they would be loaded into process memory, and at which addresses their internal functions, constants, etc. would be located. This feature, on the one hand, gave them an advantage in loading speed, and on the other, created problems with the coexistence of libraries in memory (what if two libraries are loaded into memory at the same address?). The problems had to be solved, so the ELF format appeared (its creators were actually fans of Tolkien's books :)), which removed the responsibility for choosing the address of its placement in virtual memory from executable files and transferred it to the dynamic linker. From now on, the loading addresses of applications, libraries and all their symbols (variables, constants, functions, etc.) were calculated dynamically at the loading stage.

ELF allowed UNIX/Linux to take a huge step forward and become a system capable of loading and running a huge number of applications, linked with the same number of libraries, without any problems. However, in terms of performance it was a failure. The dynamic linking procedure is very fast, and when launching applications that depend on just a few libraries, it does not introduce noticeable delays into the process, but if it is launching a bulky application with dependencies of about 50 libraries, then the delay can be quite significant (up to several tens of seconds) .

So-called pre-linking gives ELF files the most advantageous feature of the a.out format. The launched files are modified in such a way as to already include the result of dynamic linking and, accordingly, know their own addresses in the process memory in advance and do not waste time calculating them during the launch. The pre-linking procedure was proposed by Red Hat employee Jakub Jelinek back in 2004 and has proven to be a very successful method for increasing application launch speed. According to tests, it can give an increase equal to 50% of the initial launch speed, and in especially severe cases (OpenOffice, KDE, Gnome) - even more. At the same time, to speed up the system, it is enough to run just one command and wait a little.

Yes, it's really easy to use the pre-binding mechanism. To do this, the above-mentioned Jakub Jelinek wrote a program called prelink. It is available in almost any Linux distribution, so you don’t have to compile anything from source. Simply install the prelink packages using your distribution's package manager and run the following command:

The command line arguments in this case mean the following:

  • v - display more information on the screen;
  • a - pre-link all binary files;
  • m - save virtual memory (needed if there are a lot of libraries);
  • R - randomize the order of memory sections (increases the level of protection against stack stack attacks).

Once the application is finished running, you can start enjoying the speedup. However, there are a few limitations to keep in mind:

  1. Prelink is not able to increase the loading speed of binaries compiled without the "-fPIC" option. Unfortunately, there are quite a lot of such libraries; usually package builders deliberately disable this flag to increase application performance;
  2. Prelink cannot process the libraries of the wine project, so you will have to forget about accelerating Windows software;
  3. Some static libraries may stop running after prelink processing;
  4. After installing new applications or libraries, it is recommended to repeat the prelinking operation. To remove prelink do this:

Preload or PRELOAD

A good addition to prelink would be the preload daemon, which implements a mechanism for preloading libraries for frequently used applications. Working in the background, preload analyzes user actions and compiles a list of the most frequently used applications. This information is then used to pre-load applications and the libraries they require into memory, making cold startup of a program much less time-consuming.

The preload daemon can significantly improve the loading speed of applications, but this will only happen if the system is equipped with a sufficiently large amount of memory. Two gigabytes is the minimum at which preload will give a benefit; with smaller volumes it will only hinder. The preload package can be found as part of any modern distribution, so to install it you just need to use a standard package manager:

$ sudo apt-get install preload

Next, you should edit the /etc/preload.conf configuration file. The daemon works quite well with standard settings, but each of us is individual and uses the system differently, so you will probably want to customize the preload for yourself. I will list the main options in the model section:

  • cycle - frequency of calls to the system to collect statistics. The default value is 20 seconds. In most cases there is no point in changing it, but if you feel that preload is harming system performance, increase the value.
  • halflife - sets the interval after which preload will forget the accumulated statistics by 50%. The default value is 168 hours (week). It is recommended to reduce the value for those who often change software, and increase for those who can use the same set of applications for months/years.
  • minsize - the minimum size of the object (program, library) processed by preload. The default value is 2,000,000 bytes (about 2 MB), so preload will not preload smaller files. There is no particular need to change this value, but if you think that there will be enough memory for caching smaller applications, reduce the value.
  • memtotal, memfree, memcached - these three options are interconnected and indicate the amount of memory consumed by the preload. The following formula is used for calculations: (total amount of memory x memtotal) + (memory available at startup x memfree) + (cache x memcached).

The system section also contains three options that are interesting to us:

  • mapprefix - a list of directories whose files should be preloaded (keep in mind that these are not only binaries and libraries, but also other types of files).
  • exeprefix - list of directories with binary files.
  • sortstrategy is a way to optimize I/O operations. The default value is 3 (optimized for hard drives). For solid-state drives, the best value is 1, for network file systems - 2.

That's all, you can reload preload:

$ sudo /etc/init.d/preload reload

Like any other daemon, preload keeps logs, which you can find in the /val/log/preload.log file. Information about the current state of preload and its cache is available in the file /var/lib/preload/preload.state.

Pre-reading or READAHEAD

Ubuntu, as well as some other modern Linux distributions, use the readahead system during system initialization. Like the preload daemon, readahead preloads necessary application components into RAM to speed up their launch. The only difference is that readahead partially runs inside the Linux kernel and is optimized specifically to speed up the system initialization process.

The system uses the /sbin/readahead-list utility, which reads the /etc/readahead/boot and /etc/readahead/desktop files and loads the files listed in them during system initialization. This is a simple and effective scheme, which, however, also has obvious disadvantages. The fact is that any standard Ubuntu installation undergoes changes over time in the number of services installed and loaded during OS startup. In this case, the file lists become irrelevant and require updating. The profile kernel parameter allows you to rebuild the lists of preloaded files. To enable it, reboot the system, during boot press to enter the bootloader menu, then press and add the word profile to the end of the list of kernel parameters. Click For loading. Initializing the system in profiling mode will take time, so be prepared to be patient.

Process freezing or CRYOPID

Sometimes the best way to speed up the launch of an application is to simply not stop it. For many Unix users, having a browser, email and jabber clients running all day long is commonplace. There is simply no point in completing such applications; they may be needed at any moment.

So why not take this idea further and make it so that, instead of stopping processes, their state could be frozen and later restored, eliminating the need for the program to perform complex and time-consuming initialization of the internal state each time? We are not the first, we are not the last. CryoPID is a simple application for freezing processes and then restoring them. The program does not require root rights or modification of the kernel, works on x86 and amd64 architectures and, most importantly, does not tie the frozen process to a specific machine. After freezing, the process turns into something like a self-extracting archive; you can easily transfer it to another machine and just run it. The CryoPID package is not available in every distribution, so you will have to install it yourself:

$cd/tmp
$ wget http://dagobah.ucc.asn.au/wacky/cryopid-0.5.9.1i386.tar.gz
$ tar -xzf cryopid-0.5.9.1-i386.tar.gz
$ cd cryopid-0.5.9.1/src
$ make
$ mkdir ~/bin
$ cp freeze ~/bin

After this you can run the program as follows:

$ ~/bin/freeze process pid filename

Unfortunately, CryoPID has several problems, including incomplete support for sockets and X applications, and it generates garbage in the process list instead of the restored program name.

Fast loading of UBUNTU

Ubuntu is fast, really fast. The loading speed of this distribution leaves many other Linux systems far behind and makes fans of BSD systems jealous. However, there are no limits to perfection, and in this section we will try to speed up the accelerated.

1. Disable timeout in grub. By default, the bootloader waits 3 seconds for the user to change boot options. Open the file /boot/grub/menu.lst, find the line “timeout=3” and replace 3 with 0.

2. Turn off splash. The Ubuntu splash-screen, shown during system boot, is not very informative and takes time to load. Therefore, we open the same /boot/grub/menu.lst and remove the “quiet” and “splash” options from the kernel boot parameters.

3. Disable IPv6. Previously, support for the currently unneeded IPv6 protocol in Linux was implemented as a loadable module, so disabling it required only slightly editing the /etc/modprobe.d/aliases file. Today, IPv6 is built right into the kernel, so to disable it, the “ipv6.disable=1” parameter must be passed to the kernel. This can be done by editing the /boot/grub/menu.lst file.

4. Disable check for waking from sleep mode. During its boot, the kernel checks whether the computer is coming out of sleep mode (suspend) or performing a normal boot. This procedure takes only one second, but it can also be saved by adding the “noresume” option to the kernel boot parameters. Naturally, laptop owners should not do this.

5. Optimize initramfs. The RAM disk image is used to store low-level OS components that must be accessible before the root file system is mounted. By default, this image contains all kinds of components, selected for all occasions. Without them, the image is loaded into memory faster, which helps reduce the overall system boot time. Open the file /etc/initramfs-tools/initramfs.conf, find the line “MODULES=most” and replace it with “MODULES=dep”. Next, we rebuild all available images with only the necessary components:

$ sudo update-initramfs -k all -u

After updating the kernel, the images will be generated automatically.

6. Disable unnecessary services. By default, Ubuntu has many background services activated for all occasions. It’s unlikely that you need all of them, so let’s go turn them off. Open System q„ Administration („ Services and see the list of services. The choice of candidates for disabling depends on the specific situation, but in most cases you can safely sacrifice the following:

  • Bluetooth Manager - Bluetooth device manager
  • Check for new hardware drivers - checking new versions of proprietary drivers
  • Evolution Alarm Notifier - notification of mail arrival in Evolution
  • Print Queue Applet - print queue applet
  • Tracker - search and indexing service

7. Disable autostart of unnecessary applications. When you log in, a large number of different applications (mostly applets) autostart. Not all of them are needed, so open System Preferences p„ Applications startup and delete everything that you consider unnecessary (for example, the bluetooth applet). The launch of the remaining applications can be slightly optimized using the following trick: edit the launch line of each of them so that it looks something like this:

sh -c "sleep 10; exec bluetooth-applet"
sh -c "sleep 20; exec /usr/lib/evolution/2.28/evolution-alarm-notify"

Accelerating the launch of heavyweights

Many of the heavyweight applications we use every day are too slow and clumsy. It often takes more than a minute to start them, which is quite annoying and makes it difficult to concentrate on work. Let's try to fix this.

  • OpenOffice.org. This office suite is a record holder for resource consumption and clumsiness, so special attention must be paid to its optimization. Open Tools p„ Options, go to the “Memory” subsection. Set the “Number of steps” value to 20, this will reduce the size of the undo history. In the “Graphics cache” section, set the value to “Use for OpenOffice. org" in 128, "Memory per object" - in 20. In the "Java" subsection, uncheck the "Use a Java runtime environment" option. Optimization allows you to increase launch speed and response time.
  • Firefox. Ognelis is the second program in terms of gluttony and slowness. Stuffed with enough plugins, it turns from a fiery fox to a frozen turtle, but there are two ways to speed up its launch. The first is to remove all unnecessary and rarely used plugins. This will increase both startup speed and performance. The second is to optimize the sqlite database used to store profile data:
  • - distributed process freezing system.






2024 gtavrl.ru.