Sidebar: Memory Utilization and X
X applications are rarely less than 1 megabyte (MB),
so the enemy
of X Windows is low memory. When UNIX runs out of memory
it begins
to swap. Performance hits rock bottom and can even lead
to a disaster
such as broken pipes, or other system problems related
to swapping
portions of memory to disk. To reduce memory "paging,"
the
system must be reconfigured to provide additional memory
to X applications.
To achieve this, you can simply increase the amount
of physical memory
installed in the computer. If the system is at its maximum
installable
memory, or if you can't spend the money on more memory,
the sizes
of the filesystems' buffers and other kernel data structures
can be
reduced. Remember, though, that reducing the buffers
may also reduce
disk performance. Another option is to alter the paging
algorithm
so that the system begins paging earlier. However, this
alternative
is only useful when the shortage of memory is relatively
small.
It's generally a good idea to install maximum RAM on
the workstation
where X will be operating. Intel workstations require
at least 16
megabytes, but 32 megabytes is much better, and 64 megabytes
is best.
X Terminals require at least 4 megabytes of memory to
process a reasonable
number of X or Motif applications at a respectable speed.
The only sure way to increase performance and cut memory
consumption
is to monitor the number of X applications that are
executed by the
users. Users may not need xclock, xeyes, or xload.
The X Window system makes heavy use of buffers, generally
opting for
smaller (usually 128 bytes or less) rather than larger
buffers. Most
systems with X installed need to increase the value
of NBLKn,
as noted in the article.
Running the Buffer Cache Subsystem
Although disk I/O is not a primary concern with X Window
performance,
it does affect the performance of some X applications
and is certainly
a factor if the system is paging. When an I/O device
request is made
to a disk drive, the buffer cache system provides intermediate
storage
for information moving back and forth from the tracks
of the disk.
The buffer cache subsystem improves performance, which
allows the
I/O to make sizable ordered transfers, thereby minimizing
seek time
on the physical disk drive. It also allows programs
to, whenever possible,
read and write from cache memory instead of going to
disk.
The type of buffer cache subsystem differs among UNIX
systems, but
the basic concept is similar. The buffering cache subsystem
is handled
by the kernel, which allocates a portion of memory for
buffer cache
space. This portion of memory is configurable (see the
NBUF parameter).
The kernel then writes to memory as if writing to a
file. At some
point, the modified information is written to disk.
The interval at
which the information is written from memory to disk
is configurable
(see NAUTOUP).
The size of the buffer cache is configurable in most
UNIX operating
systems. This is the major tuning parameter NBUF, and
is the
cause or cure for most system and disk I/O performance
problems. A
system with a lot of memory may have a large buffer
cache system because
the buffer cache may be a greater memory consumer than
the kernel
itself.
So what is optimal buffer cache size for X Windows?
You must compromise.
The more memory you allocate to the buffer cache, the
less you have
for user programs and processes, and vice-versa. When
buffer cache
memory is reduced to make room for more or larger processes,
disk
I/O performance suffers.
|