Performance Tuning on Linux

mrngm1 pts0 comments

Performance Tuning on Linux

-->

-->

-->

-->

Tuning File System and Network Performance

The Linux operating system is well designed<br>and it has good performance "out of the box,"<br>but some choices you can make when building<br>and installing your system can help improve<br>performance.<br>Some additional configuration changes including<br>kernel tuning may provide further performance<br>improvements.<br>Design the system well using appropriate storage<br>technology for both persistent disk storage and RAM.<br>Storage I/O will probably be the bottleneck.<br>In a data center, storage will include NFS and therefore<br>need Ethernet and TCP optimization below any NFS tuning.<br>We will see how to measure your system's performance<br>and tune some kernel parameters.

What hardware should be used?<br>Which file systems?<br>What kernel tuning for best disk and network I/O?<br>We can make some sweeping generalizations —<br>RAM and therefore solid-state drives are much<br>faster than rotating magnetic disks,<br>and we should offload processing into network hardware<br>and use at least NFS version 4.1 and later if possible.<br>But we will see that the full answer is often<br>"It depends"<br>and there is no one optimal solution<br>even within one organization.

We must select hardware and lay out the file systems first<br>for capacity planning, and later make adjustments<br>for performance tuning.<br>The must be done from the bottom up: NFS performance is<br>only possible if TCP has already been tuned, and<br>Ethernet tuned before that.

We want to address the bottlenecks,<br>it is pointless to tune something else first.<br>We should identify the changes that will make the<br>greatest improvement with the least change<br>and therefore expenditure of time and money.

Maximizing Return for Effort

Start with these simple improvements:

Have plenty of RAM.<br>The kernel will automatically tune file system<br>caching and buffering and network buffered based<br>on available RAM, give it enough to work with.

Mount file systems with access times disabled.<br>Use options noatime,nodiratime.

Don't let file systems get too full.<br>All file systems put to realistic use must fragment<br>some, but it gets rapidly worse when capacity gets<br>over some limit.<br>The threshold depends on how you use your file system<br>— huge number of small files, small number of<br>huge files, how much you delete and replace files,<br>how much you modify existing files.<br>I can't give you one specific number,<br>but very much over 90% full<br>is probably going to cause<br>noticeable slowdown for most anyone.

If those simple suggestions make you happy, that's great!<br>To go deeper, we will have to get into details of block I/O,<br>multiple buffers in protocol stacks, file system data<br>structures, and more.

Throughput Versus Latency

Let's look at physical-world analogies to the<br>throughput–versus–latency tradeoff<br>behind many of the decisions we must make.<br>We would like both high throughput and low latency<br>but improving one usually makes the other worse.

The simplest analogy is to ask which of these you need:<br>a faster car or a bigger truck?<br>A fast car is lower latency but less material moved,<br>a big truck moves more material per week but each load<br>takes longer.

Oil pipelines are another physical analogy.<br>Any large pipeline exhibits tradeoffs in throughput versus<br>latency analogous to those we encounter in data storage<br>and transmission systems.<br>Being physical systems,<br>vehicles and pipes are a little easier to understand.

Throughput and Latency in Pipes

Don't panic, this isn't on the exam!<br>If you really want to know about fluid dynamics, see

here re flow and<br>and

here re Reynolds number.

If you try to force liquid through a pipe too fast,<br>the flow becomes turbulent and reduces the amount of<br>liquid moved per unit of time.<br>To move a liquid through a pipe in a smooth streamline<br>or laminar flow a measure called the Reynolds number<br>must be less than about 2,000.<br>If it gets above 3,000 the flow becomes turbulent.<br>You calculate the Reynolds number or Re as:

Re

ρvDH

where:

density of the fluid (kg/m3)

velocity of the fluid (m/s)

DH<br>hydraulic diameter of pipe (m)

dynamic viscosity of the fluid<br>(N&middot;s/m2)

The point is that when you are trying to move a fluid through<br>a pipe, there is a limit to the speed at which it can move.<br>To keep the flow smooth, we must keep the Reynolds number<br>from climbing too high.<br>To multiply the velocity by some factor we must decrease<br>the diameter of the pipe by that same factor.<br>If the flow is to move three times as fast, the pipe must<br>be reduced to one third the diameter.

Since cross-section area increases as the square of diameter,<br>larger pipes can move more fluid per unit of time.<br>Cut the velocity in half, double the pipe diameter<br>(and quadruple the cross-section area), and we have<br>doubled the volume of fluid delivered per time period.

The Trans-Alaska Pipeline System<br>is an 800-mile-long pipeline running from<br>Prudhoe Bay on the northern coast of Alaska to Valdez and<br>the tanker shipping port on the southern coast.<br>This pipeline has a maximum...

performance file system must tuning systems

Related Articles