Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > 965e33040dd61030a94f0eb89877aee8 > files > 7223

howto-html-en-20080722-2mdv2010.1.noarch.rpm

<HTML
><HEAD
><TITLE
>Performance Considerations</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="The X Window User HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="X Networking and Security"
HREF="xsecurity.html"><LINK
REL="NEXT"
TITLE="Appendix"
HREF="appendix.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The X Window User HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="xsecurity.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="appendix.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="PERFORMANCE">9. Performance Considerations</H1
><P
> As has been discussed, what we call <SPAN
CLASS="APPLICATION"
>X</SPAN
>, is actually
 a convergence of various components: X server, Window Manager, Desktop, etc.
 With MS Windows, the GUI desktop is tightly integrated with the operating
 system itself. This is not the case in Linux which follows the Unix tradition
 of combining various independent components to achieve some end result. So we
 have choices with each component and it's attendant configuration and
 implementation. In short, much flexibility. This is where you come in. You
 can try various possibilities and decide what you gives you the most bang for
 the buck.&#13;</P
><P
> On low end hardware, this gives us much latitude to decrease the demand on
 available system resources. This is good because, if given the opportunity,
 <SPAN
CLASS="APPLICATION"
>X</SPAN
> can be quite greedy with system resources. If
 you've recently installed a new Linux distribution, you've probably been
 given a default Desktop with many bells and whistles. And something
 that will probably need a fair amount of memory and CPU to achieve a
 reasonable level of performance. If you have the horse power, this should not
 be a problem.&#13;</P
><P
> It is often said that Linux functions very well with relatively little
 memory. This is true to a point. It does not mean though that every possible
 configuration will run with low memory. So if you want to use memory hungry
 applications, then you will have to have the memory. Or you will have to make
 sacrifices to achieve a satisfactory level of performance. It is quite
 possible to run <SPAN
CLASS="APPLICATION"
>X</SPAN
> with reasonable performance on
 16 Meg of RAM, and even less if you really want to push it. But you would
 have to live with some real limitations.&#13;</P
><P
> Let's look at some of the components and ways to decrease the demand on
 system resources, in case you are at the low end on hardware, or performance
 is not up to expectations.</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1223">9.1. Hardware</H2
><P
> <P
></P
><UL
><LI
><P
> No big surprise, but overall system performance will be best with a fast
 graphics card, a fast hard drive, and lots and lots of memory -- if you want
 <EM
>both</EM
> a fast and flashy system.

 </P
></LI
><LI
><P
> Graphics cards are of course necessary, and the X server's video performance
 is tied to the card's chipset, and the corresponding XFree86 driver. Just
 because a given card is supported by XFree86 does not necessarily mean it is
 as well optimized as other cards! It may also perform better at a lower color
 depth (see below). It may well be worth the trip to xfree86.org to see if
 there are any notes related to your card with respect to performance or other
 issues.

 </P
></LI
><LI
><P
>  And you might try other versions of XFree86. At this time v4.2 was just
  recently released. Some cards may still perform better with 3.3.6 due to the
  way v4.x is being incrementally developed. If you are using x4.x and
  performance is not good, then make sure you are using the latest available
  version.

 </P
></LI
></UL
></P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1234">9.2. Memory</H2
><P
> The more memory, the better. <SPAN
CLASS="APPLICATION"
>X</SPAN
> will do a lot
 caching to help performance. But caching requires memory, and if there isn't
 much to start with, then we would need to reduce memory requirements. Some
 tips for those with low memory or performance problems:</P
><P
> <P
></P
><UL
><LI
><P
> Use the <B
CLASS="COMMAND"
>free</B
> command to make sure all memory and swap is
 recognized. 

 </P
></LI
><LI
><P
> Make sure you don't have other system services that are hogging memory or
 CPU. Use <B
CLASS="COMMAND"
>top</B
> or <B
CLASS="COMMAND"
>ps</B
> to see what is
 running, and disable anything you can to free up memory and CPU. Again, a
 default installation may have many things running that you don't really
 need.
 </P
></LI
><LI
><P
> Make sure you have plenty of swap space. With low, or even modest, memory,
 swap is all the more important. A general rule of thumb is twice as much swap
 as physical memory. With low memory, this is not enough. Try four times real
 memory. Or more. If you can't create more swap partitions, see the
 <B
CLASS="COMMAND"
>mkswap</B
> man page about creating swap files instead.
 Constant disk churning is a symptom of insufficient swap space, and the
 system will be slowed as a result, sometimes drastically. Or, possibly this
 may be the symptom of a poorly behaved kernel VM system (try another kernel
 in this case).

 </P
