📄 00000000.htm
字号:
is, if you have anything that runs really heavy disk I/O like web <BR>page logging put it on the fastest drive you've got. If you have <BR>a RAID drive and a normal drive make sure that all your log <BR>activities write to the RAID disk. <BR> <BR>/ contains most of the system utilities and doesn't get used <BR>much. These can be shipped off to the slowest disk. <BR> <BR>/var/log contains a _lot_ of logging information. Best on a fast <BR>disk <BR> <BR>/usr is typically on a separate partition anyway. Place it <BR>wherever, but if you have a lot of clients starting lots of X <BR>applications, some speedy disk may be in order. <BR> <BR>Before deciding on your partitioning scheme, you really need to <BR>know exactly what sort of applications you will be running. Here <BR>are two typical examples of the sorts of configurations that you <BR>need to know about: <BR> <BR>Mail: Sendmail writes to two main locations mail queue (usually <BR>/var/spool/mqueue and /var/spool/mail as well as possibly having <BR>to read into a user's home directory for a procmail configuration <BR>OR .forward file. If you are attempting to boost sendmail <BR>performance and nfs mounted mail queue, mail spool, or home <BR>directories might cause some serious issues and you'll have to <BR>take a look into your mail scheme. For more information, you <BR>should look at the section on mail server tuning. <BR> <BR>Apache uses several different files, two logs files for logging <BR>and access to the actual pages. While you may think that you want <BR>your web pages on the fastest drive, apache spends quite a bit of <BR>time writing to logs files. You will want to make sure that you <BR>take this into consideration in developing a partition scheme. <BR> <BR>2.5 Swap Space <BR> <BR>Swap partitions. How often do we see someone screwing up a <BR>perfectly good system by a badly configured swap space? The <BR>difference can be phenomenal. <BR> <BR>Always have swap space on a separate partition(s). The use of <BR>swap files can really grind a system to a halt under even <BR>moderate load. When using a swap file, it adds an extra layer of <BR>system calls for every write and read. Instead of talking to <BR>"raw" disk, you are writing into the filesystem. Access to the <BR>raw filesystem will be quicker <BR> <BR>Two smaller swaps on two disks is better than one big one on a <BR>single disk. Based on the same reasons as earlier, there is also <BR>an advantage to using RAID for your swap partition as well. <BR> <BR>If possible, make the swap partition the first partition on the <BR>disk (it is physically located closest to the outer edge of the <BR>hard drive platter). There can be up to a factor of 2 difference <BR>in transfer rates for data out on the edge compared to the middle <BR>of the disk. As the kernel uses swap space as extra memory, the <BR>quicker you can get this stuff on and off disk, the better your <BR>performance. <BR> <BR>Have at least twice the amount of physical RAM set aside as swap <BR>space. <BR> <BR>2.6 Further information <BR> <BR> From the Configuration HOWTO: General System Setup <BR> <A HREF="http://metalab.unc.edu/LDP/HOWTO/Config-HOWTO-2.html#ss2.4">http://metalab.unc.edu/LDP/HOWTO/Config-HOWTO-2.html#ss2.4</A> <BR> Multi Disk System Tuning HOWTO <BR> <A HREF="http://metalab.unc.edu/LDP/HOWTO/Multi-Disk-HOWTO.html">http://metalab.unc.edu/LDP/HOWTO/Multi-Disk-HOWTO.html</A> <BR> Large Disk HOWTO <BR> <A HREF="http://metalab.unc.edu/LDP/HOWTO/mini/Large-Disk.html">http://metalab.unc.edu/LDP/HOWTO/mini/Large-Disk.html</A> <BR> Software-RAID HOWTO <BR> <A HREF="http://metalab.unc.edu/LDP/HOWTO/mini/Software-RAID.html">http://metalab.unc.edu/LDP/HOWTO/mini/Software-RAID.html</A> <BR> Ultra-DMA Mini HOWTO <BR> <A HREF="http://metalab.unc.edu/LDP/HOWTO/mini/Ultra-DMA.html">http://metalab.unc.edu/LDP/HOWTO/mini/Ultra-DMA.html</A> <BR> <BR>3. Networking <BR> <BR>TBD <BR> <BR>3.1 Further information <BR> <BR>4. Memory <BR> <BR>The final piece of the basic tuning is to look at the use of <BR>memory in your machine. This is not just the main memory (RAM), <BR>but the use of caches and access between the various levels of <BR>memory. <BR> <BR>4.1 Unix Memory <BR> <BR>In order to understand how memory can be optimised, you need to <BR>know a little about how the underlying operating system allocates <BR>memory to applications. Since Linux is a form of Unix, it follows <BR>many of the same basic principles, so well talk about general <BR>unix models here. <BR> <BR>Unix uses an "Always Full" model for memory. All memory is always <BR>being used, as in, it always contains some form of data. <BR>Typically this is used to buffer information from slower forms of <BR>memory like hard disks etc. Whether or not that information is <BR>relevant is inconsequential. <BR> <BR>The first thing a unix box does when it starts up is grab all the <BR>memory and divide it into a number of chunks. Typically this <BR>consists of: <BR> <BR>Kernel Space <BR> A memory space that is reserved exclusively for the kernel <BR> to use and abuse. This is the minimal breathing area needed <BR> for the kernel to run scheduling, keep itself permanently in <BR> memory and other really important stuff like device drivers <BR> etc. <BR>User Space <BR> The memory space used to keep application level code. This <BR> is all applications - even server processes like web/mail <BR> servers, a user login shell or X Windows. Inside the user <BR> space, each application (process) has its own block of space <BR> to operate. No other application is allowed to invade this <BR> space. If it does, the typical result is a core dump. (There <BR> are caveats to this for things like Shared Memory usage that <BR> puts in an explicit common space.) <BR>Buffer Space <BR> This is basically everything else of the memory that is not <BR> taken up by the requirements of user and kernel space. This <BR> is used to buffer I/O for disks, network cards etc. Also, <BR> importantly, this is used for DMA transfers between devices <BR> to make things much quicker. Buffering is applied to both <BR> read and write operations. Attempt to write something to <BR> disk, and it will be first written to memory and then at <BR> some later time it will be written to the physical media as <BR> well. <BR> <BR>The job of the kernel is to manage all of these different spaces <BR>according to the requirements of the currently running processes. <BR>When you attempt to start a new application, it must first find <BR>some memory to use that is big enough, allocate it and then start <BR>your application. If there is not enough physical RAM, it must <BR>make some by swapping out onto disk another application, or maybe <BR>raid buffer space, and then copy your application into memory <BR>before beginning the execution. Some of this task involves <BR> re-arranging memory to get a contiguous chunk of space large <BR>enough. (Coincidently, these are also why applications on Unix <BR>machines tend to appear to typically take longer to start than <BR>the equivalent Win32 or MacOS app). <BR> <BR>><I>From this you should be starting to see some of the problems </I><BR>that could occur that make your machine run slowly. Too little <BR>RAM and the kernel spends its time swapping (commonly known as <BR>Thrashing when it gets bad). Badly setup swap space and it slows <BR>down that operation. Too many apps running and the kernel spends <BR>all its time searching for new space or re-arranging memory to <BR>fit. <BR> <BR>4.2 Memory Types <BR> <BR>Over the years, the typical PC memory chip has gone through a <BR>whole swathe of acronyms. Lets look at a few of them: <BR> <BR> DRAM: Dynamic RAM. The original memory type. Could <BR> allow one operation at once: read or write. <BR> <BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -