9 General System Resource Management #
Tuning the system is not only about optimizing the kernel or getting the most out of your application, it begins with setting up a lean and fast system. The way you set up your partitions and file systems can influence the server's speed. The number of active services and the way routine tasks are scheduled also affects performance.
9.1 Planning the Installation #
A carefully planned installation ensures that the system is set up exactly as you need it for the given purpose. It also saves considerable time when fine tuning the system. All changes suggested in this section can be made in the Seção 8.15, “Configurações de instalação” for details.
step during the installation. See9.1.1 Partitioning #
Depending on the server's range of applications and the hardware layout, the partitioning scheme can influence the machine's performance (although to a lesser extent only). It is beyond the scope of this manual to suggest different partitioning schemes for particular workloads. However, the following rules will positively affect performance. They do not apply when using an external storage system.
Make sure there always is some free space available on the disk, since a full disk delivers inferior performance
Disperse simultaneous read and write access onto different disks by, for example:
using separate disks for the operating system, data, and log files
placing a mail server's spool directory on a separate disk
distributing the user directories of a home server between different disks
9.1.2 Installation Scope #
The installation scope has no direct influence on the machine's performance, but a carefully chosen scope of packages has advantages. It is recommended to install the minimum of packages needed to run the server. A system with a minimum set of packages is easier to maintain and has fewer potential security issues. Furthermore, a tailor made installation scope also ensures that no unnecessary services are started by default.
SUSE Linux Enterprise Server lets you customize the installation scope on the Installation Summary screen. By default, you can select or remove preconfigured patterns for specific tasks, but it is also possible to start the YaST Software Manager for a fine-grained package-based selection.
One or more of the following default patterns may not be needed in all cases:
Servers rarely need a full desktop environment. In case a graphical environment is needed, a more economical solution such as IceWM can be sufficient.
When solely administrating the server and its applications via command line, consider not installing this pattern. However, keep in mind that it is needed to run GUI applications from a remote machine. If your application is managed by a GUI or if you prefer the GUI version of YaST, keep this pattern.
This pattern is only needed if you want to print from the machine.
9.1.3 Default Target #
A running X Window System consumes many resources and is rarely needed on
a server. It is strongly recommended to start the system in target
multi-user.target
. You will still be able to
remotely start graphical applications.
9.2 Disabling Unnecessary Services #
The default installation starts several services (the number varies with the installation scope). Since each service consumes resources, it is recommended to disable the ones not needed. Run
› › to start the services management module.If you are using the graphical version of YaST, you can click the column headlines to sort the list of services. Use this to get an overview of which services are currently running. Use the
button to disable the service for the running session. To permanently disable it, use the button.The following list shows services that are started by default after the installation of SUSE Linux Enterprise Server. Check which of the components you need, and disable the others:
Loads the Advanced Linux Sound System.
A daemon for the Audit system (see Part VII, “The Linux Audit Framework” for details). Disable this if you do not use Audit.
Handles cold plugging of Bluetooth dongles.
A printer daemon.
Enables the execution of
*.class
or*.jar
Java programs.Services needed to mount NFS.
Services needed to mount SMB/CIFS file systems from a Windows* server.
Shows the splash screen on start-up.
9.3 File Systems and Disk Access #
Hard disks are the slowest components in a computer system and therefore often the cause for a bottleneck. Using the file system that best suits your workload helps to improve performance. Using special mount options or prioritizing a process's I/O priority are further means to speed up the system.
9.3.1 File Systems #
SUSE Linux Enterprise Server ships with several file systems, including Btrfs, Ext4, Ext3, Ext2, ReiserFS, and XFS. Each file system has its own advantages and disadvantages. Refer to Chapter 1, Overview of File Systems in Linux for detailed information.
9.3.1.1 NFS #
NFS (Version 3) tuning is covered in detail in the NFS Howto at
http://nfs.sourceforge.net/nfs-howto/. The first
thing to experiment with when mounting NFS shares is increasing the
read write blocksize to 32768
by using the mount
options wsize
and rsize
.
9.3.2 Time Stamp Update Policy #
Each file and directory in a file system has three time stamps associated
with it: a time when the file was last read called access
time, a time when the file data was last modified called
modification time, and a time when the file metadata
was last modified called change time. Keeping access
time always up to date has significant performance overhead since every
read-only access will incur a write operation. Thus by default every file
system updates access time only if current file access time is older than a
day or if it is older than file modification or change time. This feature
is called relative access time and the corresponding
mount option is relatime
. Updates of access time can be
completely disabled using the noatime
mount option,
however you need to verify your applications do not use it. This can be
true for file and Web servers or for network storage. If the default
relative access time update policy is not suitable for your applications,
use the strictatime
mount option.
Some file systems (for example Ext4) also support lazy time stamp updates.
When this feature is enabled using the lazytime
mount
option, updates of all time stamps happen in memory but they are not
written to disk. That happens only in response to
fsync
or sync
system
calls, when the file information is written due to another reason such as
file size update, when time stamps are older than 24 hours, or when cached
file information needs to be evicted from memory.
To update mount options used for a file system, either edit
/etc/fstab
directly, or use the dialog when editing or adding a partition with the
YaST Partitioner.
9.3.3 Prioritizing Disk Access with ionice
#
The ionice
command lets you prioritize disk access
for single processes. This enables you to give less I/O priority to
background processes with heavy disk access that are not time-critical,
such as backup jobs. ionice
also lets you raise the
I/O priority for a specific process to make sure this process always has
immediate access to the disk. The caveat of this feature is that standard
writes are cached in the page cache and are written back to persistent
storage only later by an independent kernel process. Thus the I/O priority
setting generally does not apply for these writes. Also be aware that
I/O class and priority setting are obeyed only by
BFQ I/O scheduler for blk-mq I/O path (refer
to Section 13.2, “Available I/O Elevators with blk-mq I/O path”). You can set
the following three scheduling classes:
- Idle
A process from the idle scheduling class is only granted disk access when no other process has asked for disk I/O.
- Best effort
The default scheduling class used for any process that has not asked for a specific I/O priority. Priority within this class can be adjusted to a level from
0
to7
(with0
being the highest priority). Programs running at the same best-effort priority are served in a round-robin fashion. Some kernel versions treat priority within the best-effort class differently—for details, refer to theionice(1)
man page.- Real-time
Processes in this class are always granted disk access first. Fine-tune the priority level from
0
to7
(with0
being the highest priority). Use with care, since it can starve other processes.
For more details and the exact command syntax refer to the
ionice(1)
man page. If you need more reliable
control over bandwidth available to each application, use
Kernel Control Groups as described in
Chapter 10, Kernel Control Groups.