></LI
><LI
><P
> Drive performance is important for swap performance. Make sure your drive has
 DMA enabled if the drive supports it, and is otherwise tuned and performing
 up to snuff. See the <B
CLASS="COMMAND"
>hdparm</B
> man page. Slow drive + slow
 card + low memory = slow system.
 </P
></LI
><LI
><P
> Don't use <SPAN
CLASS="APPLICATION"
>KDE</SPAN
> or <SPAN
CLASS="APPLICATION"
>GNOME</SPAN
>
 if memory is tight. These both require substantial memory, and are not
 required to just run <SPAN
CLASS="APPLICATION"
>X</SPAN
>. Think of these as
 usability enhancements. 32M probably may not be enough. 64M may be decent,
 depending on what other applications are being used, and other variables. 128M
 <EM
>should</EM
> be adequate in most situations. 256M or more to
 be comfortable. File Managers like <SPAN
CLASS="APPLICATION"
>Nautilus</SPAN
> and
 <SPAN
CLASS="APPLICATION"
>gmc</SPAN
> can also be memory hungry. 
 
 </P
></LI
><LI
><P
> Use a lightweight window manger. <SPAN
CLASS="APPLICATION"
>WindowMaker</SPAN
>,
 <SPAN
CLASS="APPLICATION"
>BlackBox</SPAN
>, <SPAN
CLASS="APPLICATION"
>IceWM</SPAN
>,
 <SPAN
CLASS="APPLICATION"
>fvwm</SPAN
> (and variants),
 <SPAN
CLASS="APPLICATION"
>XFce</SPAN
>, all have reputations of performing well with
 low memory. There are surely others as well. Experiment.
 <SPAN
CLASS="APPLICATION"
>fvwm</SPAN
> is generally considered the lightest of the
 light. </P
><P
> A very nice desktop is still very possible even without
 <SPAN
CLASS="APPLICATION"
>KDE</SPAN
> or <SPAN
CLASS="APPLICATION"
>GNOME</SPAN
>. In fact,
 most <SPAN
CLASS="APPLICATION"
>KDE</SPAN
> and <SPAN
CLASS="APPLICATION"
>GNOME</SPAN
>
 applications can still be used even if <SPAN
CLASS="APPLICATION"
>KDE</SPAN
> and
 <SPAN
CLASS="APPLICATION"
>GNOME</SPAN
> are not running themselves (assuming the
 right libs are installed).
 
 </P
></LI
><LI
><P
> Don't use fancy themes or backgrounds. Plain and simple is easier on
 resources. Use a solid color background. Avoid pixmaps or gradients for any
 kind of background, including menus, title bars, etc.
 </P
></LI
><LI
><P
> Use a lesser screen size and color depth. 800x600x16 will not push
 <SPAN
CLASS="APPLICATION"
>X</SPAN
> as hard and be easier on system resources than
 higher values. While a ColorDepth of 24 is preferred, you probably will not
 notice the difference of 16 with the majority of applications.
 </P
></LI
><LI
><P
> Some applications require much more memory than others. Some notable hogs are
 <B
CLASS="COMMAND"
>Netscape</B
>, <B
CLASS="COMMAND"
>Mozilla</B
>, office suites, and
 <B
CLASS="COMMAND"
>the Gimp</B
>. <B
CLASS="COMMAND"
>Netscape</B
> is faster than
 <B
CLASS="COMMAND"
>Mozilla</B
> (but not as nice).
 <B
CLASS="COMMAND"
>Netscape-Navigator</B
> uses less memory than
 <B
CLASS="COMMAND"
>Netscape-Communicator</B
>. Close any of these apps when not in
 use. Use text browsers like <B
CLASS="COMMAND"
>lynx</B
> or <B
CLASS="COMMAND"
>w3m</B
>
 wherever you can, like reading locally installed HTML documentation. Much
 faster, and much less memory is required. 
 </P
></LI
><LI
><P
> Also, use text based clients for mail (<B
CLASS="COMMAND"
>mutt</B
> or
 <B
CLASS="COMMAND"
>pine</B
>) and news (<B
CLASS="COMMAND"
>slrn</B
> or
 <B
CLASS="COMMAND"
>trn</B
>). Again, faster and much less memory is used, 
 and these are after all text based protocols at heart anyway.
 </P
