[HVLabCompendium] / trunk / hvlab.1.tex Repository:
ViewVC logotype

Annotation of /trunk/hvlab.1.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download) (as text)

1 : mark 1 \documentclass{book}
2 :    
3 :     \author{Oslo University College, Norway\\~\\Mark Burgess and Claudia Eriksen}
4 :     \title{\sc High Volume Services Laboratory Handbook\\Version 0.1}
5 :     \date{\today}
6 :    
7 :     \usepackage{times} % -- good
8 :     \usepackage{fancyheadings}
9 :     \usepackage{tocloft}
10 :    
11 :     %\usepackage{amsthm}
12 :     \usepackage{a4}
13 :     %\usepackage{shadethm}
14 :     \pagestyle{fancyplain}
15 :     \lhead[\fancyplain{}{}]{\fancyplain{}{\rightmark}}
16 :     \rhead[\fancyplain{}{\leftmark}]{\fancyplain{}{}}
17 :    
18 :    
19 :     %\textheight 20cm
20 :     \textwidth 15.5cm
21 :     \oddsidemargin -20pt
22 :     \evensidemargin -20pt
23 :    
24 :    
25 :     %\topmargin -30pt
26 :     \usepackage{url}
27 :     \usepackage{tabularx}
28 :     \usepackage{fancybox}
29 :     \usepackage{fancyvrb}
30 :     \usepackage{epsfig}
31 :     %\usepackage{alltt}
32 :    
33 :    
34 :    
35 :     \urlstyle{rm}
36 :     %\def\UrlFont{\em}
37 :    
38 :    
39 :     \newenvironment{code}%
40 :     {\begin{Sbox}\begin{minipage}{.9\textwidth}\scriptsize}%
41 :     {\end{minipage}\end{Sbox}%
42 :     \begin{center}\setlength{\fboxsep}{2pt}\setlength{\fboxrule}{1pt}%
43 :     \fbox{\TheSbox}\end{center}}
44 :    
45 :    
46 :     \def\sex{\begin{alltt}\small}
47 :     \def\esex{\end{alltt}}
48 :     \def\ex{\begin{alltt}}
49 :     \def\eex{\end{alltt}}
50 :     \def\code{\tt\small}
51 :     \def\file{\tt\small}
52 :     \def\href{\tt\small}
53 :     \def\samp{\tt\small}
54 :     \def\kbd{\tt\small}
55 :     \def\key{\sc}
56 :     \def\var{\em}
57 :     \def\beq{\begin{eqnarray}}
58 :     \def\eeq{\end{eqnarray}}
59 :     \def\2{\frac{1}{2}}
60 :    
61 :     %\setcounter{tocdepth}{1}
62 :    
63 :    
64 :    
65 :     %\newshadetheorem{expt}{Experiment}
66 :     %\newshadetheorem{defin}{Definition}
67 :     %\newtheorem*{corollary}{Corollary to principle}
68 :     %\newshadetheorem{suggestion}{Suggestion}
69 :     \newtheorem{example}{Example}
70 :     \newtheorem{question}{Question}
71 :     \makeindex
72 :    
73 :    
74 :     \begin{document}
75 :     %\begin{figure}[ht]
76 :     %\psfig{file=NetlabCover.eps,width=14cm}
77 :     %\end{figure}
78 :     \maketitle
79 :     \bibliographystyle{plain}
80 :    
81 :     %\setlength{\cftchapnumwidth}{18pt}
82 :     %\setlength{\cftsecnumwidth}{31pt}
83 :     %\setlength{\cftsubsecnumwidth}{40pt}
84 :    
85 :     \tableofcontents
86 :    
87 :    
88 :    
89 :     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90 :    
91 :     \chapter{Introduction}
92 :    
93 :     This is a working document. It will eventually be a handbook for a laboratory
94 :     course in server room design.
95 :    
96 :    
97 :     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
98 :    
99 :     \part{Data Centre Science}
100 :    
101 :     \chapter{Safety and responsibility in the Lab}
102 :    
103 :    
104 :     Oslo University College is committed to providing a safe and healthy
105 :     working environment for its students and staff. You are expected to
106 :     learn working practices that you will take with you when you leave
107 :     the College. It is your ethical duty to spread safe working practices
108 :     and procedures beyond this College in the workplace.
109 :    
110 :    
111 :     Oslo University College requires its students, staff, and faculty to
112 :     adhere to basic General Laboratory Safety Rules in the Electrical
113 :     Engineering laboratories.
114 :    
115 :     These rules apply to everyone. If you see someone ignoring the rules,
116 :     it is your duty to remind them of their responsibilities.
117 :    
118 :     \noindent {\em This discipline is a mark of professionalism -- it is not for
119 :     annoyance or for show. You might find other labs that do not care about
120 :     safety, but as a student of Oslo University College, we expect the highest
121 :     standards.}
122 :    
123 :     \section{General Laboratory Safety Rules}
124 :    
125 :     \begin{enumerate}
126 :     \item The lab is a dry and noisy environment. You should try to organize
127 :     your work so that you do not spend more than three or four hours in the lab
128 :     at any one time. If you need to talk to your work partners, go out of the
129 :     lab into a quiet area rather than shouting.
130 :    
131 :     \item Food and drink must not be brought into, stored in
132 :     or consumed in a laboratory.
133 :    
134 :     \item Never wear personal headphones or play music to drown out the noise:
135 :     you can damage your hearing by playing loud music, and cause accidents by
136 :     being distracted. Your full attention should be on your work.
137 :    
138 :     \item Shoes must be worn, and appropriate
139 :     personal clothing shall be worn in laboratories.
140 :    
141 :     \item Do not wear items of metal jewelry when using electronic equipment. You might cause a short-circuit, get a shock or get the jewelry caught in something.
142 :    
143 :     \item Bags and coats should be left at the doorway.
144 :    
145 :     \item {\em BE TIDY AND TREAT ALL EQUIPMENT WITH RESPECT}. Do not tread on or run over cables with
146 :     chairs or heavy objects.
147 :    
148 :     \item Never drop items on the floor. Always put equipment in the correct box or storage place provided for it. Fold cables neatly to avoid long-term damage to them.
149 :    
150 :     \item Learn and know what to do in an emergency.
151 :    
152 :     \item Do not expose yourself or others to risk. Do not joke around in the lab.
153 :    
154 :     \item Un-authorized persons MUST NOT be admitted to the laboratory.
155 :    
156 :     'Authorized' means having business in the laboratory with the permission
157 :     of the College. No-one under the age of eighteen
158 :     may enter the lab unsupervised. Only trained individuals and students enrolled in courses using the lab may touch the equipment.
159 :    
160 :     \item Laboratory shall remain locked when unoccupied.
161 :     \item Never open (remove cover) of any equipment in the laboratories, unless you are
162 :     instructed to do so.
163 :     \item Report all problems to drift@iu.hio.no (extensions 3268/3264/3263)
164 :     \end{enumerate}
165 :    
166 :     \section{Electrical Safety Guidelines}
167 :    
168 :     \begin{enumerate}
169 :     \item Be familiar with the electrical hazards associated with your workplace.
170 :    
171 :     \item Be as careful for the safety of others as for yourself. Think before
172 :     you act. Be tidy and systematic.
173 :     \item Avoid bulky, loose or trailing clothes. Avoid long loose hair. Remove
174 :     metal bracelets or watch-straps.
175 :    
176 :     \item Do not take food or drink into the laboratory. Avoid wet
177 :     hands and clothing. \item Use extension cords (skj\o
178 :     teledninger) only when necessary and only on a temporary basis.
179 :     Request new power outlets if your work requires equipment in an
180 :     area without an outlet.
181 :    
182 :     \item ALWAYS report damaged cords and cables, including cables that become hot, or with
183 :     exposed wiring. Never ignore these or replace them for others to use.
184 :    
185 :    
186 :     \item Experiments left unattended should be isolated. If
187 :     for a special reason, it must be left on, a barrier and a warning notice
188 :     are required.
189 :     \item Equipment found to be faulty in any way should be reported immediately
190 :     and not used until it is inspected and declared safe.
191 :    
192 :     \item Voltages above 50 V RMS AC and 120 V DC are always dangerous. Extra precautions
193 :     should be considered as voltage levels are increased.
194 :    
195 :     \item Never make any changes to circuits or mechanical layout without first
196 :     isolating the circuit by switching off and removing connections to supplies.
197 :    
198 :     \item Know what you must do in an emergency.
199 :    
200 :     \item Be acquainted with the Emergency Power Off:
201 :    
202 :    
203 :     \item When touching equipment that might be electrically "live" always use the {\em back of your hand}. Never grip anything with your fingers, since and electric shock will tend to make you grip tighter.
204 :    
205 :     \item Electrical power sockets should not be overloaded.
206 :    
207 :     \item {\b No cables should ever be stretched.} Tape them firmly to a table or floor. Remember that people can trip over cables.
208 :    
209 :     \item Hold the plug firmly by the insulating cover when plugging it in or unplugging it.
210 :     {\bf NEVER} unplug an electrical device by pulling on its cord!
211 :    
212 :     \item Do not attempt to lift or move heavy equipment alone.
213 :    
214 :     \end{enumerate}
215 :    
216 :     \section{Electrical Emergency Response}
217 :    
218 :     The following instructions provide guidelines for handling two types
219 :     of electrical emergencies:
220 :    
221 :    
222 :     When someone suffers serious electrical shock, he or she may be
223 :     knocked unconscious. If the victim is still in contact with the
224 :     electrical current, immediately turn off the electrical power
225 :     source. If you cannot disconnect the power source, push in the
226 :     Emergency Power Off button.
227 :     \begin{enumerate}
228 :    
229 :     \item Do not touch a victim that is still in contact with a power source; you
230 :     could electrocute yourself.
231 :    
232 :     \item Have someone call for emergency medical assistance immediately. Administer
233 :     first-aid, as appropriate.
234 :    
235 :     \item If an electrical fire occurs, try to disconnect the electrical power
236 :     source, if possible.
237 :    
238 :    
239 :    
240 :     \item In case of fire, pull out power sockets if possible, taking care not to be electrocuted.
241 :     \item Use of {\bf clean water} to put out electrical fire is acceptable.
242 :     \end{enumerate}
243 :    
244 :    
245 :     \section{Handling equipment}
246 :    
247 :    
248 :     All electronic equipment should be treated as highly fragile and
249 :     easily damaged, regardless of how sturdy it is. Today we are far too
250 :     blas\'e towards electronic equipment.
251 :     \begin{itemize}
252 :     \item Never insert or remove power cords to equipment without ensuring that it is switched off.
253 :     \item Take care when inserting multi-pin connectors that the pins are oriented the right way up and that no pins are bent on insertion.
254 :     \end{itemize}
255 :     Moreover:
256 :     \begin{itemize}
257 :     \item {\em Read instructions:}
258 :     When dealing with hardware, one should always look for and {\em read}
259 :     instructions in a manual. It is foolish to make assumptions about expensive
260 :     purchases. Instructions are there for a reason.
261 :     \item {\em Interfaces and connectors:}
262 :     Hardware is often connected to an interface by a cable or connector.
263 :     Obtaining the correct cable is of vital importance. Many manufacturers
264 :     use cables which look similar, superficially, but which actually are
265 :     different. An incorrect cable can result in damage to an interface.
266 :     Modem cables in particular can damage a computer or modem if they
267 :     are incorrectly wired, since some computers supply power through these
268 :     cables which can damage equipment which does not expect to find a
269 :     power supply coming across the cable.
270 :    
271 :     \item {\em Handling components:}
272 :     Modern day CMOS chips work at low voltages (typically 5 volts or lower).
273 :     Standing on the floor with insulating shoes, you can pick up a
274 :     static electric charge of several thousand volts. Such a charge
275 :     can instantly destroy computer chips. Before touching any
276 :     computer components, earth yourself by touching the metal
277 :     casing of the computer. If you are installing equipment inside
278 :     a computer, wear a conductive wrist strap. Avoid wearing rubber sandals
279 :     or shoes that insulate you from Earth when dealing with
280 :     open case equipment, since these cause the body to
281 :     build up charge that can discharge through that equipment; on the
282 :     other hand this might be good advice when working around high voltage
283 :     or current sources.
284 :     \index{Components, handling}
285 :     \index{Handling components}
286 :    
287 :     \item {\em Disks:}
288 :     Disk technology has been improving steadily for two decades. The most
289 :     common disk types, in the workplace, fall into two families: ATA
290 :     (formerly IDE) and SCSI. The original IDE (Integrated Drive
291 :     Electronics) and SCSI (Small Computer Software Interface) had
292 :     properties that have since evolved faster than the prejudices about
293 :     them. ATA (formerly IDE) disks are now generally cheaper than SCSI
294 :     disks (due to volume sales) and excel at sequential access, but SCSI
295 :     disks have traditionally been more efficient at handling multiple
296 :     accesses due to a multitasking bus design, and are therefore better in
297 :     multitasking systems, where random access is important. However,
298 :     filesystem design also plays an important role in determining the
299 :     perceived performance of each; i.e. how operating systems utilize
300 :     buses during updates is at least as important as bus performance
301 :     itself. Interesting comparisons show that IDE technology has caught up
302 :     with the head start that SCSI disks once had\cite{white1} for many
303 :     purposes, but not all.
304 :    
305 :     SCSI\cite{lisa93157} comes in several varieties, SCSI 1, SCSI
306 :     2, wide SCSI, fast-wide etc. The difference has to do with the width
307 :     of the data-bus and the number of disks which can be attached to each
308 :     controller. There are presently three SCSI standards SCSI-1, SCSI-2
309 :     and SCSI-3. The SCSI-2 standard defines also wide, fast and fast/wide
310 :     SCSI.
311 :     Each SCSI disk has its own address (or number) which must be set by
312 :     changing a setting on the disk-cabinet or by changing jumper settings
313 :     inside the cabinet. Newer disks have programmable identities.
314 :     \index{SCSI disks}
315 :     \index{IDE disks}
316 :     \index{ATA disks}
317 :     Disk chain buses must be terminated with a proper terminating
318 :     connector. Newer disks often contain automatic termination mechanisms
319 :     integrated into the hardware.
320 :     The devices on the SCSI bus talk to the computer through a
321 :     controller. On modern PCs the SCSI controller is usually connected to
322 :     the PCI bus either as an on-board solution on motherboards or as a
323 :     separate card in a PCI slot. Other buses are also used as the carrier
324 :     of the SCSI protocol, like FireWire (IEEE 1394) and USB. The SCSI
325 :     standard also supports removable media devices (CD-ROM, CD-R, Zip
326 :     drives), video frame grabbers, scanners and tape streamers (DAT, DLT).
327 :    
328 :    
329 :     \item {\em Memory:}
330 :     Memory chips are sold on small pluggable boards. They
331 :     are sold in different sizes and with different speeds.
332 :     A computer has a number of slots where they can be installed.
333 :     When buying and installing RAM, remember
334 :     \index{SIMM}
335 :     \begin{itemize}
336 :    
337 :     \item The physical size of memory plug-ins is important. Not all of
338 :     them fit into all sockets.
339 :    
340 :     \item Memory is sold in units with different capacities and data rates. One
341 :     must find out what size can be used in a system. In many cases one
342 :     may not mix different types.
343 :    
344 :     \item There are various incompatible kinds of RAM that work in
345 :     different ways. Error correcting RAM, for instance, is tolerant to
346 :     error from external noise sources like cosmic rays and other ultra
347 :     short wave disturbances. It is recommended for important servers,
348 :     where stability is paramount.
349 :    
350 :     \item On some computers one must fill up RAM slots in a particular
351 :     order, otherwise the system will not be able to find them.
352 :     \end{itemize}
353 :    
354 :     \end{itemize}
355 :    
356 :    
357 :     \index{Weather}
358 :     Another aspect of hardware is the extent to which weather and
359 :     environment are important for operation..
360 :    
361 :     \begin{itemize}
362 :    
363 :     \item {\em Lightning:}
364 :     strikes can destroy fragile equipment. No fuse will protect hardware
365 :     from a lightning strike. Transistors and CMOS chips burn out much faster
366 :     than any fuse. Electronic spike protectors can help here, but nothing
367 :     will protect against a direct strike.
368 :    
369 :     \item {\em Power:}
370 :     failure can cause disk damage and loss of data. A UPS
371 :     (Un-interruptible power supply) can help.
372 :    
373 :     \item {\em Heat:}
374 :     The blazing summer heat or a poorly placed heater oven can cause
375 :     systems to overheat and suddenly black out. One should not let the
376 :     ambient temperature near a computer to rise much above about 25
377 :     degrees Centigrade. Clearly some equipment can tolerate heat, better
378 :     than other equipment. Bear in mind that metals expand significantly,
379 :     so moving parts like disks will be worst affected by heat. Increased
380 :     temperature also increases noise levels that can reduce network
381 :     capacities by a fraction of a percent. While this might not sound like
382 :     much, a fraction of a percent of a Giga-bit cable is a lot of
383 :     capacity. Heat can cause RAM to operate unpredictably and disks to
384 :     misread/miswrite. Good ventilation is essential for computers and
385 :     screens for avoiding electrical faults.
386 :    
387 :     \item {\em Cold:}
388 :     Sudden changes from hot to cold are just as bad. They can
389 :     cause unpredictable changes in electrical properties of chips and
390 :     cause systems to crash. In the long term, these changes could lead
391 :     to cracks in the circuit boards and irreparable chip damage.
392 :    
393 :     \item {\em Humidity:} In times of very cold weather and very
394 :     dry heat, the humidity falls to very low levels. At these times, the
395 :     amount of static electricity builds up to quite high levels, without
396 :     dissipating. This can be a risk to electronic circuitry. Humans pick
397 :     up charge just by walking around, that can destroy fragile
398 :     circuitry. Paper sticks together causing paper crashes in laser
399 :     printers. Too much humidity can lead to condensation and short circuits.
400 :    
401 :     \end{itemize}
402 :     How could you go about verifying that conditions in the lab are
403 :     appropriate?
404 :    
405 :    
406 :     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
407 :    
408 :    
409 :    
410 :     \chapter{Power in the lab}
411 :    
412 :     Power consumption is the flow of energy per unit time in or out of a system.
413 :     It is measured in Joules per second, or Watts or Volt-Amperes, which
414 :     are all equivalent.
415 :    
416 :     Look at the excellent information on Wikepedia about international mains supplies.
417 :    
418 :     \begin{itemize}
419 :     \item http://en.wikipedia.org/wiki/Mains\_electricity
420 :    
421 :     \item http://en.wikipedia.org/wiki/Domestic\_AC\_power\_plugs\_and\_sockets
422 :    
423 :     \item http://en.wikipedia.org/wiki/List\_of\_countries\_with\_mains\_power\_plugs,\_voltages\_and\_frequencies
424 :     \end{itemize}
425 :    
426 :     The following text is from Wikepedia:
427 :     \bigskip
428 :    
429 :     \framebox{
430 :     \begin{minipage}[t]{0.8\linewidth}
431 :    
432 :     {\em European and most other countries use a supply that is within 10\% of
433 :     230 V, whereas Japan and most of the Americas use between 100 and 127
434 :     V. Following voltage harmonisation co-ordinated with CENELEC
435 :     countries, all electricity supply within the EU is now nominally 230 V
436 :     +/− 10\% (though some countries have stricter specifications: for
437 :     example, the UK specifies 230 V +10\% -6\%). In practice this means that
438 :     countries such as the UK that previously supplied 240 V continue to do
439 :     so, and those that previously supplied 220 V continue to do
440 :     so. However equipment should be designed to accept any voltages within
441 :     the specified range, and in practice most do so.
442 :     Similarly, Australia
443 :     has converted to 230 V as the nominal standard, and like the UK, 240 V
444 :     is within the allowable tolerance. "240 volt" spoken as "two forty
445 :     volt" remains a synonym for mains in Australian and British English.
446 :    
447 :    
448 :     In the United States and Canada, mains power is referred to by a
449 :     variety of names, including household power (or household
450 :     electricity), domestic power, wall power (because it comes from a
451 :     power outlet in the wall), or simply "AC power." A close synonym for
452 :     "mains" in Canadian provinces that use hydroelectric power is "hydro".
453 :     ANSI standard C84.1 and Canadian standard CAN3-C235 specify that the
454 :     nominal voltage at the output should be 120 V and allow a range of 114
455 :     to 126 V.
456 :    
457 :     In Japan, the electrical power supply to households is at
458 :     100 V. Eastern and northern parts of Honshu (including Tokyo) and
459 :     Hokkaido have a frequency of 50 Hz, whereas western Honshu (including
460 :     Nagoya, Osaka, and Hiroshima), Shikoku, Kyushu and Okinawa operate at
461 :     60 Hz. To accommodate the difference, appliances marketed in Japan can
462 :     often be switched between the two frequencies.}
463 :    
464 :     \end{minipage}
465 :     }
466 :    
467 :    
468 :     \section{Power Interference: wireless signals and computer power supplies}
469 :    
470 :     \begin{itemize}
471 :     \item How much electrical power does a computer use?
472 :    
473 :     \item Does it use the same amount of power in your house as it does in a data centre?
474 :     \end{itemize}
475 :    
476 :     To answer these questions, we need to know some basic physics of
477 :     waves. The same principles apply to the alternating currents feeding
478 :     computer power supplies as to the absorption of wireless signals in
479 :     walls. We need to understand how much of a wave is absorbed and does
480 :     work (heating up the wall or driving and heating up the CPU) an dhow
481 :     much simply passes through or is refleected back again.
482 :    
483 :     Electronic circuitry has two kinds of components: resistive and reactive.
484 :     Reistive components absorb and dissipate power as heat. They obey Ohm's law.
485 :    
486 :     Reactive components (inductors and capacitors) store and return most
487 :     of the power they use. This means that if we wait for a full cycle of the
488 :     alternating wave, we will get back most of what we put in again.
489 :    
490 :     What this means is that, if we measure the absorption of energy (the
491 :     power consumption) of a device we must follow its progress over many
492 :     cycles and take an average to see how much is being absorbed forever,
493 :     and how much is being borrowed as a short-term loan and returned. In
494 :     other words, we are interested in the {\em trend}, not the
495 :     fluctuations of energy transfer.
496 :    
497 :     \subsection{DC circuits}
498 :    
499 :     In direct current (DC) circuits, the power is given by
500 :     \beq
501 :     P = IV
502 :     \eeq
503 :     where $I$ is the constant current and $V$ is the constant voltage. In
504 :     a device where a DC current can flow, reactive components to not have
505 :     an effect and Ohm's law applies:
506 :     \beq
507 :     V = IR
508 :     \eeq
509 :     where $R$ is the electrical resistance. In this case, we can write
510 :     \beq
511 :     P = IV = I^2R = V^2/R.
512 :     \eeq
513 :     There is no analogue of a DC circuit for an electromagnetic wave.
514 :    
515 :     \subsection{AC circuits, `clean' power}
516 :    
517 :     For an alternating current (wave) source, there are several cases to
518 :     consider. We start with the simplest. A crucial point here is that
519 :     Ohm's law is no longer true in AC circuits, because capacitors and
520 :     inductors can borrow power for a short time and then return it, like a
521 :     wave interacting with a dielectric. The voltage and current are now functions
522 :     of time:
523 :     \beq
524 :     I &=& I(t)\nonumber\\
525 :     V &=& V(t).
526 :     \eeq
527 :    
528 :     It is still true that the instantaneous power consumption (the total energy
529 :     absorbed per unit time) is
530 :     \beq
531 :     P = IV = I(t)V(t).
532 :     \eeq
533 :     However, mains power is tyically varying at 50-60 Hz, so this is not
534 :     an true reflection of the long term behaviour, only what happens on
535 :     the scale of tenths of a second.
536 :    
537 :     If we consider a system driven by a single frequency (clean) wave, the short
538 :     term borrowing of current is reflected by a phase shift between the
539 :     voltage, which is the driving force of a systems, and the current,
540 :     which is the response of the system to the driving force. Let us call
541 :     this phase shift $\phi$.
542 :     \beq
543 :     V(t) &=& V_0 \sin (2\pi f t)\nonumber\\
544 :     I(t) &=& I_0 \sin (2\pi f t+\phi)
545 :     \eeq
546 :     where $f$ frequency and $T = 1/f$ is the period of the wave.
547 :     We can compute the average power over a number of cycles $nT$ by
548 :     computing
549 :     \beq
550 :     \langle P\rangle_\phi = \frac{1}{nT} \int_0^{nT} \; I(t)\,V(t)\, dt
551 :     \eeq
552 :     We can evaluate this using two trigonometric identities:
553 :     \beq
554 :     \sin(A+B) &=& \sin A \cos B + \cos A \sin B\\
555 :     \sin^2 X &=& \2(1-\cos 2X)
556 :     \eeq
557 :     Using the first of these to rewrite $I(t)$, we have
558 :     \beq
559 :     \langle P\rangle &=& \frac{I_0V_0}{nT}\int_0^{nT} \left[
560 :     \sin^2\left(\frac{2\pi t}{T}\right)\cos\phi +
561 :     \sin\left(\frac{2\pi t}{T}\right)\cos\left(\frac{2\pi t}{T}\right)\sin\phi
562 :     \right] dt
563 :     \eeq
564 :     Rewriting the first term with the help of the second identity allows us to
565 :     integrate the expression. Most terms vanish showing the power that
566 :     is returned over a whole cycle. We are left with:
567 :     \beq
568 :     \langle P\rangle_\phi &=& \2I_0V_0\cos\phi.
569 :     \eeq
570 :     In terms of the normally quoted root-mean-square (RMS) values:
571 :     \beq
572 :     V_{\rm rms} = \sqrt{\frac{1}{nT}\int_0^{nT} (V(t))^2}
573 :     \eeq
574 :     For a mono-chromatic sine wave, one has simply:
575 :     \beq
576 :     V_{\rm rms} &=& V_0/\sqrt{2}\nonumber\\
577 :     I_{\rm rms} &=& I_0/\sqrt{2},
578 :     \eeq
579 :     we have
580 :     \beq
581 :     \langle P\rangle_\phi &=& I_{\rm rms}V_{\rm rms}\cos\phi.
582 :     \eeq
583 :     The RMS values are the values returned by most measuring devices and
584 :     they are the values quoted on power supplies.
585 :    
586 :     The cosine factor is sometimes called the ``power factor'' in
587 :     electrical engineering literature. It is generalized below. Clearly
588 :     \beq
589 :     \langle P\rangle_{\phi>0} \le \langle P\rangle_{\phi=0}.
590 :     \eeq
591 :     In other words, the actual power consumption is not necessarily
592 :     as bad as the values one would measure with volt and ammeters.
593 :     This is a pity when we pay our bill, because the power companies
594 :     measure current, not work-done. That means we typically pay more than
595 :     we should for electrical power.
596 :    
597 :    
598 :     \subsection{AC circuits, clipped and dirty power}
599 :    
600 :     Not all power is transferred by a clean harmonic signal like the one
601 :     above. Anything that is connected to power with a reactive load
602 :     (capacitors and induction coils) sends power back into the net and
603 :     adds noise to the regular 50-60 Hz. Moreover, an inability to deliver
604 :     enough current can leave to clipping of the wave form, which generates
605 :     Fourier harmonics. Switched mode power supplies in personal computers,
606 :     and flourescent lighting which is highly reactive can add harmonics to
607 :     the power supply. For that reason, the actual phase difference is not
608 :     just a function of your device, but of all the devices close to your
609 :     device. The result can be inefficient power transfer.
610 :    
611 :    
612 :     A direct calculation of the reduction in power transfer is impractical
613 :     in this case, and one simply defined
614 :     \beq
615 :     PF = \cos\phi \equiv \frac{\langle P\rangle}{ I_{\rm rms}V_{\rm rms}}
616 :     \eeq
617 :    
618 :     More expensive equipment is designed with `power factor corrected'
619 :     electronics that attempts to reduce the reactance of the load and lead
620 :     to a simple $\phi=0$ behaviour. The power factor must be measured in
621 :     situ to truly know what it is.
622 :     \begin{itemize}
623 :    
624 :     \item Some authors claim that power factors
625 :     of $\cos\phi = 0.6$ have been observed in some PC hardware.
626 :    
627 :     \item Some authors suggest that a mean value of $\cos\phi = 0.8$ is a reasoable
628 :     guess.
629 :    
630 :     \item Others claim that in data centres one should assume that $\cos\phi=1$ to
631 :     correctly allow for enough headroom to deal with power demand.
632 :     \end{itemize}
633 :    
634 :     Another side effect of mutliple harmonics is that the RMS value is not
635 :     simply $1/\sqrt{2} = 1/1.4$ of the peak value (amplitude). This leads to a new ratio
636 :     called the ``crest factor'', which simple:
637 :     \beq
638 :     Crest = \frac{I_0}{I_{\rm rms}}.
639 :     \eeq
640 :    
641 :    
642 :     \begin{itemize}
643 :    
644 :     \item For a clean sinusoidal wave, this ratio is simply $\sqrt 2 =1.4$.
645 :    
646 :     \item Some authors claim that the crest factor can be as high as 2-3 for cheap
647 :     computing equipment.
648 :    
649 :     \item Some authors claim that a value of 1.4-1.9 is appropriate for power delivered by a UPS
650 :     (uninterruptible power supply).
651 :    
652 :     \item The crest factor is load dependent.
653 :     \end{itemize}
654 :    
655 :    
656 :     \subsection{Some jargon}
657 :    
658 :     Based on the background above, one sees the following terminology in use,
659 :     often in connection with uninterruptible power supplies.
660 :     \begin{itemize}
661 :    
662 :     \item $I_{\rm rms}V_{\rm rms}$ is referred to as ``VA'' or Volt-Amperes, not ``Watts''.
663 :    
664 :     \item Power consumption is referred to as VA $\times$ PF or Volt-Amperes multiplied
665 :     by the power factor and is measured in ``Watts''.
666 :    
667 :     \end{itemize}
668 :    
669 :    
670 :    
671 :    
672 :    
673 :     \chapter{Cooling and Airflow}
674 :    
675 :     Electronic circuitry switches by dumping current to ground through semi-conducting
676 :     materials. This generates large amounts of heat. Essentially all of the
677 :     electrical power consumed by a device ultimately becomes heat.
678 :    
679 :     The aim of cooling is to prevent the temperature of devices becoming too great.
680 :     \begin{itemize}
681 :     \item Semiconductor chips can melt if they become too hot.
682 :    
683 :     \item Heat increases electrical resistance, which in turn increases heat production
684 :     since heat power conversion goes like $\sim I^2 R$.
685 :    
686 :     \item Heat is a form of energy. Heat is not dangerous to equipment, but temperature is.
687 :     Temperature is related to energy density. The more concentrated heat is, the higher the
688 :     temperature. Thus we want to spread heat out.
689 :    
690 :     \item If we are constantly producing more heat, then some of it has to be taken away
691 :     to maintain the same temperature.
692 :    
693 :     \item Air, water and liquified gases can be used to cool computing equipment, depending
694 :     on the power they consume. Since these fluids are being used to carry
695 :     heat, the rate of flow of heat away from computing equipment is important.
696 :    
697 :     \end{itemize}
698 :    
699 :    
700 :     \section{Heat and temperature}
701 :    
702 :     Heat and temperature are related through a ``specific heat capacity''. All materials
703 :     have a specific heat capacity which describes the approximate effect of heat on
704 :     their temperature.
705 :    
706 :    
707 :     The specific heat capacity (symbol c or s, also called specific heat)
708 :     of a substance is defined as heat capacity per unit mass. The SI unit
709 :     for specific heat capacity is the joule per kilogram kelvin,
710 :     J·kg-1·K-1 or J/(kg·K), which is the amount of energy required to
711 :     raise the temperature of one kilogram of the substance by one
712 :     kelvin. Heat capacity can be measured by using calorimetry.
713 :    
714 :     Heat capacities are not linear.
715 :    
716 :    
717 :    
718 :     Temperature: Measuring the heat capacity of water produces different
719 :     results if the starting point is 20 °C rather than 60 °C. Therefore
720 :     the temperature at which the measurement was conducted must be
721 :     specified for the value to be useful.
722 :    
723 :     The formula we exploit for cooling is essentially this one:
724 :     \beq
725 :     \Delta Q = m c_s \Delta T
726 :     \eeq
727 :     In other words temperature increase $\Delta T$, in a fixed mass $m$ of
728 :     any substance, is proportional to the amount of heat added $\Delta$,
729 :     assuming that the mass is constant.
730 :    
731 :     If we bring a material into contact with a hotter substance, heat will
732 :     flow into it by {\em conduction}. Then, if we can remove the hotter
733 :     substance e.g. by flow convection, it will carry the heat away with it.
734 :    
735 :     Some values of $c_s$ for common
736 :     cooling materials are:
737 :    
738 :     \bigskip
739 :     \begin{center}
740 :     \begin{tabular}{l|l|l}
741 :     Substance & Phase & Specific heat capacity\\
742 :     \hline
743 :     Air (dry) & gas & 1005 J/kg/K\\
744 :     Air (100\% humidity) & gas & 1030 J/kg/K\\
745 :     Air (different source) & gas & 1158 J/kg/K\\
746 :     Water & liquid & 4186 J/kg/K\\
747 :     Copper (room temp) & solid & 385 J/kg/K\\
748 :     Gold (room temp) & solid & 129 J/kg/K\\
749 :     Silver (room temp) & solid & 235 J/kg/K\\
750 :     \end{tabular}
751 :     \end{center}
752 :    
753 :     \bigskip
754 :     As we see, water is about four times as efficient at carrying heat per
755 :     degree rise in temperature than is air. It is therefore
756 :     correspondingly better at cooling than air.
757 :    
758 :     Do not confuse the temperature of the air coming out of the computer with
759 :     the temperature of the CPU.
760 :    
761 :     Think of when you open an oven door, after the inital rush of hot air.
762 :     Metal objects in your oven can be hundreds of degrees Celcius, while the
763 :     air inside is only 40-50 degrees Celcius. Bear in mind that cool air is
764 :     flowing through a computer all the time with the aid of a fan. What you need to
765 :     know is not so temperature of the air but the temperature of the components
766 :     like the CPU and memory circuits. The plastics of these chips can melt
767 :     if the computer gets too hot.
768 :    
769 :     \section{Melting temperatures}
770 :    
771 :     It is not likely that heat from power dissipation will cause anything
772 :     to melt. The first parts to melt would be the plastics and polymers:
773 :    
774 :     \bigskip
775 :     \begin{center}
776 :     \begin{tabular}{l|l}
777 :     Silicon & 1410 C\\
778 :     Copper & 1083 C\\
779 :     Gold & 1063 C\\
780 :     Silver & 879 C\\
781 :     Polymers& 50-100 C\\
782 :     \end{tabular}
783 :     \end{center}
784 :    
785 :     Today's motherboards come with temperature monitoring software and
786 :     hardware which actually shuts the computer off the CPU temperature
787 :     gets too hot. Even these however are not 100\% fail proof.
788 :    
789 :     CPU maximum temperatures lie between 60 and 90 degrees Celcius.
790 :    
791 :     The reason for this is the way that semicondutors work. They rely on the
792 :     ability to switch small voltages and currents on and off to simulate
793 :     the behaviour of logic gates. To do this, it is necessary to have a
794 :     semi-conductor gap, which electrons cannot cross without assistance.
795 :    
796 :     As the temperature increases more and more electrons can bridge the
797 :     gap without assistance and circuits cease to work, because everything is
798 :     essentially always `switched on'. This happens when the size of the
799 :     gap is of the same order as the thermal energy in the material.
800 :     \beq
801 :     eV \sim kT\\
802 :     0.016 \times 10^{-19} \sim 10^{-23} \times 300K
803 :     \eeq
804 :     where $eV$ is the energy gap and $T$ is the absolute temperature, $k$
805 :     is Boltzmann's constant. With gap values of between 0.016-06 electron volts,
806 :     semiconductors are in a fragile state above room temperature.
807 :    
808 :    
809 :     \section{Methods of transfer}
810 :    
811 :     \begin{itemize}
812 :     \item Convection dominates heat flow in gases and liquids.
813 :    
814 :     \item Conduction - transfer by contact (friction)
815 :     Good conductors of electricity are generally also good conductors of heat,
816 :     and vice versa.
817 :    
818 :     \item Radiation - electromagnetic energy.
819 :     \end{itemize}
820 :    
821 :     {\em Heat sinks} and
822 :     {\em heat pipes} can be used to lead heat away from a hot-spot using
823 :     a good conductor to spread heat over a wider area. Heat sinks are placed
824 :     on the CPU in computers, for instance.
825 :    
826 :    
827 :     \begin{figure}[ht]
828 :     \epsfig{file=airflow.eps,width=12cm}
829 :     \caption{Schematic illustration of air flowing through and around a rack device.}
830 :     \end{figure}
831 :    
832 :     The rate of flow of volume is proportional to the fixed area of the channel
833 :     cross-section and the length per unit time (velocity) of the coolant passing through it.
834 :     \beq
835 :     \frac{dV}{dt} &\propto& A \frac{dx}{dt}\\
836 :     F &\propto& A v
837 :     \eeq
838 :    
839 :    
840 :     You should bear in mind that
841 :     \begin{itemize}
842 :     \item It is the temperature of components inside the computer that is the main worry
843 :     in cooling design.
844 :     \item The temperature of the air coming out depends on many factors, including
845 :     the ambient temperature around the box, the rate of air flow through
846 :     the device and around it, the amount of convection in and around the
847 :     device. humidity etc.
848 :    
849 :     \item Air is a poor carrier of heat, so if air is getting hot, you know that the
850 :     metalltic components are sizzling!
851 :     \end{itemize}
852 :    
853 :    
854 :    
855 :     \chapter{Installing Blade Servers}
856 :    
857 :    
858 :    
859 :     \section{Switch installation}
860 :    
861 :     \begin{figure}[ht]
862 :     \epsfig{file=images/bay2.eps,width=10cm}
863 :     \caption{The empty I/O bay (bay 2) on the rear of the blade chassis.\label{bay2.eps}}
864 :     \end{figure}
865 :     \begin{figure}[ht]
866 :     \epsfig{file=images/bay2sw.eps,width=10cm}
867 :     \caption{The switch module is plugged into bay 2.\label{bay2sw.eps}}
868 :     \end{figure}
869 :     \begin{figure}[ht]
870 :     \epsfig{file=images/bay2swin.eps,width=10cm}
871 :     \caption{Switch module locks into place.\label{bay2swin.eps}}
872 :     \end{figure}
873 :     \begin{figure}[ht]
874 :     \epsfig{file=images/bay2swdone.eps,width=10cm}
875 :     \caption{The installed switch module.\label{bay2swdone.eps}}
876 :     \end{figure}
877 :     \begin{figure}[ht]
878 :     \epsfig{file=images/blade1.eps,width=10cm}
879 :     \caption{A blade server, unpacked.\label{blade1.eps}}
880 :     \end{figure}
881 :     \begin{figure}[ht]
882 :     \epsfig{file=images/openblade.eps,width=10cm}
883 :     \caption{Quick release pressure points on the side allow the cover to be removed.\label{openblade.eps}}
884 :     \end{figure}
885 :     \begin{figure}[ht]
886 :     \epsfig{file=images/insertdisk.eps,width=10cm}
887 :     \caption{A disk can be plugged in easily.\label{insertdisk.eps}}
888 :     \end{figure}
889 :     \begin{figure}[ht]
890 :     \epsfig{file=images/emptybay.eps,width=10cm}
891 :     \caption{A filler blade is removed to allow insertion of the server into the blade chassis.\label{emptybay.eps}}
892 :     \end{figure}
893 :     \begin{figure}[ht]
894 :     \epsfig{file=images/insert.eps,width=10cm}
895 :     \caption{The blade server slide in, with locking clamps extended.\label{insert.eps}}
896 :     \end{figure}
897 :     \begin{figure}[ht]
898 :     \epsfig{file=images/inplace.eps,width=10cm,angle=90}
899 :     \caption{A single blade server locked in place.\label{inplace.eps}}
900 :     \end{figure}
901 :     \begin{figure}[ht]
902 :     \epsfig{file=images/fullbay.eps,width=10cm}
903 :     \caption{Six blades installed. Note that the filler blades should be in place in the empty bays, in order to regulate the airflow through the cavity. If the fillers are not inserted, too much air is sucked through the opening, missing the actual blade servers.\label{fullbay.eps}}
904 :     \end{figure}
905 :     \begin{figure}[ht]
906 :     \epsfig{file=images/powerbutton.eps,width=10cm}
907 :     \caption{Blades are activated by a power button, underneath the cover. A keyboard, screen and CDROM switch also allow selection of the common managment resources.\label{powerbutton.eps}}
908 :     \end{figure}
909 :     \begin{figure}[ht]
910 :     \epsfig{file=images/poweron.eps,width=10cm}
911 :     \caption{Blades powered up.\label{poweron.eps}}
912 :     \end{figure}
913 :     \begin{figure}[ht]
914 :     \epsfig{file=images/bios.eps,width=10cm}
915 :     \caption{BIOS boot screen from the powered blade.\label{bios.eps}}
916 :     \end{figure}
917 :    
918 :    
919 :    
920 :     \section{Switch configuration}
921 :    
922 :     The management module of the blade chassis has a network interface as
923 :     well as a screen, keyboard, mouse connector. This ethernet connection
924 :     is on a private VLAN exclusively for connecting to the chassis blade
925 :     centre.
926 :    
927 :     If this ethernet interface is connected to a switch with a DHCP service,
928 :     within two minutes of powering up the chassis, it will use DHCP to assign a
929 :     network address. If the two minutes expires, the default address
930 :     192.168.70.125 is set.
931 :    
932 :     We can therefore connect to it using a remote terminal, e.g.
933 :    
934 :     \begin{enumerate}
935 :     \item Start a Linux laptop.
936 :    
937 :     \item Connect to the laptop to the management interface using a crossover (null-modem) cable.
938 :     \item Configure the network interface of the terminal to be part of this
939 :     private subnet. e.g.
940 :     \begin{verbatim}
941 :     ifconfig eth0 192.168.70.2 netmask 255.255.255.0 broadcast 192.168.70.255
942 :     \end{verbatim}
943 :     \item With this configuration, one can point a web browser to the addess
944 :     \begin{verbatim}
945 :     http://192.168.70.125
946 :     \end{verbatim}
947 :     \end{enumerate}
948 :    
949 :     We should enable INT1 - INT 6 for connect up the blades
950 :     internally. Then we should configure EXT1 to allow external
951 :     connection. For this we must enable trunking on VLAN1, which is the
952 :     default VLAN for the blades.
953 :    
954 :     \begin{figure}[ht]
955 :     \epsfig{file=images/ibm-1.eps,width=15cm}
956 :     \caption{The web interface on 192.168.70.125 of the management console. Select I/O modules, Task management, Bay 2 and the Advanced Management option.}
957 :     \end{figure}
958 :    
959 :    
960 :     \begin{figure}[ht]
961 :     \epsfig{file=images/ibm-sw1.eps,width=16cm}
962 :     \caption{Entering the switch module management interface. Select, for instance,
963 :     the EXT1 interface, i.e. interface number 1 on the switch module we
964 :     installed in Bay 2. Note the dashboard and configure switches at the
965 :     top of the screen. Some options are only allowed in configure.}
966 :     \end{figure}
967 :    
968 :     \begin{figure}[ht]
969 :     \epsfig{file=images/ibm-sw2.eps,width=16cm}
970 :     \caption{Inside the Advanced Management of the swicth, enable an external port for connecting the blade server chassis to an external switch or router. Enable external port and management of external port.}
971 :     \end{figure}
972 :    
973 :     Once the external interface has been configured, the single external network
974 :     connection can be used to transfer the internal IP interfaces of the blade
975 :     servers to the outside world. One does not need to use a separate external
976 :     ethernet connecter per blade. The purpose of multiple interfaces is to allow
977 :     multiple VLANs. .
978 :    
979 :    
980 :     \section{Installation of Linux}
981 :    
982 :     A number of CDs arrive with the blades. These contain drivers for MS Windows
983 :     and management software for RAID configuration. We shall not consider RAID
984 :     here, since our blades each have only a single disk.
985 :    
986 :     None of the disks are needed for installation of Linux on the blade servers.
987 :     Any recent Linux will probably work. We have tested:
988 :    
989 :     \begin{enumerate}
990 :     \item SuSE 10.1
991 :     \end{enumerate}
992 :    
993 :     Eahc blade appears to have two network interfaces which are not easily
994 :     distinguishable. Although both can be configured with an IP address
995 :     (even automatically with DHCP), Only one of the two works to connect
996 :     the blade server to the outside world. You will have to find out which
997 :     by trial and error.
998 :    
999 :     If the switch communication has been enabled,
1000 :     the interfaces are configured in the usual way for the operating system
1001 :     concerned.
1002 :    
1003 :    
1004 :     \chapter{Planning for High Volume Services}
1005 :    
1006 :    
1007 :     \section{Designing an application architecture}
1008 :    
1009 :    
1010 :     Typical 3 tier architectures: webserver, application, database
1011 :    
1012 :     Data collection, web logs?
1013 :    
1014 :     \section{Failure modes and redunancy}
1015 :    
1016 :     \begin{figure}
1017 :     \epsfig{file=serverrom.eps,width=12cm}
1018 :     \caption{Load balancincing is a tricky matter if one is looking for redundancy.
1019 :     A load balancer is a tree -- which is a structure with many intrinsic points
1020 :     of failure and bottlenecks.}
1021 :     \end{figure}
1022 :    
1023 :     When planning redudancy, there are certain thumb rules and theorems
1024 :     concerning system reliability. Fig. \ref{folkth} illustrates the difference
1025 :     between ``correct'' use of redundancy and a flawed strategy.
1026 :    
1027 :     \begin{figure}
1028 :     \epsfig{file=folkth.eps,width=12cm}
1029 :     \caption{Redundancy folk theorem.\label{folkth}}
1030 :     \end{figure}
1031 :    
1032 :    
1033 :     Here is a minimum dpendency and redundancy strategy. Each of the doubled
1034 :     components can be scaled up to $n$ to increase thoughput.
1035 :    
1036 :     \begin{figure}
1037 :     \epsfig{file=room.eps,width=12cm}
1038 :     \caption{Minimum redundancy strategy\label{room}}
1039 :     \end{figure}
1040 :    
1041 :    
1042 :    
1043 :     \section{Capacity Planning}
1044 :    
1045 :     \section{Peak load handling}
1046 :    
1047 :    
1048 :    
1049 :    
1050 :     \section{Fault tolerance}
1051 :    
1052 :     Folk theorems about redundancy...
1053 :    
1054 :    
1055 :     \chapter{Performance Measurement and Benchmarking}
1056 :    
1057 :     Refer to the book by Jain for more details\cite{jain1}.
1058 :    
1059 :     \section{Planning}
1060 :    
1061 :     Steps in planning:
1062 :     \begin{itemize}
1063 :     \item Place measurement instrumentation.
1064 :     \item Collect data.
1065 :     \item Characterize and understand workload patterns.
1066 :     \item Model and predict performance alternatives.
1067 :     \end{itemize}
1068 :    
1069 :    
1070 :     \section{Common mistakes}
1071 :    
1072 :     \begin{itemize}
1073 :    
1074 :     \item Workload only represents average behaviour -- no outlier stress points.
1075 :     \item Not instrumenting enough to find the source of I/O bottlenecks.
1076 :     \item Measurement uncertainties are ignored.
1077 :     \item Ignoring measurement overhead.
1078 :     \item Not repeating or validating measurements many times to eliminate random uncertainties.
1079 :     \item Not ensuring same conditions.
1080 :     \item Not measuring performance under transient behaviour (rapid bursts)
1081 :     \item Collecting data but not analyzing properly.
1082 :     \end{itemize}
1083 :    
1084 :     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1085 :    
1086 :     \part{Load Balancing}
1087 :    
1088 :     \chapter{DNS Load Balancing}
1089 :    
1090 :     %\newtheorem{example}{Example}
1091 :     %\newtheorem{question}{Question}
1092 :    
1093 :     \section{Load Balancing}
1094 :     What do you do when your web server is overloaded with heavy requests?
1095 :     One suggestion is to add hardware upgrades to the server, such as a
1096 :     stronger processor and more memory. Another idea is to support the web
1097 :     site with several servers. Using some kind of request scheduling
1098 :     mechanism, it is then possible to share the load among the available
1099 :     servers. This example, though trivial, outlines the essence of load
1100 :     balancing: Sharing an imposed workload between several ordinary and
1101 :     relatively inexpensive servers, as opposed to handling the entire load
1102 :     on a single high-end node. In simplified queueing theory terms, we are
1103 :     moving from $M/M/1$ to $M/M/k$ or $M/M/1^k$ queues. In other words, we
1104 :     substitute the single server setup with more servers or service
1105 :     channels.
1106 :    
1107 :     Sharing load between servers not only has direct economical effects,
1108 :     it often brings about welcome side effects. One such benefit is the
1109 :     level of redundancy implied by running a load balanced service. Say
1110 :     for example that you serve a corporate web site between ten servers.
1111 :     Then you might afford to lose one or more servers without severely
1112 :     impacting the browsing experience for customers. This approach can
1113 :     easily alleviate software or hardware faults in single nodes. It
1114 :     should be noted, however, that a proper redundant system requires
1115 :     redundancy in all links of the chain.
1116 :    
1117 :     %On the issue of manageability, keeping track of software and general
1118 :     %operation of a computer cluster can be considered a drawback compared
1119 :     %to the monolithic approach. However, with the right tools and
1120 :     %configuration, difficulty of management need not turn out to be the
1121 :     %case at all.
1122 :    
1123 :     It is apparent that the difference between lower and higher levels of
1124 :     load balancing is directly related to granularity and scalability,
1125 :     both when it comes to data handling and for manageability. For
1126 :     example, in a multi-CPU system the task scheduler in the operating
1127 :     system organises processes and threads so that they are load-balanced
1128 :     on the available CPU resources. On this scale we deal with units of
1129 :     CPU cycles and microsecond deltas, which are not directly relevant
1130 :     when we talk about server or network load balancing. However, if we
1131 :     zoom out several orders of magnitude and look at network topologies,
1132 :     we can typically operate with units of packets and bytes, and typical
1133 :     deltas of seconds to hours. This is where load balancing becomes more
1134 :     interesting and manageable in system administration. Towards the
1135 :     topmost levels are considerations such as geographic proximity,
1136 :     routing mechanisms and service level agreements. These are interesting
1137 :     because they move away from details and allow us to get a handle on
1138 :     the big picture of large-scale network traffic and do load balancing
1139 :     of that very same traffic. This implies that we deal with trends and
1140 :     analysis of large amounts of data over very long time spans, typically
1141 :     hours and days, to months and even years.
1142 :    
1143 :     \section{DNS-based Load Balancing}
1144 :     The Domain Name System (DNS) is the global name lookup service in the
1145 :     Internet. It is a distributed, hierarchical and redundant database
1146 :     running on thousands of servers worldwide, each responsible for one or
1147 :     more DNS zones. When a client issues a request for a URL, the browser
1148 :     will first try to resolve the hostname in the URL into an IP address,
1149 :     so that it knows where to send the request. This is where it is
1150 :     possible for a DNS server to influence the outcome of a query,
1151 :     effectively directing the client to a desired or lightly loaded site.
1152 :    
1153 :     While DNS in itself was not designed particularly with the
1154 :     requirements of load balancing in mind, it does provide a limited set
1155 :     of options to facilitate simple balancing schemes. However, together
1156 :     with dynamical back-ends, DNS can be a well suited front-end to robust
1157 :     load balancing mechanisms. The strength of using DNS is its almost
1158 :     universal deployment: Practically every node connected to an IP
1159 :     network is capable of DNS resolving. This makes DNS one of the most
1160 :     desirable \emph{interfaces} for global load sharing implementations.
1161 :     Dynamical back-ends are discussed later.
1162 :    
1163 :     To give an insight into how nameservers respond to queries, consider
1164 :     the listing below, showing what a client would receive (per July 2006)
1165 :     when asking for the IP address of the cnn.com host. This particular
1166 :     output is from the `dig' application, and shows three main sections:
1167 :     The question section echoes the request information; the answer
1168 :     section shows the matching records (if any); the authority section
1169 :     lists the authoritative nameservers for the domain.
1170 :    
1171 :     \setlength{\fboxsep}{0pt}
1172 :     \begin{code}
1173 :     \fvset{numbers=left,commandchars=\\\{\}}
1174 :     \begin{Verbatim}
1175 :     ;; QUESTION SECTION:
1176 :     ;cnn.com. IN A
1177 :    
1178 :     ;; ANSWER SECTION:
1179 :     cnn.com. 300 IN A 64.236.29.120 ;This
1180 :     cnn.com. 300 IN A 64.236.16.20 ;is
1181 :     cnn.com. 300 IN A 64.236.16.52 ;an
1182 :     cnn.com. 300 IN A 64.236.16.84 ;RRset
1183 :     cnn.com. 300 IN A 64.236.16.116 ;with
1184 :     cnn.com. 300 IN A 64.236.24.12 ;eight
1185 :     cnn.com. 300 IN A 64.236.24.20 ;web
1186 :     cnn.com. 300 IN A 64.236.24.28 ;servers
1187 :    
1188 :     ;; AUTHORITY SECTION:
1189 :     cnn.com. 600 IN NS twdns-04.ns.aol.com.
1190 :     cnn.com. 600 IN NS twdns-01.ns.aol.com.
1191 :     cnn.com. 600 IN NS twdns-02.ns.aol.com.
1192 :     cnn.com. 600 IN NS twdns-03.ns.aol.com.
1193 :     \end{Verbatim}
1194 :     \end{code}
1195 :    
1196 :     There are a few interesting properties of the DNS response in the
1197 :     listing. First of all, it is clear that the nameservers return
1198 :     multiple A-records for the cnn.com hostname -- this is known as a
1199 :     resource record set (RRset). It is difficult to determine whether
1200 :     there is a complex algorithm behind the result or if it is simply
1201 :     a random permutation of the available servers. Because ordering of
1202 :     RRsets is never guaranteed, it is likely that the DNS servers use
1203 :     random scheduling. In other words, they do not map server preference
1204 :     to the RRset ordering, such as placing the most preferred server on
1205 :     top of the list.
1206 :    
1207 :     Another point to notice is the time-to-live (TTL) values in the second
1208 :     column indicate that the returned records have a very short caching
1209 :     lifetime, 5 and 10 minutes for the A and NS records, respectively. A
1210 :     low TTL ensures that DNS servers are queried often, and are thus
1211 :     able to influence the answer over relatively small time intervals,
1212 :     e.g.~removing dead servers from the RRset. Low TTLs come at the cost
1213 :     of higher frequency of queries, which can add a considerable delay to
1214 :     the total page response time.
1215 :    
1216 :     \section{Configuring BIND}
1217 :     A simple setup of DNS load balancing in the BIND software takes very
1218 :     little effort. The following listing is an example taken from a normal
1219 :     BIND zone file with standard syntax, and it describes the fictional
1220 :     \url{test.lan} zone:
1221 :     \setlength{\fboxsep}{0pt}
1222 :     \begin{code}
1223 :     \fvset{numbers=left,commandchars=\\\{\}}
1224 :     \begin{Verbatim}
1225 :     \$TTL 60
1226 :     test.lan. IN SOA ns.test.lan. hostmaster.test.lan. (
1227 :     1 ; Serial
1228 :     604800 ; Refresh
1229 :     86400 ; Retry
1230 :     2419200 ; Expire
1231 :     604800 ) ; Negative Cache TTL
1232 :     ;
1233 :     test.lan. IN NS ns.test.lan. ; NameServer record.
1234 :     ns IN A 10.0.0.1 ; A-record for nameserver.
1235 :     www IN A 10.0.0.13
1236 :     www IN A 10.0.0.11
1237 :     www IN A 10.0.0.14
1238 :     www IN A 10.0.0.16
1239 :     www IN A 10.0.0.15
1240 :     www IN A 10.0.0.12
1241 :     \end{Verbatim}
1242 :     \end{code}
1243 :     The first line defines the time-to-live value to use for all the
1244 :     records contained within the zonefile. Next, on lines 2 through 7, is
1245 :     the \emph{start of authority} record, which describes behaviour of
1246 :     slave nameservers. The relevant records are the six A-records that
1247 :     make up the RRset for the \url{www.test.lan} hostname. As a result,
1248 :     any lookup for the A-record for \url{www.test.lan} would return the
1249 :     entire set of addresses to the querying client. The default scheduling
1250 :     mechanism in BIND has been known to vary with releases, but is
1251 :     typically set to either random or round-robin with an arbitrary
1252 :     starting order. It can be configured in the \emph{named} configuration
1253 :     options, using the directive ``rr-set ordering''.
1254 :    
1255 :     \section{Dynamical DNS Zones}
1256 :     The current (July 2006) DNS scheme deployed on \url{amazon.com} offers
1257 :     another approach to load sharing. When querying the DNS servers for
1258 :     the A record of \url{www.amazon.com}, only one address is returned.
1259 :     Subsequent queries show that the server returns a single IP address
1260 :     out of a small set. The effects of this approach are twofold. On one
1261 :     side it lets the DNS servers decide which server the client connects
1262 :     to -- i.e. the load sharing is very much more controlled than in the
1263 :     previous CNN example. On the other hand this solution introduces a
1264 :     single point of failure for short periods of time: The client is given
1265 :     only one point of correspondence; should it fail, the client must give
1266 :     up or wait for the TTL to expire. By then, Amazon might have lost
1267 :     their customer.
1268 :    
1269 :     Is there a middle ground here, that is, a compromise between load
1270 :     sharing control and availability? Such a compromise could be
1271 :     implemented by having the DNS servers reply with a \emph{subset} of
1272 :     the full list of servers. It can be argued that this solution provides
1273 :     both the control and availability needed for a high-volume site.
1274 :    
1275 :     When implementing dynamical DNS zones, there is some choice of software.
1276 :     For many years the PowerDNS package has been a viable alternative to
1277 :     BIND. PowerDNS is an authoritative-only DNS server with a very
1278 :     flexible back-end architecture: It supports loading zones from plain
1279 :     BIND-style zone files, a variety of SQL databases, LDAP, etc. Examples
1280 :     of use include setting server preference using a weight factor, or
1281 :     limiting the result to a subset of the matching A-records.
1282 :    
1283 :     On a side note, the latest version of BIND, v9.4, features the DLZ
1284 :     extension. DLZ, dynamically loadable zones, gives BIND much of the
1285 :     same back-end capabilities as PowerDNS when it comes to serving
1286 :     dynamical content.
1287 :    
1288 :     \section{Configuring PowerDNS}
1289 :     Configuring PowerDNS zones is done by populating a database of choice
1290 :     with the zone information, and then specifying the SQL query needed to
1291 :     fetch the data in the configuration file. An example of a query from a
1292 :     populated database is shown below. Note that it contains mostly the
1293 :     same information as the static zone file (though the SOA content is
1294 :     truncated):
1295 :     \setlength{\fboxsep}{0pt}
1296 :     \begin{code}
1297 :     \fvset{numbers=left}
1298 :     \begin{Verbatim}
1299 :     # select id,name,type,content,ttl,pref from records;
1300 :    
1301 :     id | name | type | content | ttl | pref
1302 :     ----+--------------+------+---------------------+------+------
1303 :     1 | test.lan | SOA | ns.test.lan hostmast| 86400|
1304 :     2 | test.lan | NS | ns.test.lan | 86400|
1305 :     9 | ns.test.lan | A | 10.0.0.1 | 86400|
1306 :     3 | www.test.lan | A | 10.0.0.11 | 30| 10
1307 :     4 | www.test.lan | A | 10.0.0.12 | 30| 15
1308 :     5 | www.test.lan | A | 10.0.0.13 | 30| 60
1309 :     6 | www.test.lan | A | 10.0.0.14 | 30| 45
1310 :     7 | www.test.lan | A | 10.0.0.15 | 30| 100
1311 :     8 | www.test.lan | A | 10.0.0.16 | 30| 30
1312 :     \end{Verbatim}
1313 :     \end{code}
1314 :     By appending the ``ORDER BY random() LIMIT 1'' expression to the SQL
1315 :     query, only one random record is returned (the Amazon case).
1316 :     Similarly, ``ORDER BY pref LIMIT 3'' would return the three most
1317 :     preferable servers. If the \emph{pref} value is static, the three
1318 :     least preferable servers would never be used. This can be solved by
1319 :     making the pref value dynamically updated using a simple health-check
1320 :     system. An example of such a system would be monitoring server load in
1321 :     short intervals, and updating the pref value to reflect the current
1322 :     load scenario.
1323 :    
1324 :     The practical uses of dynamical zones are many and vary beyond simple
1325 :     weighting of servers. Other properties that can be taken into
1326 :     consideration include individual server response time, connection
1327 :     count, proximity to client, time zone and various traffic
1328 :     characteristics.
1329 :    
1330 :    
1331 :     \section{Exercises}
1332 :     The exercises below are fairly practical, and will give you a feeling
1333 :     of the possibilities of high-level load balancing. They focus on
1334 :     setup and configuration of DNS and some special HA software.
1335 :    
1336 :     \subsection{Exercise One (simple)}
1337 :     \emph{This exercise is about setting up a dynamically configured DNS
1338 :     zone using PowerDNS, and testing the setup.}
1339 :    
1340 :     \begin{itemize}
1341 :     \item Skim through the PowerDNS documentation to get an impression of
1342 :     the requirements for installation. You will need PowerDNS itself and a
1343 :     supported back-end of your choice. For example you can choose MySQL or
1344 :     PostgreSQL. All these software suites have ready-to-install packages
1345 :     available for most Linux distributions.
1346 :     \item Create a database for use with PowerDNS, and populate it with
1347 :     the required tables. Alter the default table schema to include a
1348 :     weight or preference column.
1349 :     \item Design a simple DNS zone containing a cluster of servers in an
1350 :     RRset. Use a reasonable number of elements in the set to allow
1351 :     testing; five or more is recommended. Implement the zone in the
1352 :     database tables.
1353 :     \item Set a static preference value for each server.
1354 :     \item In the PowerDNS configuration file, set up the \emph{*-query}
1355 :     strings. You can experiment with the SQL queries and observe their
1356 :     effect. Expressions can include \emph{ORDER BY random()}, \emph{ORDER
1357 :     BY \textless col\textgreater}, \emph{LIMIT \textless n\textgreater}, or otherwise any valid SQL supported by
1358 :     the back-end.
1359 :     \item Start the server and test the configuration by running dig. An
1360 :     example of use is \emph{dig @127.0.0.1 a www.test.lan}.
1361 :     \end{itemize}
1362 :     The following set of tasks is a continuation of the above, but with a
1363 :     higher difficulty.
1364 :     \begin{itemize}
1365 :     \item (Optional) Set up the set of servers in a virtual network, and
1366 :     install a web server on them. The servers need not be identical;
1367 :     resource variation is interesting for testing, e.g.~CPU power, RAM,
1368 :     etc.
1369 :     \item (Optional) Create a script on the DNS server that queries the
1370 :     load (or other property) of the web servers. Propagate the values into
1371 :     the database back-end. Make sure the SQL query strings set up in
1372 :     PowerDNS take the preference value into account.
1373 :     \item Vary the load (or other property) on the web servers either
1374 :     artificially or otherwise, and observe whether the DNS server reacts
1375 :     correctly to the measures you impose on the web servers.
1376 :     \end{itemize}
1377 :    
1378 :    
1379 :     \subsection{Exercise Two (complex)}
1380 :     \emph{Assuming that the class is divided into groups with two persons in
1381 :     each group. This somewhat complex exercise is about configuring a
1382 :     fully operating ``global'' network. Depending on the number of groups,
1383 :     one or two groups set up a redundant DNS service (two or more DNS
1384 :     servers), while the other groups set up sites using the Linux Virtual
1385 :     Server and keepalived (or similar) load-balancing implementation.}
1386 :    
1387 :    
1388 :    
1389 :     \bibliography{LISAbib}
1390 :    
1391 :     \end{document}

Administrator
ViewVC Help
Powered by ViewVC 1.0.3