></LI
><LI
><P
> <B
CLASS="COMMAND"
>rxvt</B
> uses less memory than <B
CLASS="COMMAND"
>xterm</B
>,
 <B
CLASS="COMMAND"
>konsole</B
> or <B
CLASS="COMMAND"
>gnome-terminal</B
>.
 </P
></LI
><LI
><P
> If you run an <SPAN
CLASS="APPLICATION"
>X</SPAN
> session for long periods of time
 (like days or weeks), restart <SPAN
CLASS="APPLICATION"
>X</SPAN
> occasionally to
 free memory tied up as cache.
 </P
></LI
><LI
><P
>  
  Disable <SPAN
CLASS="QUOTE"
>"backing store"</SPAN
> and <SPAN
CLASS="QUOTE"
>"save-unders"</SPAN
> to
  reduce memory usage (performance penalty though). Check
  your Window Manager's settings too. See what modules are being loaded 
  in the <SPAN
CLASS="QUOTE"
>"Modules"</SPAN
> section of <TT
CLASS="FILENAME"
>XF86Config</TT
> as
  well. Your installation may have many unnecessary ones enabled, or ones you
  can't take advantage of (e.g. <SPAN
CLASS="QUOTE"
>"v4l"</SPAN
>, aka
  <SPAN
CLASS="QUOTE"
>"Video4Linux"</SPAN
>).
 </P
></LI
><LI
><P
>  
  Font servers may provide a slight performance boost by off-loading font
  rendering to the font server, while freeing the X server to do other things.
  But, the font server will use a small additional amount of memory as well.
  So, you can try it either way to see if it makes a difference.
 </P
></LI
><LI
><P
> Lastly, RAM is cheap now. Buy some ;-) A new drive too.
 </P
></LI
><LI
><P
> RAM is still just too low for <SPAN
CLASS="APPLICATION"
>X</SPAN
>? Check out
 <SPAN
CLASS="APPLICATION"
>tinyX</SPAN
>: 
 <A
HREF="http://www.superant.com/smalllinux/tinyX01.html"
TARGET="_top"
>http://www.superant.com/smalllinux/tinyX01.html</A
>.
 Reportedly runs in as little as 4 Meg of RAM.

 </P
></LI
></UL
></P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1325">9.3. X over the Network</H2
><P
> X is not particularly network friendly. In other words, it is a bandwidth
 hog. This should not be a problem in LAN situations, but may be if trying to
 use X over the Internet.</P
><P
> <P
></P
><UL
><LI
><P
>     <B
CLASS="COMMAND"
>lbxproxy</B
>, the low bandwidth X proxy, utilizes 
     various optimizations to improve performance in low bandwidth, or 
     high latency situations. See the man page.
   </P
></LI
><LI
><P
>     VNC (Virtual Network Computing), has some of the same advantages as 
     X for displaying applications on remote systems, but is more network
     friendly. Your Linux installation should have both VNC client and server
     packages available.
   </P
></LI
></UL
></P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1335">9.4. Other Tips</H2
><P
> Other tips to eek out better performance:</P
><P
> <P
></P
><UL
><LI
><P
> Use <B
CLASS="COMMAND"
>xset</B
> to speed up the keyboard. This can make the
 system feel more responsive even if it isn't really. The default always
 seemed sluggish to me. 
 </P
></LI
><LI
><P
> <B
CLASS="COMMAND"
>renice</B
> <SPAN
CLASS="APPLICATION"
>X</SPAN
> to give it a higher
 priority. Other platforms give the GUI high scheduling priority to achieve
 better responsiveness. But this is at a cost to other processes. Linux is a
 blank slate. You might include the font server (if being used), and key
 <SPAN
CLASS="APPLICATION"
>KDE</SPAN
> and <SPAN
CLASS="APPLICATION"
>GNOME</SPAN
> processes
 as well. </P
><P
> <TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>&#13; nice -n -10 X :0

 </PRE
></FONT
></TD
></TR
></TABLE
></P
><P
> This won't do much on systems that are mostly idle.&#13;</P
><P
> This does not work so well with <B
CLASS="COMMAND"
>startx</B
> since
 <SPAN
CLASS="APPLICATION"
>X</SPAN
> runs as root, and you're not root, right? So
 you'd have to use something like <B
CLASS="COMMAND"
>sudo</B
> to have this done
 automatically.

 </P
></LI
></UL
></P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="xsecurity.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="appendix.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><SPAN
CLASS="APPLICATION"
>X</SPAN
> Networking and Security</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Appendix</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>