
 
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>IScale</title>
	<atom:link href="http://dotimes.com/iscale/feed" rel="self" type="application/rss+xml" />
	<link>http://dotimes.com/iscale</link>
	<description>Yet Another Weblog on Open Source Appliance</description>
	<pubDate>Tue, 17 Jun 2008 08:54:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Building Customized Installation CD/DVD of Slackware</title>
		<link>http://dotimes.com/iscale/2008/04/building-customized-installation-cddvd-of-slackware.html</link>
		<comments>http://dotimes.com/iscale/2008/04/building-customized-installation-cddvd-of-slackware.html#comments</comments>
		<pubDate>Sat, 12 Apr 2008 09:05:32 +0000</pubDate>
		<dc:creator>Cherife Li</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[slackware]]></category>

		<guid isPermaLink="false">http://dotimes.com/iscale/?p=81</guid>
		<description><![CDATA[In order to bring off one-command or even auto installation, and save time of the installation process, the idea that building an Slackware installation CD/DVD came to my mind.
What to do and how to do, this was a question to me at the beginning. I have no idea about isolinux. Fortunately I found that there [...]]]></description>
			<content:encoded><![CDATA[<p>In order to bring off one-command or even auto installation, and save time of the installation process, the idea that building an Slackware installation CD/DVD came to my mind.</p>
<p>What to do and how to do, this was a question to me at the beginning. I have no idea about isolinux. Fortunately I found that there is an answer called <a href="http://www.linuxquestions.org/linux/answers/Applications_GUI_Multimedia/Cooking_Up_Some_Slack_CUSS" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/www.linuxquestions.org');">Cooking Up Some Slack(CUSS)</a>. After reading over that, I got to know something and began the process.</p>
<p><strong>1 Prepare the packages</strong><br />
I pulled the -Current repository from rsync://rsync.osuosl.org/slackware/slackware-current to my workstation. Some directories and files are not necessary for the installation, to save bandwidth and time, it is sensible to &#8211;exclude them, like source/, pasture/, testing/, and so on.</p>
<p><strong>2 Customize initrd.img</strong><br />
The initrd.img contains the system and scripts for installation. Most things will be customized here.</p>
<p>First, uncompress the initrd.img file to a directory. The initrd.img in -Current now is a gzipped cpio archive, rather than a gzipped image as in former versions(before and include 11.0).</p>
<p><code>$ gzip -cd initrd.img|cpio -i</code></p>
<p>Most of the installation scripts are stored in usr/lib/setup directory.</p>
<p>Second, to reduce the size of initrd.img, I deleted some directories, e.g., lib/modules/&#8217;kernel-version&#8217;(retain the -smp directory, I just use -smp to boot), usr/lib/setup(you need installpkg script at least), usr/man, and some files, e.g., scripts related to LVM in sbin/ directory(I don&#8217;t use LVM), odd files in etc/ directory, and so on.</p>
<p>Third, customize the environment and script during installation. The files related are etc/profile, etc/rc.d/rc.S, and also etc/inittab, etc/issue and so on, if you want. </p>
<p>This is some pieces of my setup script:</p>
<blockquote><p>
#!/bin/sh<br />
#<br />
# Copyright (c) 2008, Cherife Li <cherife@dotimes.com>.<br />
# All rights reserved.<br />
#<br />
# Redistribution and use of this script, with or without modification,<br />
# is permitted, and must retain the copyright above.<br />
#<br />
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR &#8220;AS IS&#8221; AND ANY EXPRESS OR<br />
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED<br />
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE<br />
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,<br />
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES<br />
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR<br />
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)<br />
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,<br />
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING<br />
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE<br />
# POSSIBILITY OF SUCH DAMAGE.<br />
#<br />
# Notice:<br />
# - This script is used for one logical disk(not LVM).<br />
# - The disk will be formatted to reiserfs file system.<br />
# - I don&#8217;t care about the keyboard map setting.<br />
#<br />
# Bugs, advise, suggestion, or others, if any, please mail me.<br />
#</p>
<p>TMP=/var/log/setup/tmp<br />
SRC=/var/log/setup/src<br />
DEST=/mnt</p>
<p>KERNEL=&#8221;`cut -f 5 -d &#8216; &#8216; /proc/cmdline|cut -f 2 -d =`&#8221;<br />
KNAME=&#8221;huge-smp&#8221;<br />
KVERSION=&#8221;`uname -r`&#8221;</p>
<p>if [ -d $TMP ]; then<br />
  rm -rf $TMP/* 1>/dev/null 2>&#038;1<br />
else<br />
  mkdir $TMP<br />
fi</p>
<p>for i in $SRC $DEST; do<br />
  if [ -d $i ]; then<br />
    umount -f $i 1>/dev/null 2>&#038;1<br />
  else<br />
    mkdir -p $i 1>/dev/null 2>&#038;1<br />
  fi<br />
done</p>
<p>echo<br />
echo &#8220;+==============================================+&#8221;<br />
echo &#8221; Preparing the hard disk for installation &#8230;&#8221;<br />
echo<br />
sleep 3</p>
<p>DISK=`fdisk -l|grep &#8216;^Disk\ \/&#8217;|cut -f 2 -d &#8216; &#8216;|cut -f 1 -d :|head -n1`</p>
<p># clear existing partition(s), if any<br />
PARTNUM=&#8221;`fdisk $DISK -l|tail -n1|cut -f 1 -d &#8216; &#8216;|cut -c 9`&#8221;<br />
while [ $PARTNUM -gt 0 ]; do<br />
  if [ $PARTNUM -gt 1 ]; then<br />
    echo -ne &#8220;d\n$PARTNUM\n&#8221; >> $TMP/fdisk.del<br />
  else<br />
    echo -ne &#8220;d\nw\n&#8221; >> $TMP/fdisk.del<br />
  fi<br />
  let PARTNUM=PARTNUM-1<br />
done<br />
cat $TMP/fdisk.del|fdisk $DISK</p>
<p># Partition the hard disk into two partitions.<br />
# one for swap with 2000M, the other for root(/) with the left of disk.<br />
echo -ne &#8220;n\np\n1\n\n+2000M\n\nn\np\n2\n\n\nt\n1\n82\nw\n&#8221;|fdisk $DISK</p>
<p># Active swap partition and add it to fstab temp<br />
SWAP_PART=${DISK}1<br />
mkswap -v1 $SWAP_PART<br />
swapon $SWAP_PART<br />
printf &#8220;%-16s %-16s %-11s %-16s %-3s %s\n&#8221; &#8220;$SWAP_PART&#8221; &#8220;swap&#8221; &#8220;swap&#8221; &#8220;defaults&#8221; &#8220;0&#8243; &#8220;0&#8243; >> $TMP/fstab.tmp</p>
<p># Format root (/) partition, mount it, and add it to fstab temp<br />
ROOT_PART=${DISK}2<br />
echo &#8220;y&#8221;|mkreiserfs $ROOT_PART 1>/dev/null 2>&#038;1<br />
mount $ROOT_PART $DEST || exit 1<br />
printf &#8220;%-16s %-16s %-11s %-16s %-3s %s\n&#8221; &#8220;$ROOT_PART&#8221; &#8220;/&#8221; &#8220;reiserfs&#8221; &#8220;defaults,noatime&#8221; &#8220;1&#8243; &#8220;1&#8243; >> $TMP/fstab.tmp</p>
<p>echo<br />
echo &#8221; The hard disk is ready for installation.&#8221;<br />
echo &#8220;+=============================================+&#8221;<br />
echo<br />
#sleep 3</p>
<p>echo<br />
echo &#8220;+=============================================+&#8221;<br />
echo &#8221; Processing the package installation &#8230;&#8221;<br />
echo<br />
sleep 3</p>
<p># Mount the Slackware source<br />
for MEDIA in \<br />
  /dev/hdc /dev/hdd /dev/hda /dev/hdb \<br />
  /dev/hde /dev/hdf /dev/hdg /dev/hdh \<br />
  /dev/hdi /dev/hdj /dev/hdk /dev/hdl \<br />
  /dev/sr0 /dev/sr1 /dev/sr2 /dev/sr3 \<br />
  /dev/pcd0 /dev/pcd1 /dev/pcd2 /dev/pcd3;<br />
do<br />
  mount -t iso9660 -o ro $MEDIA $SRC 1>/dev/null 2>&#038;1<br />
  if [ $? = 0 ]; then<br />
    break<br />
  fi<br />
done</p>
<p>if [ "`mount|grep "$SRC"`" = "" ]; then<br />
  echo<br />
  echo &#8220;Couldn&#8217;t found the installation source!&#8221;<br />
  echo &#8220;Abort &#8230;&#8221;<br />
  echo<br />
  exit 1<br />
else<br />
  # Process the installation<br />
  echo<br />
  echo &#8220;Found the installation source.&#8221;<br />
  echo &#8220;Now going to install the packages &#8230;&#8221;<br />
  echo<br />
  sleep 3<br />
  for series in a ap d l n; # you may do some change here<br />
  do<br />
    installpkg -root $DEST -priority ADD $SRC/slackware/$series/*.tgz<br />
  done</p>
<p>  echo<br />
  echo &#8221; All packages have been installed.&#8221;<br />
  echo &#8220;+=============================================+&#8221;<br />
  echo<br />
  sleep 3<br />
fi</p>
<p># config system<br />
echo<br />
echo &#8220;+==============================================+&#8221;<br />
echo &#8221; Configuring the system, wait for a while &#8230;&#8221;<br />
echo</p>
<p># Permission issue<br />
chmod 755 $DEST $DEST/var/spool/mail 1>dev/null 2>&#038;1</p>
<p># Kernel setting<br />
(cd $DEST/boot<br />
rm -rf vmlinuz config System.map 1>/dev/null 2>&#038;1<br />
cp -a $SRC/kernels/$KERNEL/System.map.gz ./System.map-$KNAME-$KVERSION.gz<br />
cp -a $SRC/kernels/$KERNEL/bzImage ./vmlinuz-$KNAME-$KVERSION<br />
cp -a $SRC/kernels/$KERNEL/config ./config-$KNAME-$KVERSION<br />
gzip -df System.map-$KNAME-$KVERSION.gz<br />
ln -sf vmlinuz-$KNAME-$KVERSION vmlinuz<br />
ln -sf config-$KNAME-$KVERSION config<br />
ln -sf System.map-$KNAME-$KVERSION System.map<br />
)</p>
<p># Boot loader<br />
cat > $DEST/etc/lilo.conf << EOF<br />
boot = $DISK<br />
timeout = 0<br />
change-rules<br />
reset<br />
vga = normal<br />
image = /boot/vmlinuz<br />
root = $ROOT_PART<br />
label = default<br />
read-only<br />
EOF<br />
lilo -r $DEST -C /etc/lilo.conf</p>
<p># Network<br />
for nicm in \<br />
  e1000 tg3 eepro100 epic100 8139too 8139cp pcnet32 hp100 ne2k-pci olympic rcpci 3c59x acenic de4x5 dgrs sktr skge tulip via-rhine yellowfin dl2k ns83820;<br />
do<br />
  modprobe $nicm 2> /dev/null<br />
  grep -q eth /proc/net/dev<br />
  if [ $? = 0 ]; then<br />
    echo &#8220;/sbin/modprobe $nicm&#8221; > $DEST/etc/rc.d/rc.netdevice<br />
    chmod 755 $DEST/etc/rc.d/rc.netdevice<br />
    break<br />
  else<br />
    rmmod $nicm 2> /dev/null<br />
  fi<br />
done</p>
<p>if [ ! -f $DEST/etc/rc.d/rc.netdevice ]; then<br />
  echo<br />
  echo &#8220;Warning: No network interface card found.&#8221;<br />
  echo &#8220;Maybe, you need to check the card(s) or the modules.&#8221;<br />
  echo<br />
fi </p>
<p>[... Network setups, e.g., $DEST/etc/rc.d/rc.inet1.conf, $DEST/etc/networks, \<br />
     $DEST/etc/hosts, $DEST/etc/HOSTNAME, $DEST/etc/resolv.conf, here \<br />
  snip...]</p>
<p># Time config<br />
cat $DEST/usr/share/zoneinfo/Asia/Shanghai > $DEST/etc/localtime<br />
cat > $DEST/etc/hardwareclocl << EOF<br />
localtime<br />
EOF</p>
<p># The /etc/fstab file<br />
cat $TMP/fstab.tmp > $DEST/etc/fstab<br />
printf &#8220;%-16s %-16s %-11s %-16s %-3s %s\n&#8221; &#8220;#/dev/cdrom&#8221; &#8220;/mnt/cdrom&#8221; &#8220;auto&#8221; &#8220;noauto,owner,ro&#8221; &#8220;0&#8243; &#8220;0&#8243; >> $DEST/etc/fstab<br />
printf &#8220;%-16s %-16s %-11s %-16s %-3s %s\n&#8221; &#8220;#/dev/fd0&#8243; &#8220;/mnt/floppy&#8221; &#8220;auto&#8221; &#8220;noauto,owner&#8221; &#8220;0&#8243; &#8220;0&#8243; >> $DEST/etc/fstab<br />
printf &#8220;%-16s %-16s %-11s %-16s %-3s %s\n&#8221; &#8220;devpts&#8221; &#8220;/dev/pts&#8221; &#8220;devpts&#8221; &#8220;gid=5,mode=620&#8243; &#8220;0&#8243; &#8220;0&#8243; >> $DEST/etc/fstab<br />
printf &#8220;%-16s %-16s %-11s %-16s %-3s %s\n&#8221; &#8220;proc&#8221; &#8220;/proc&#8221; &#8220;proc&#8221; &#8220;defaults&#8221; &#8220;0&#8243; &#8220;0&#8243; >> $DEST/etc/fstab<br />
printf &#8220;%-16s %-16s %-11s %-16s %-3s %s\n&#8221; &#8220;tmpfs&#8221; &#8220;/dev/shm&#8221; &#8220;tmpfs&#8221; &#8220;defaults&#8221; &#8220;0&#8243; &#8220;0&#8243; >> $DEST/etc/fstab</p>
<p># Misc<br />
cat > $DEST/etc/sysctl.conf << EOF<br />
[... snip ...]<br />
EOF</p>
<p>rm -f $DEST/var/spool/mail/root<br />
sed -i '/^c[2-6].*agetty/s/^/#/' $DEST/etc/inittab<br />
sed -i '/^\/sbin\/modprobe.*[parport_pc|lp|agpgart]/s/^/#/' $DEST/etc/rc.d/rc.modules<br />
echo "blacklist ipv6" >> $DEST/etc/modprobe.d/blacklist<br />
chroot $DEST /sbin/ldconfig<br />
chroot $DEST /usr/bin/passwd root</p>
<p># All finished<br />
echo<br />
echo &#8220;+=========================================================+&#8221;<br />
echo &#8221; Wooow, all done.&#8221;<br />
echo &#8221; Now you may reboot with CTRL-ALT-DELETE, enjoy. ;-)&#8221;<br />
echo &#8220;+=========================================================+&#8221;<br />
echo<br />
cat /etc/wel.come
</p></blockquote>
<p>Last, rebuild the initrd.img.</p>
<p><code>$ find . | cpio -o -H newc | gzip -9 > /PATH/TO/isolinux/initrd.img</code></p>
<p><strong>3 Customize the kernel</strong><br />
Re-build the kernel with your own config, then copy System.map.gz, bzImage, config, to the kernels/huge-smp directory, or an new directory in kernels/. I removed the &#8216;kernel-version&#8217; subdirectory of kernels/, as I just use the -smp kernel.<br />
Then modify isolinux/isolinux.cfg to fit the changes.</p>
<p><strong>4 Specify the packages to install</strong><br />
In the slackware/ directory, I just put the packages needed here, and removed the unneeded packages. (The setup script will install all the packages in the series directories.) It is possible to use tagfile to install packages. But I just want a small ISO to build the installation CD/DVD. Which method to use depends on the need. The former is preferred to my situation. If using the later, slackbasics.org has <a href="http://www.slackbasics.org/html/chap-pkgmgmt.html#chap-pkgmgmt-tagfiles" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/www.slackbasics.org');">an intro to the tagfiles</a>.<br />
I also added some packages built by myself. :-)</p>
<p><strong>5 Build the ISO image</strong><br />
At the top directory of the ISO source,<br />
<code>$ mkisofs -o /tmp/slackware-install-cd.iso -R -J -V "Slackware Install CD" -hide-rr-moved -v -d -N -no-emul-boot -boot-load-size 4 -boot-info-table -sort isolinux/iso.sort -b isolinux/isolinux.bin -c isolinux/isolinux.boot -A Slack-CD .</code>(do not forget this dot)<br />
then this ISO image could be used to burn an install CD/DVD.</p>
<p>That&#8217;s all.</p>
<p>Notes:</p>
<li>I&#8217;d prefer to make an auto install CD/DVD(just put the setup script path in etc/rc.d/rc.S), and auto reboot when the installation finished(put an reboot command at the end of the setup script). I would just need to boot the machine with CD/DVD then left for WC or smoking, when back, the system was up and ready for use. lol</li>
<li>It&#8217;s suitable to make an install CD/DVD for other versions of Slackware.</li>
<li>It&#8217;s also suitable to make an image for network(PXE) booting and [auto ]installation. I think it&#8217;s more sensible and necessary.</li>
]]></content:encoded>
			<wfw:commentRss>http://dotimes.com/iscale/2008/04/building-customized-installation-cddvd-of-slackware.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Benchmark Caching of Varnish and Squid Again</title>
		<link>http://dotimes.com/iscale/2008/04/benchmark-caching-of-varnish-and-squid-again.html</link>
		<comments>http://dotimes.com/iscale/2008/04/benchmark-caching-of-varnish-and-squid-again.html#comments</comments>
		<pubDate>Tue, 01 Apr 2008 08:06:35 +0000</pubDate>
		<dc:creator>Cherife Li</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[proxy]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[squid]]></category>

		<category><![CDATA[varnish]]></category>

		<guid isPermaLink="false">http://dotimes.com/iscale/?p=40</guid>
		<description><![CDATA[About two weeks ago, I did a simple benchmark on varnish and squid, and wrote this Benchmark Caching of Varnish and Squid post.
Today Willy Tarreau gave me some advise. So I took a short time re-ran this benchmark. Here follows the detail.
platform
Everything kept unchanged except for the proxy_server, I replaced it with this new one:

 [...]]]></description>
			<content:encoded><![CDATA[<p>About two weeks ago, I did a simple benchmark on varnish and squid, and wrote this <a href="http://dotimes.com/iscale/2008/03/benchmark-caching-of-varnish-and-squid.html">Benchmark Caching of Varnish and Squid</a> post.</p>
<p>Today <a href="http://1wt.eu/" onclick="javascript:pageTracker._trackPageview ('/outbound/1wt.eu');">Willy Tarreau</a> gave me <a href="http://dotimes.com/iscale/2008/03/benchmark-caching-of-varnish-and-squid.html#comment-55">some advise</a>. So I took a short time re-ran this benchmark. Here follows the detail.</p>
<p><strong>platform</strong><br />
Everything kept unchanged except for the <em>proxy_server</em>, I replaced it with this new one:</p>
<pre>
    o OS: Linux 2.6.21.5-smp i686 (Slackware 12.0)
    o CPU:  Intel(R) Xeon(TM) CPU 3.06GHz x 2
    o MEM: 1024M x 6
    o DISK: RAID 5
    o Ethernet controller:  Intel Corporation 82546EB Gigabit Ethernet Controller
</pre>
<p><strong>file pool</strong><br />
This time, I generated 2 sets of 10Mbyte files, one is 1,000 files of 10kbyte size, and the other is 10 files of 1MByte size.</p>
<p><strong>benchmark</strong></p>
<pre>
    * client: http_load
    * proxy server: varnish 1.1.2, squid 2.6.STABLE18, and squid 3.0.STABLE2.
    * http server: nginx/0.6.28
</pre>
<p>Using the same configurations of nginx, varnish, and squid 2/3, got the results below:<br />
<br />
+++ 10KByte +++<br />
<br />
$ <code>http_load -verbose -parallel 100 -fetches 100000 ./10k.urls</code><br />
</p>
<blockquote><p>
100000 fetches, 100 max parallel, 1.024e+09 bytes, in 14.7505 seconds<br />
10240 mean bytes/connection<br />
6779.43 fetches/sec, 6.94213e+07 bytes/sec<br />
msecs/connect: 0.400918 mean, 11.452 max, 0.067 min<br />
msecs/first-response: 14.0161 mean, 1779.32 max, 0.24 min<br />
HTTP response codes:<br />
  code 200 &#8212; 100000
</p></blockquote>
<p>* Squid 2.6.STABLE18:</p>
<blockquote><p>
100000 fetches, 100 max parallel, 1.024e+09 bytes, in 26.1771 seconds<br />
10240 mean bytes/connection<br />
3820.13 fetches/sec, 3.91181e+07 bytes/sec<br />
msecs/connect: 0.497665 mean, 2990.79 max, 0.055 min<br />
msecs/first-response: 21.0663 mean, 3018.84 max, 4.071 min<br />
HTTP response codes:<br />
  code 200 &#8212; 100000
</p></blockquote>
<p>* Squid 3.0.STABLE2:</p>
<blockquote><p>
&#8212; 60.0027 secs, 100000 fetches started, 96249 completed, 0 current<br />
100000 fetches, 100 max parallel, 9.85651e+08 bytes, in 102.375 seconds<br />
9856.51 mean bytes/connection<br />
976.8 fetches/sec, 9.62785e+06 bytes/sec<br />
msecs/connect: 2.56114 mean, 91.428 max, 0.061 min<br />
msecs/first-response: 27.8048 mean, 94.563 max, 1.288 min<br />
3751 timeouts<br />
3745 bad byte counts<br />
HTTP response codes:<br />
  code 200 &#8212; 96255
</p></blockquote>
<p>+++ 1MByte +++<br />
<br />
$ <code>http_load -verbose -parallel 100 -fetches 1000 ./1m.urls</code><br />
<br />
* Varnish 1.1.2:</p>
<blockquote><p>
&#8212; 60 secs, 6640 fetches started, 6540 completed, 100 current<br />
10000 fetches, 100 max parallel, 1.04858e+10 bytes, in 91.1719 seconds<br />
1.04858e+06 mean bytes/connection<br />
109.683 fetches/sec, 1.15011e+08 bytes/sec<br />
msecs/connect: 36.9187 mean, 9019.28 max, 0.08 min<br />
msecs/first-response: 26.7986 mean, 475.462 max, 18.781 min<br />
HTTP response codes:<br />
  code 200 &#8212; 10000
</p></blockquote>
<p>* Squid 2.6.STABLE18:</p>
<blockquote><p>
&#8212; 60 secs, 5856 fetches started, 5756 completed, 100 current<br />
10000 fetches, 100 max parallel, 1.04858e+10 bytes, in 103.829 seconds<br />
1.04858e+06 mean bytes/connection<br />
96.3126 fetches/sec, 1.00991e+08 bytes/sec<br />
msecs/connect: 2.4862 mean, 2994.65 max, 0.063 min<br />
msecs/first-response: 15.9743 mean, 134.817 max, 8.222 min<br />
HTTP response codes:<br />
  code 200 &#8212; 10000
</p></blockquote>
<p>* Squid 3.0.STABLE2:</p>
<blockquote><p>
&#8212; 60 secs, 6083 fetches started, 5983 completed, 100 current<br />
10000 fetches, 100 max parallel, 1.04858e+10 bytes, in 103.054 seconds<br />
1.04858e+06 mean bytes/connection<br />
97.0367 fetches/sec, 1.0175e+08 bytes/sec<br />
msecs/connect: 6.6513 mean, 3022.23 max, 0.089 min<br />
msecs/first-response: 16.0642 mean, 787.308 max, 0.741 min<br />
HTTP response codes:<br />
  code 200 &#8212; 10000
</p></blockquote>
<p><strong>proxy server system status</strong></p>
<p>+++ 10KByte +++</p>
<p><a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/10k-varnish-iostat_xm5.log">10k-varnish-iostat_xm5</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/10k-squid2-iostat_xm5.log">10k-squid2-iostat_xm5</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/10k-squid3-iostat_xm5.log">10k-squid3-iostat_xm5</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/10k-varnish-vmstat5.log">10k-varnish-vmstat5</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/10k-squid2-vmstat5.log">10k-squid2-vmstat5</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/10k-squid3-vmstat5.log">10k-squid3-vmstat5</a></p>
<p>+++ 1MByte +++</p>
<p><a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/1m-varnish-iostat_xm5.log">1m-varnish-iostat_xm5</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/1m-squid2-iostat_xm5.log">1m-squid2-iostat_xm5</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/1m-squid3-iostat_xm5.log">1m-squid3-iostat_xm5</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/1m-varnish-vmstat5.log">1m-varnish-vmstat5</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/1m-squid2-vmstat5.log">1m-squid2-vmstat5</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/1m-squid3-vmstat5.log">1m-squid3-vmstat5</a></p>
<p><strong>proxy status</strong></p>
<p><a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/10k-varnishstat.png" onclick="javascript:pageTracker._trackPageview ('/downloads/png/10k-varnishstat.png');"><img src="http://dotimes.com/iscale/wp-content/uploads/2008/04/10k-varnishstat-150x150.png" alt="" title="10k-varnishstat" width="150" height="150" class="alignnone size-thumbnail wp-image-75" /></a> <a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/10k-squid2.png" onclick="javascript:pageTracker._trackPageview ('/downloads/png/10k-squid2.png');"><img src="http://dotimes.com/iscale/wp-content/uploads/2008/04/10k-squid2-150x150.png" alt="" title="10k-squid2" width="150" height="150" class="alignnone size-thumbnail wp-image-79" /></a> <a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/10k-squid3.png" onclick="javascript:pageTracker._trackPageview ('/downloads/png/10k-squid3.png');"><img src="http://dotimes.com/iscale/wp-content/uploads/2008/04/10k-squid3-150x150.png" alt="" title="10k-squid3" width="150" height="150" class="alignnone size-thumbnail wp-image-80" /></a><br />
<br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/1m-varnishstat.png" onclick="javascript:pageTracker._trackPageview ('/downloads/png/1m-varnishstat.png');"><img src="http://dotimes.com/iscale/wp-content/uploads/2008/04/1m-varnishstat-150x150.png" alt="" title="1m-varnishstat" width="150" height="150" class="alignnone size-thumbnail wp-image-78" /></a> <a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/1m-squid2.png" onclick="javascript:pageTracker._trackPageview ('/downloads/png/1m-squid2.png');"><img src="http://dotimes.com/iscale/wp-content/uploads/2008/04/1m-squid2-150x150.png" alt="" title="1m-squid2" width="150" height="150" class="alignnone size-thumbnail wp-image-76" /></a> <a href="http://dotimes.com/iscale/wp-content/uploads/2008/04/1m-squid3.png" onclick="javascript:pageTracker._trackPageview ('/downloads/png/1m-squid3.png');"><img src="http://dotimes.com/iscale/wp-content/uploads/2008/04/1m-squid3-150x150.png" alt="" title="1m-squid3" width="150" height="150" class="alignnone size-thumbnail wp-image-77" /></a><br />
<br />
)-: Hmm, I&#8217;m still not satisfied with these results, especially the something about squid3.<br />
Maybe I need to optimize the configuration of the proxies?</p>
]]></content:encoded>
			<wfw:commentRss>http://dotimes.com/iscale/2008/04/benchmark-caching-of-varnish-and-squid-again.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Fasting Domain Name Resolution with Dnsmasq</title>
		<link>http://dotimes.com/iscale/2008/03/fasting-domain-name-resolution-with-dnsmasq.html</link>
		<comments>http://dotimes.com/iscale/2008/03/fasting-domain-name-resolution-with-dnsmasq.html#comments</comments>
		<pubDate>Sat, 22 Mar 2008 08:22:21 +0000</pubDate>
		<dc:creator>Cherife Li</dc:creator>
		
		<category><![CDATA[proxy]]></category>

		<category><![CDATA[dnsmasq]]></category>

		<guid isPermaLink="false">http://dotimes.com/iscale/2008/03/fasting-domain-name-resolution-with-dnsmasq.html</guid>
		<description><![CDATA[Dnsmasq is a lightweight DNS forwarder, DHCP server, and BOOTP/TFTP server for a small network (up to 1000 clients is known to work). It&#8217;s easy to configure and low resource cost.
I just use the DNS forward(cache) function here, which only serves with the systems of internal network, as the configuration file of the dnsmasq server [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.thekelleys.org.uk/dnsmasq/doc.html" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/www.thekelleys.org.uk');">Dnsmasq</a> is a lightweight DNS forwarder, DHCP server, and BOOTP/TFTP server for a small network (up to 1000 clients is known to work). It&#8217;s easy to configure and low resource cost.</p>
<p>I just use the DNS forward(cache) function here, which only serves with the systems of internal network, as the configuration file of the dnsmasq server below:</p>
<p><code>$ cat /etc/dnsmasq.conf</code></p>
<blockquote><p>
no-hosts<br />
neg-ttl=3600<br />
#log-queries<br />
log-facility=/var/log/dnsmasq.log<br />
pid-file=/var/run/dnsmasq.pid<br />
user=nobody<br />
group=nogroup<br />
port=53<br />
edns-packet-max=1280<br />
interface=eth0 # internal network<br />
except-interface=eth1 # external network<br />
#no-dhcp-interface=eth1<br />
listen-address=192.168.0.10<br />
bind-interfaces<br />
resolv-file=/etc/dnsmasq.resolv.conf<br />
strict-order<br />
#all-servers<br />
stop-dns-rebind<br />
#no-poll<br />
cache-size=2048<br />
no-negcache
</p></blockquote>
<p><code>$ cat /etc/resolv.conf</code></p>
<blockquote><p>nameserver 127.0.0.1</p></blockquote>
<p>On another system:</p>
<p><code>$ cat /etc/resolv.conf</code></p>
<blockquote><p>
nameserver 192.168.0.10<br />
nameserver 192.168.0.11
</p></blockquote>
<p>I think it&#8217;s a good choice to effect fault tolerance with setting up two dnsmasq servers. As the two lines above.</p>
<p>the <strong>first</strong> time:</p>
<p><code>$ dig dotimes.com</code></p>
<blockquote><p>
;; Query time: <strong>258 msec</strong><br />
;; SERVER: 192.168.0.10#53(192.168.0.10)
</p></blockquote>
<p>the <strong>second</strong> time:</p>
<p><code>$ dig dotimes.com</code></p>
<blockquote><p>
;; Query time: <strong>1 msec</strong><br />
;; SERVER: 192.168.0.10#53(192.168.0.10)
</p></blockquote>
<p>As you can see the difference in the above example.<br />
Yes, this is only one request, but what about surfing, or sending mails on mail server? It&#8217;s really worth the effort.</p>
<p><a href="http://cr.yp.to/djbdns.html" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/cr.yp.to');">djbdns</a>, <a href="http://www.phys.uu.nl/~rombouts/pdnsd.html" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/www.phys.uu.nl');">pdnsd</a> are also good DNS cache (proxy) programs, which yep worth a try.<br />
The only thing I&#8217;m wondering that whether djbdns is still under maintainence.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotimes.com/iscale/2008/03/fasting-domain-name-resolution-with-dnsmasq.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Abstract of HAProxy Architecture</title>
		<link>http://dotimes.com/iscale/2008/03/abstract-of-haproxy-architecture.html</link>
		<comments>http://dotimes.com/iscale/2008/03/abstract-of-haproxy-architecture.html#comments</comments>
		<pubDate>Fri, 21 Mar 2008 15:53:12 +0000</pubDate>
		<dc:creator>Cherife Li</dc:creator>
		
		<category><![CDATA[proxy]]></category>

		<category><![CDATA[haproxy]]></category>

		<category><![CDATA[ipvs]]></category>

		<guid isPermaLink="false">http://dotimes.com/iscale/2008/03/abstract-of-haproxy-architecture.html</guid>
		<description><![CDATA[Two of the projects of which the systems I&#8217;m maintaining currently are running IPVS (IP Virtual Server), an software from the LVS (Linux Virtual Server) Project, which implements transport-layer load balancing inside the Linux kernel, also called Layer-4 switching.
I really got impressed with its stability, scalability and high performance. It doesn&#8217;t cost any system resource [...]]]></description>
			<content:encoded><![CDATA[<p>Two of the projects of which the systems I&#8217;m maintaining currently are running IPVS (<a href="http://www.linuxvirtualserver.org/software/ipvs.html" target="_blank" title="IP Virtual Server" onclick="javascript:pageTracker._trackPageview ('/outbound/www.linuxvirtualserver.org');">IP Virtual Server</a>), an software from the LVS (<a href="http://www.linuxvirtualserver.org/" target="_blank" title="Linux Virtual Server Project" onclick="javascript:pageTracker._trackPageview ('/outbound/www.linuxvirtualserver.org');">Linux Virtual Server</a>) Project, which implements transport-layer load balancing inside the Linux kernel, also called Layer-4 switching.</p>
<p>I really got impressed with its stability, scalability and high performance. It doesn&#8217;t cost any system resource except memory usage, which depends on the connection number. And yet it&#8217;s very low-cost, for each connection entry consumes about 128bytes or so. It&#8217;s easy for you to figure it out that 100,000 unique connections/s, only 12.8M memory will be used. On the other hand, as a 4th-layer implement, IPVS just direct packages.</p>
<p>So, a question raised, what if I need layer-7 switching?</p>
<p>Yeah, IPVS no longer sucks. Here goes <a href="http://haproxy.1wt.eu/" target="_blank" title="The Reliable, High Performance TCP/HTTP Load Balancer" onclick="javascript:pageTracker._trackPageview ('/outbound/haproxy.1wt.eu');">HAProxy</a>, the reliable, high performance TCP/HTTP load balancer. Although there are other solutions, e.g., F5, pound, XLB, pen, and so on, I would like to chose HAProxy and introduce it here.</p>
<p>HAProxy is written by <a href="http://1wt.eu/" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/1wt.eu');">Willy TARREAU</a>, the new Linux Kernel 2.4 maintainer since August 2006, who also maintains patches against the 2.6.20 branch since August of 2007.</p>
<p>Today I glanced my eye over the <a href="http://haproxy.1wt.eu/download/1.2/doc/architecture.txt" target="_blank" title="HAProxy architecture guide" onclick="javascript:pageTracker._trackPageview ('/outbound/haproxy.1wt.eu');">HAProxy Architecture Guide</a>. I&#8217;d like to take a note here.</p>
<p>This note is so annoyed that you would better go for a drink, then <a href="http://youtube.com/" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/youtube.com');">YouTube</a>. Yeah, I&#8217;m serious. :-) Otherwise, it&#8217;s better to check the link in the line above for original detail if you are interested in the architecture. Okay, here I go, see you&#8230;</p>
<p><strong>1. Simple HTTP load-balancing with cookie insertion</strong></p>
<pre>
  192.168.1.1    192.168.1.11-192.168.1.14   192.168.1.2
 -------+-----------+-----+-----+-----+--------+----
        |           |     |     |     |       _|_db
     +--+--+      +-+-+ +-+-+ +-+-+ +-+-+    (___)
     | LB1 |      | A | | B | | C | | D |    (___)
     +-----+      +---+ +---+ +---+ +---+    (___)
     haproxy        4 cheap web servers
</pre>
<p>Flows :</p>
<pre>
(client)                           (haproxy)                         (server A)
  >-- GET /URI1 HTTP/1.0 ------------> |
               ( no cookie, haproxy forwards in load-balancing mode. )
                                       | >-- GET /URI1 HTTP/1.0 ---------->
                                       | <-- HTTP/1.0 200 OK -------------<
               ( the proxy now adds the server cookie in return )
  <-- HTTP/1.0 200 OK ---------------< |
      Set-Cookie: SERVERID=A           |
  >-- GET /URI2 HTTP/1.0 ------------> |
      Cookie: SERVERID=A               |
      ( the proxy sees the cookie. it forwards to server A and deletes it )
                                       | >-- GET /URI2 HTTP/1.0 ---------->
                                       | <-- HTTP/1.0 200 OK -------------<
   ( the proxy does not add the cookie in return because the client knows it )
  <-- HTTP/1.0 200 OK ---------------< |
  >-- GET /URI3 HTTP/1.0 ------------> |
      Cookie: SERVERID=A               |
                                    ( ... )
</pre>
<p>If clients use keep-alive (HTTP/1.1), only the first response will have a cookie inserted, and only the first request of each session will be analyzed. The added server cookie will not be removed from the requests forwarded to the servers, so the server must not be sensitive to unknown cookies. If this causes trouble, keep-alive can be disabled by adding the following option :</p>
<blockquote><p>option httpclose</p></blockquote>
<p>If for some reason the clients cannot learn more than one cookie, and the application already produces a cookie, &#8220;prefix&#8221; mode could be used(see below).</p>
<p>Backing LB1 up using keepalived for healthcheck &amp; failover(see below)</p>
<p>If the application needs to log the original client&#8217;s IP, use the &#8220;forwardfor&#8221; option which will add an &#8220;X-Forwarded-For&#8221; header with the original client&#8217;s IP address. Also use &#8220;httpclose&#8221; to rewrite every requests and not only the first one of each session :</p>
<blockquote><p>     option httpclose<br />
option forwardfor</p></blockquote>
<p>The web server will have to be configured to use this header instead. For example, on apache:</p>
<blockquote><p>     LogFormat &#8220;%{X-Forwarded-For}i %l %u %t \&#8221;%r\&#8221; %&gt;s %b &#8221; combined<br />
CustomLog /var/log/httpd/access_log combined</p></blockquote>
<p>In the situation of clients disable cookies on their browser, use the &#8220;source&#8221; balancing algorithm instead of the &#8220;roundrobin&#8221;. So a given IP address will always reaches the same server. (as long as the number of servers remains unchanged.) Never use this behind a proxy or in a small network, because the distribution will be unfair. However, in large internal networks, and on the internet, it works quite well. Clients<br />
which have a dynamic address will not be affected as long as they accept the cookie, because the cookie always has precedence over load balancing.</p>
<p><strong>2. HTTP load-balancing with cookie prefixing and high availability</strong></p>
<p>Backed load-balancer up with a second one in VRRP mode using keepalived.</p>
<blockquote><p>        http://www.keepalived.org/</p></blockquote>
<p>Allow the proxy to bind to the shared IP:</p>
<p><code># echo 1 &gt;/proc/sys/net/ipv4/ip_nonlocal_bind</code></p>
<pre>
    shared IP=192.168.1.1
  192.168.1.3  192.168.1.4    192.168.1.11-192.168.1.14   192.168.1.2
 -------+------------+-----------+-----+-----+-----+--------+----
        |            |           |     |     |     |       _|_db
     +--+--+      +--+--+      +-+-+ +-+-+ +-+-+ +-+-+    (___)
     | LB1 |      | LB2 |      | A | | B | | C | | D |    (___)
     +-----+      +-----+      +---+ +---+ +---+ +---+    (___)
     haproxy      haproxy        4 cheap web servers
     keepalived   keepalived
</pre>
<p>Set the &#8220;httpclose&#8221; option to disable keep-alive (HTTP/1.1), so the proxy can access to all cookies in all requests for each session, because the proxy will modify EVERY cookie sent by the client and the server.</p>
<p>Flows :</p>
<pre>
(client)                           (haproxy)                         (server A)
  >-- GET /URI1 HTTP/1.0 ------------> |
               ( no cookie, haproxy forwards in load-balancing mode. )
                                       | >-- GET /URI1 HTTP/1.0 ---------->
                                       |     X-Forwarded-For: 10.1.2.3
                                       | <-- HTTP/1.0 200 OK -------------<
                        ( no cookie, nothing changed )
  <-- HTTP/1.0 200 OK ---------------< |
  >-- GET /URI2 HTTP/1.0 ------------> |
    ( no cookie, haproxy forwards in lb mode, possibly to another server. )
                                       | >-- GET /URI2 HTTP/1.0 ---------->
                                       |     X-Forwarded-For: 10.1.2.3
                                       | <-- HTTP/1.0 200 OK -------------<
                                       |     Set-Cookie: JSESSIONID=123
    ( the cookie is identified, it will be prefixed with the server name )
  <-- HTTP/1.0 200 OK ---------------< |
      Set-Cookie: JSESSIONID=A~123     |
  >-- GET /URI3 HTTP/1.0 ------------> |
      Cookie: JSESSIONID=A~123         |
       ( the proxy sees the cookie, removes the server name and forwards
          to server A which sees the same cookie as it previously sent )
                                       | >-- GET /URI3 HTTP/1.0 ---------->
                                       |     Cookie: JSESSIONID=123
                                       |     X-Forwarded-For: 10.1.2.3
                                       | <-- HTTP/1.0 200 OK -------------<
                        ( no cookie, nothing changed )
  <-- HTTP/1.0 200 OK ---------------< |
                                    ( ... )
</pre>
<p>Setting &#8220;weight&#8221;(values between 1 and 256) to inform haproxy to spread the load of backends the most smoothly possible respecting those ratios:</p>
<blockquote><p>        server webA 192.168.1.11:80 cookie A weight 12 check<br />
server webC 192.168.1.13:80 cookie C weight 26 check</p></blockquote>
<p><strong>2.1 Variations involving external layer 4 load-balancers</strong></p>
<p>Can the haproxies be load-balanced?<br />
Yeah, by a layer4 load-balancer (eg: Alteon) which will check the services:</p>
<pre>
              | VIP=192.168.1.1
         +----+----+
         | Alteon  |
         +----+----+
              |
 192.168.1.3  |  192.168.1.4  192.168.1.11-192.168.1.14   192.168.1.2
 -------+-----+------+-----------+-----+-----+-----+--------+----
        |            |           |     |     |     |       _|_db
     +--+--+      +--+--+      +-+-+ +-+-+ +-+-+ +-+-+    (___)
     | LB1 |      | LB2 |      | A | | B | | C | | D |    (___)
     +-----+      +-----+      +---+ +---+ +---+ +---+    (___)
     haproxy      haproxy        4 cheap web servers
</pre>
<p>What if the Alteon fails? Want relay generic TCP protocols (SMTP, TSE, VNC, etc&#8230;)? (see below)</p>
<p><strong>2.2 Generic TCP relaying and external layer 4 load-balancers</strong></p>
<p>Using the &#8220;monitor-net&#8221; keyword to specify a network which will be dedicated to monitoring systems and must not lead to a forwarding connection nor to any log. This expects a version of haproxy greater than or equal to 1.1.32 or 1.2.6.</p>
<pre>
                |  VIP=172.16.1.1   |
           +----+----+         +----+----+
           | Alteon1 |         | Alteon2 |
           +----+----+         +----+----+
 192.168.1.252  |  GW=192.168.1.254 |  192.168.1.253
                |                   |
          ------+---+------------+--+-----------------> TSE farm : 192.168.1.10
       192.168.1.1  |            | 192.168.1.2
                 +--+--+      +--+--+
                 | LB1 |      | LB2 |
                 +-----+      +-----+
                 haproxy      haproxy
</pre>
<p><strong>3. Simple HTTP/HTTPS load-balancing with cookie insertion</strong></p>
<pre>
  192.168.1.1    192.168.1.11-192.168.1.14   192.168.1.2
 -------+-----------+-----+-----+-----+--------+----
        |           |     |     |     |       _|_db
     +--+--+      +-+-+ +-+-+ +-+-+ +-+-+    (___)
     | LB1 |      | A | | B | | C | | D |    (___)
     +-----+      +---+ +---+ +---+ +---+    (___)
     apache         4 cheap web servers
     mod_ssl
     haproxy
</pre>
<p>Do not cache inserted cookies for security measures.</p>
<p>If the cookie works in &#8220;prefix&#8221; mode, there is no need to add the &#8220;nocache&#8221; option because it is an application cookie which will be modified, and the application flags will be preserved.</p>
<p>If apache 1.3 is used as a front-end before haproxy, it always disables HTTP keep-alive on the back-end, so the &#8220;httpclose&#8221; is needn&#8217;t.</p>
<p>To log client&#8217;s IP, configure apache to set the X-Forwarded-For header not on haproxy.</p>
<p>Flows :</p>
<pre>
(apache)                           (haproxy)                         (server A)
  >-- GET /URI1 HTTP/1.0 ------------> |
               ( no cookie, haproxy forwards in load-balancing mode. )
                                       | >-- GET /URI1 HTTP/1.0 ---------->
                                       | <-- HTTP/1.0 200 OK -------------<
               ( the proxy now adds the server cookie in return )
  <-- HTTP/1.0 200 OK ---------------< |
      Set-Cookie: SERVERID=A           |
      Cache-Control: private           |
  >-- GET /URI2 HTTP/1.0 ------------> |
      Cookie: SERVERID=A               |
      ( the proxy sees the cookie. it forwards to server A and deletes it )
                                       | >-- GET /URI2 HTTP/1.0 ---------->
                                       | <-- HTTP/1.0 200 OK -------------<
   ( the proxy does not add the cookie in return because the client knows it )
  <-- HTTP/1.0 200 OK ---------------< |
  >-- GET /URI3 HTTP/1.0 ------------> |
      Cookie: SERVERID=A               |
                                    ( ... )
</pre>
<p>What if only SSL is required and cache is not needed? (see below)</p>
<p><strong>3.1. Alternate solution using Stunnel</strong></p>
<p>Stunnel is a cheaper solution than Apache+mod_ssl. It doesn&#8217;t process HTTP or add X-Forwarded-For header by default. (there is a patch on the official haproxy site to provide this feature to recent stunnel versions.)</p>
<p>Stunnel will only process HTTPS. Haproxy will get all HTTP traffic, so add the X-Forwarded-For header for HTTP traffic in haproxy, but not for HTTPS traffic since stunnel will already have done it.</p>
<p>Use the &#8220;except&#8221; keyword to tell haproxy that connections from local host already have a valid header.</p>
<pre>
  192.168.1.1    192.168.1.11-192.168.1.14   192.168.1.2
 -------+-----------+-----+-----+-----+--------+----
        |           |     |     |     |       _|_db
     +--+--+      +-+-+ +-+-+ +-+-+ +-+-+    (___)
     | LB1 |      | A | | B | | C | | D |    (___)
     +-----+      +---+ +---+ +---+ +---+    (___)
     stunnel        4 cheap web servers
     haproxy
</pre>
<p>Description :<br />
- stunnel on LB1 will receive clients requests on port 443<br />
- it forwards them to haproxy bound to port 80<br />
- haproxy will receive HTTP client requests on port 80 and decrypted SSL<br />
requests from Stunnel on the same port.<br />
- stunnel will add the X-Forwarded-For header<br />
- haproxy will add the X-Forwarded-For header for everyone except the local<br />
address (stunnel).</p>
<p><strong>4. Soft-stop for application maintenance</strong><br />
<strong>4.1 Soft-stop using a file on the servers</strong></p>
<p>Put a file on the server which will be checked by the proxy. Remove this file so that the proxy will treat this server as dead, and won&#8217;t send any new sessions, only old ones if the &#8220;persist&#8221; option is used. Wait a bit then stop the server when there isn&#8217;t http connection anymore. And then it&#8217;s time to do backend server maintenance.</p>
<p>This solution will effect the clients, not so good.</p>
<p><strong>4.2 Soft-stop using backup servers</strong></p>
<p>Set two different names to one server checked on different port(one is 80), they share the exact same cookies. Those servers will only be used when no other server is available for the same cookie.</p>
<p>When the web servers are started, only one named server is seen as available. On the web server, redirect the other different port to local port 80(e.g., use iptables).</p>
<p>When need maintenance, simply stop the server from responding on port 81 so that its standard instance will be seen as failed, but the other will still work. This won&#8217;t effect the clients.</p>
<p><strong>4.2.1 Variations for operating systems without any firewall software</strong></p>
<p>Beside the iptables solution above, this redirection can also be handled by a simple haproxy in tcp mode :</p>
<blockquote><p>     global<br />
daemon<br />
quiet<br />
pidfile /var/run/haproxy-checks.pid<br />
listen 0.0.0.0:81<br />
mode tcp<br />
dispatch 127.0.0.1:80<br />
contimeout 1000<br />
clitimeout 10000<br />
srvtimeout 10000</p></blockquote>
<p>Starting an haproxy instance with this configuration to start the web service, and killing this instance will make the port 81 stopping responding so that the web service could be stopped.</p>
<p><strong>4.2.2 Centralizing the server management</strong></p>
<p>It&#8217;s also an solution to do the port redirection on the load-balancer.</p>
<p>Another solution is to use the &#8220;COMAFILE&#8221; patch provided by Alexander Lazic, which is available for download here :</p>
<blockquote><p>    http://w.ods.org/tools/haproxy/contrib/</p></blockquote>
<p><strong>4.3 Hot reconfiguration</strong></p>
<p>Send a SIGTTOU signal to the proxy and it will release the ports so that a new instance can be started.</p>
<p>If the new instance fails to start, sending a SIGTTIN signal back to the original processes will restore the listening ports.</p>
<p>Otherwise, sending a SIGUSR1 signal to the old one and it will exit after its last session ends.</p>
<p>If the old process still exists, sending a SIGTERM to the old process.</p>
<p><strong>5. Multi-site load-balancing with local preference</strong><br />
<strong>5.1 Network diagram</strong></p>
<p>Note : offices 1 and 2 are on the same continent as site 1, while office 3 is on the same continent as site 3. Each production site can reach the second one either through the WAN or through a dedicated link.</p>
<pre>
        Office1         Office2                          Office3
         users           users                            users
192.168  # # #   192.168 # # #                            # # #
.1.0/24  | | |   .2.0/24 | | |             192.168.3.0/24 | | |
  --+----+-+-+-   --+----+-+-+-                   ---+----+-+-+-
    |      | .1     |      | .1                      |      | .1
    |    +-+-+      |    +-+-+                       |    +-+-+
    |    |OP1|      |    |OP2|                       |    |OP3|  ...
  ,-:-.  +---+    ,-:-.  +---+                     ,-:-.  +---+
 (  X  )         (  X  )                          (  X  )
  `-:-'           `-:-'             ,---.          `-:-'
  --+---------------+------+----~~~(  X  )~~~~-------+---------+-
                           |        `---'                      |
                           |                                   |
                 +---+   ,-:-.                       +---+   ,-:-.
                 |SD1|  (  X  )                      |SD2|  (  X  )
   ( SITE 1 )    +-+-+   `-:-'         ( SITE 2 )    +-+-+   `-:-'
                   |.1     |                           |.1     |
   10.1.1.0/24     |       |     ,---. 10.2.1.0/24     |       |
        -+-+-+-+-+-+-+-----+-+--(  X  )------+-+-+-+-+-+-+-----+-+--
         | | | | |   |       |   `---'       | | | | |   |       |
      ...# # # # #   |.11    |.12         ...# # # # #   |.11    |.12
          Site 1   +-+--+  +-+--+              Site 2  +-+--+  +-+--+
          Local    |S1L1|  |S1L2|              Local   |S2L1|  |S2L2|
          users    +-+--+  +--+-+              users   +-+--+  +--+-+
                     |        |	                         |        |
   10.1.2.0/24    -+-+-+--+--++--      10.2.2.0/24    -+-+-+--+--++--
                   |.1       |.4                       |.1       |.4
                 +-+-+     +-+-+                     +-+-+     +-+-+
                 |W11| ~~~ |W14|                     |W21| ~~~ |W24|
                 +---+     +---+                     +---+     +---+
              4 application servers               4 application servers
                    on site 1                           on site 2
</pre>
<p><strong>5.2 Description</strong><br />
<strong>5.2.1 Local users</strong></p>
<p>- Office 1 users connect to OP1 = 192.168.1.1<br />
- Office 2 users connect to OP2 = 192.168.2.1<br />
- Office 3 users connect to OP3 = 192.168.3.1<br />
- Site 1 users connect to SD1 = 10.1.1.1<br />
- Site 2 users connect to SD2 = 10.2.1.1</p>
<p><strong>5.2.2 Office proxies</strong></p>
<p>- Office 1 connects to site 1 by default and uses site 2 as a backup.<br />
- Office 2 connects to site 1 by default and uses site 2 as a backup.<br />
- Office 3 connects to site 2 by default and uses site 1 as a backup.</p>
<p><strong>6. Source balancing</strong></p>
<p>Sometimes it may reveal useful to access servers from a pool of IP addresses instead of only one or two. Some equipments (NAT firewalls, load-balancers) are sensible to source address, and often need many sources to distribute the load evenly amongst their internal hash buckets.</p>
<p><strong>7. Managing high loads on application servers</strong></p>
<p>Limiting the number of connections between the clients and the servers. Setting haproxy to limit the number of connections on a per-server basis. It will then fill all the servers up to the configured connection limit, and will put the remaining connections in a queue, waiting for a connection to be released on a server.</p>
<p>So that,</p>
<p>* all clients can be served whatever their number without crashing the servers, the only impact it that the response time can be delayed.</p>
<p>* the servers can be used at full throttle without the risk of stalling, and fine tuning can lead to optimal performance.</p>
<p>* response times can be reduced by making the servers work below the congestion point, effectively leading to shorter response times even under moderate loads.</p>
<p>* no domino effect when a server goes down or starts up. Requests will be queued more or less, always respecting servers limits.</p>
<p>* it&#8217;s easy to achieve high performance even on memory-limited hardware. Indeed, heavy frameworks often consume huge amounts of RAM and not always all the CPU available. In case of wrong sizing, reducing the number of concurrent connections will protect against memory shortages while still ensuring optimal CPU usage.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotimes.com/iscale/2008/03/abstract-of-haproxy-architecture.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Benchmark Caching of Varnish and Squid</title>
		<link>http://dotimes.com/iscale/2008/03/benchmark-caching-of-varnish-and-squid.html</link>
		<comments>http://dotimes.com/iscale/2008/03/benchmark-caching-of-varnish-and-squid.html#comments</comments>
		<pubDate>Mon, 17 Mar 2008 16:45:01 +0000</pubDate>
		<dc:creator>Cherife Li</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[proxy]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[squid]]></category>

		<category><![CDATA[varnish]]></category>

		<guid isPermaLink="false">http://dotimes.com/iscale/2008/03/benchmark-caching-of-varnish-and-squid.html</guid>
		<description><![CDATA[#
#   Readme
#
# I re-ran this benchmark and got new results in another post, which are more reasonable.
# Thanks to Willy Tarreau for pointing out the inadequacy in this benchmark.
# It&#8217;s recommended that you skimming this post and then referring to this fresh one.
#
&#8212;&#8212;&#8211;
Today, I finished a benchmark to compare the caching performance and [...]]]></description>
			<content:encoded><![CDATA[<p>#<br />
#   Readme<br />
#<br />
# I re-ran this benchmark and got new results in another post, which are more reasonable.<br />
# Thanks to <a href="http://1wt.eu/" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/1wt.eu');">Willy Tarreau</a> for pointing out the inadequacy in this benchmark.<br />
# It&#8217;s recommended that you skimming this post and then referring to <a href="http://dotimes.com/iscale/2008/04/benchmark-caching-of-varnish-and-squid-again.html" target="_blank">this fresh one</a>.<br />
#<br />
&#8212;&#8212;&#8211;</p>
<p>Today, I finished a benchmark to compare the caching performance and status between Varnish and Squid, which get widely focused on as reverse proxies.<br />
Here we go.</p>
<p><strong>platform</strong></p>
<p>The test-network is made up of:</p>
<pre>
    * D-Link 1024R, a 24-port Gigabit Switch
    * http_server:
          o OS: Linux 2.6.21.5-smp i686 (Slackware 12.0)
          o CPU: Intel(R) Xeon(TM) CPU 2.80GHz x 2
          o MEM: 1024M x 6
          o DISK: SEAGATE ST373405LC SCSI Disk
          o Ethernet controller: Intel 82546EB PRO/1000 MT Dual Port Server Adapter
    * proxy_server:
          o OS: Linux 2.6.21.5-smp i686 (Slackware 12.0)
          o CPU:  Intel(R) Pentium(R) III CPU family 1133MHz GenuineIntel
          o MEM: 1024M
          o DISK: SEAGATE ST318406LC SCSI Disk
          o Ethernet controller:  Intel 82557/8/9 PRO/100+ Server Adapter
    * client
          o OS: Linux 2.4.31 i686 (Slackware 10.2)
          o CPU: Intel(R) Xeon(TM) CPU 2.80GHz x 2
          o MEM: 1024M x 6
          o Ethernet controller: Intel 82546EB Gigabit Ethernet Controller
</pre>
<p><strong>file pool</strong></p>
<blockquote><p>
<i><br />
#!/bin/sh<br />
#<br />
# Written for generating 2 sets of 100Mbyte files,<br />
# one is 1,000 files of 100kbyte size, and<br />
# the other is 10 files of 10MByte size.<br />
# by Cherife Li <cherife@dotimes.com><br />
#</p>
<p>docroot=/home/wwwroot/</p>
<p># generate the first set<br />
mkdir -p $docroot/100k<br />
cd $docroot/100k<br />
for i in `seq 1 10`; do<br />
   mkdir -p files-$i;<br />
   for j in `seq 1 100`; do<br />
      dd if=/dev/zero of=files-$i/$j bs=100K count=1 2> /dev/null;<br />
   done;<br />
done</p>
<p># generate the second set<br />
mkdir -p $docroot/10m<br />
cd $docroot/10m<br />
for i in `seq 1 5`; do<br />
   mkdir -p files-$i;<br />
   for j in `seq 1 2`; do<br />
      dd if=/dev/zero of=files-$i/$j bs=10M count=1 2> /dev/null;<br />
   done;<br />
done<br />
</i></p></blockquote>
<p>$ <code>cd /home/wwwroot/</code><br />
$ <code>find ./100k/ | grep 'files.*/.' | sed 's#./#http://benchmark.lo/#' > 100k.urls</code><br />
$ <code>find ./10m/ | grep 'files.*/.' | sed 's#./#http://benchmark.lo/#' > 10m.urls</code></p>
<p><strong>benchmark</strong></p>
<pre>
 ______        ____________        ___________
|      |--A-->|            |--B-->|           |
|client|      |proxy server|      |http server|
|______|<--D--|____________|<--C--|___________|

    * client: http_load
    * proxy server: varnish 1.1.2, squid 2.6.STABLE18, and squid 3.0.STABLE2.
    * http server: nginx/0.6.28
</pre>
<p>The Nginx http server only ran the stand alone http service.<br />
The proxy server ran the proxy service only the one been benchmarking at a time.</p>
<p><strong>http_load</strong><br />
It&#8217;s a good load-generator as it</p>
<pre>
    * allows random fetches from a list of URLs
    * allows a large number of parallel requests
    * is portable.
</pre>
<p>There are also other test tools, check <a href="http://www.softwareqatest.com/qatweb1.html#LOAD" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/www.softwareqatest.com');">this page</a> for detail.<br />
<br />
+++ 100KByte +++<br />
<br />
$ <code>http_load -verbose -parallel 100 -fetches 100000 ./100k.urls</code><br />
<br />
* Varnish 1.1.2:</p>
<blockquote><p>
    &#8212; 60 secs, 6868 fetches started, 6768 completed, 100 current<br />
    &#8212; 120 secs, 13720 fetches started, 13620 completed, 100 current<br />
    &#8212; 180 secs, 20570 fetches started, 20470 completed, 100 current<br />
    &#8212; 240 secs, 27432 fetches started, 27332 completed, 100 current<br />
    &#8212; 300 secs, 34285 fetches started, 34185 completed, 100 current<br />
    &#8212; 360 secs, 41140 fetches started, 41040 completed, 100 current<br />
    &#8212; 420 secs, 47996 fetches started, 47896 completed, 100 current<br />
    &#8212; 480 secs, 54854 fetches started, 54754 completed, 100 current<br />
    &#8212; 540 secs, 61709 fetches started, 61609 completed, 100 current<br />
    &#8212; 600 secs, 68565 fetches started, 68465 completed, 100 current<br />
    &#8212; 660 secs, 75419 fetches started, 75319 completed, 100 current<br />
    &#8212; 720 secs, 82279 fetches started, 82179 completed, 100 current<br />
    &#8212; 780 secs, 89131 fetches started, 89031 completed, 100 current<br />
    &#8212; 840 secs, 95989 fetches started, 95889 completed, 100 current<br />
    100000 fetches, 100 max parallel, 1.024e+10 bytes, in 876.794 seconds<br />
    102400 mean bytes/connection<br />
    114.052 fetches/sec, 1.16789e+07 bytes/sec<br />
    msecs/connect: 116.758 mean, 9111.16 max, 0.256 min<br />
    msecs/first-response: 120.03 mean, 2494.66 max, 0.614 min<br />
    HTTP response codes:<br />
      code 200 &#8212; 100000
</p></blockquote>
<p>* Squid 2.6.STABLE18:</p>
<blockquote><p>
    &#8212; 60 secs, 6898 fetches started, 6798 completed, 100 current<br />
    &#8212; 120 secs, 13748 fetches started, 13648 completed, 100 current<br />
    &#8212; 180 secs, 20595 fetches started, 20495 completed, 100 current<br />
    &#8212; 240 secs, 27439 fetches started, 27339 completed, 100 current<br />
    &#8212; 300 secs, 34287 fetches started, 34187 completed, 100 current<br />
    &#8212; 360 secs, 41136 fetches started, 41036 completed, 100 current<br />
    &#8212; 420 secs, 47983 fetches started, 47883 completed, 100 current<br />
    &#8212; 480 secs, 54829 fetches started, 54729 completed, 100 current<br />
    &#8212; 540 secs, 61675 fetches started, 61575 completed, 100 current<br />
    &#8212; 600 secs, 68523 fetches started, 68423 completed, 100 current<br />
    &#8212; 660 secs, 75371 fetches started, 75271 completed, 100 current<br />
    &#8212; 720 secs, 82221 fetches started, 82121 completed, 100 current<br />
    &#8212; 780 secs, 89065 fetches started, 88965 completed, 100 current<br />
    &#8212; 840 secs, 95909 fetches started, 95809 completed, 100 current<br />
    100000 fetches, 100 max parallel, 1.024e+10 bytes, in 878.411 seconds<br />
    102400 mean bytes/connection<br />
    113.842 fetches/sec, 1.16574e+07 bytes/sec<br />
    msecs/connect: 116.02 mean, 9114.65 max, 0.224 min<br />
    msecs/first-response: 115.596 mean, 619.381 max, 0.86 min<br />
    HTTP response codes:<br />
      code 200 &#8212; 100000
</p></blockquote>
<p>* Squid 3.0.STABLE2:</p>
<blockquote><p>
    &#8212; 60 secs, 6885 fetches started, 6785 completed, 100 current<br />
    &#8212; 120 secs, 13720 fetches started, 13620 completed, 100 current<br />
    &#8212; 180 secs, 20577 fetches started, 20477 completed, 100 current<br />
    &#8212; 240 secs, 27418 fetches started, 27318 completed, 100 current<br />
    &#8212; 300 secs, 34266 fetches started, 34166 completed, 100 current<br />
    &#8212; 360 secs, 41111 fetches started, 41011 completed, 100 current<br />
    &#8212; 420 secs, 47957 fetches started, 47857 completed, 100 current<br />
    &#8212; 480 secs, 54812 fetches started, 54712 completed, 100 current<br />
    &#8212; 540 secs, 61656 fetches started, 61556 completed, 100 current<br />
    &#8212; 600 secs, 68503 fetches started, 68403 completed, 100 current<br />
    &#8212; 660 secs, 75346 fetches started, 75246 completed, 100 current<br />
    &#8212; 720 secs, 82198 fetches started, 82098 completed, 100 current<br />
    &#8212; 780 secs, 89040 fetches started, 88940 completed, 100 current<br />
    &#8212; 840 secs, 95891 fetches started, 95791 completed, 100 current<br />
    100000 fetches, 100 max parallel, 1.024e+10 bytes, in 876.658 seconds<br />
    102400 mean bytes/connection<br />
    114.07 fetches/sec, 1.16807e+07 bytes/sec<br />
    msecs/connect: 115.858 mean, 9111.16 max, 0.26 min<br />
    msecs/first-response: 116.423 mean, 3318.18 max, 29.481 min<br />
    HTTP response codes:<br />
      code 200 &#8212; 100000
</p></blockquote>
<p>+++ 10MByte +++<br />
<br />
$ <code>http_load -verbose -parallel 100 -fetches 1000 ./10m.urls</code><br />
<br />
* Varnish 1.1.2:</p>
<blockquote><p>
    &#8212; 60 secs, 100 fetches started, 0 completed, 100 current<br />
    &#8212; 120 secs, 196 fetches started, 96 completed, 100 current<br />
    &#8212; 180 secs, 231 fetches started, 131 completed, 100 current<br />
    &#8212; 240 secs, 304 fetches started, 204 completed, 100 current<br />
    &#8212; 300 secs, 389 fetches started, 289 completed, 100 current<br />
    &#8212; 360 secs, 434 fetches started, 334 completed, 100 current<br />
    &#8212; 420 secs, 509 fetches started, 409 completed, 100 current<br />
    &#8212; 480 secs, 585 fetches started, 485 completed, 100 current<br />
    &#8212; 540 secs, 637 fetches started, 537 completed, 100 current<br />
    &#8212; 600 secs, 714 fetches started, 614 completed, 100 current<br />
    &#8212; 660 secs, 786 fetches started, 686 completed, 100 current<br />
    &#8212; 720 secs, 844 fetches started, 744 completed, 100 current<br />
    &#8212; 780 secs, 915 fetches started, 815 completed, 100 current<br />
    &#8212; 840 secs, 987 fetches started, 887 completed, 100 current<br />
    1000 fetches, 100 max parallel, 1.04858e+10 bytes, in 899.718 seconds<br />
    1.04858e+07 mean bytes/connection<br />
    1.11146 fetches/sec, 1.16545e+07 bytes/sec<br />
    msecs/connect: 129.428 mean, 3128.09 max, 0.291 min<br />
    msecs/first-response: 1003.12 mean, 9619.7 max, 120.662 min<br />
    HTTP response codes:<br />
      code 200 &#8212; 1000
</p></blockquote>
<p>* Squid 2.6.STABLE18:</p>
<blockquote><p>
    &#8212; 60 secs, 103 fetches started, 3 completed, 100 current<br />
    &#8212; 120 secs, 178 fetches started, 78 completed, 100 current<br />
    &#8212; 180 secs, 255 fetches started, 155 completed, 100 current<br />
    &#8212; 240 secs, 322 fetches started, 222 completed, 100 current<br />
    &#8212; 300 secs, 379 fetches started, 279 completed, 100 current<br />
    &#8212; 360 secs, 458 fetches started, 358 completed, 100 current<br />
    &#8212; 420 secs, 518 fetches started, 418 completed, 100 current<br />
    &#8212; 480 secs, 583 fetches started, 483 completed, 100 current<br />
    &#8212; 540 secs, 661 fetches started, 561 completed, 100 current<br />
    &#8212; 600 secs, 721 fetches started, 621 completed, 100 current<br />
    &#8212; 660 secs, 786 fetches started, 686 completed, 100 current<br />
    &#8212; 720 secs, 863 fetches started, 763 completed, 100 current<br />
    &#8212; 780 secs, 926 fetches started, 826 completed, 100 current<br />
    &#8212; 840 secs, 984 fetches started, 884 completed, 100 current<br />
    1000 fetches, 100 max parallel, 1.04858e+10 bytes, in 894.062 seconds<br />
    1.04858e+07 mean bytes/connection<br />
    1.11849 fetches/sec, 1.17282e+07 bytes/sec<br />
    msecs/connect: 137.644 mean, 9128.16 max, 0.283 min<br />
    msecs/first-response: 131.811 mean, 3509.99 max, 28.891 min<br />
    HTTP response codes:<br />
      code 200 &#8212; 1000
</p></blockquote>
<p>* Squid 3.0.STABLE2:</p>
<blockquote><p>
    &#8212; 60 secs, 105 fetches started, 5 completed, 100 current<br />
    &#8212; 120 secs, 190 fetches started, 90 completed, 100 current<br />
    http://benchmark.lo/10m/files-2/2: timed out<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-1/1: timed out<br />
    http://benchmark.lo/10m/files-1/1: byte count wrong<br />
    http://benchmark.lo/10m/files-5/2: timed out<br />
    http://benchmark.lo/10m/files-5/2: byte count wrong<br />
    http://benchmark.lo/10m/files-3/2: byte count wrong<br />
    http://benchmark.lo/10m/files-3/2: byte count wrong<br />
    http://benchmark.lo/10m/files-3/2: byte count wrong<br />
    http://benchmark.lo/10m/files-1/1: byte count wrong<br />
    http://benchmark.lo/10m/files-2/1: timed out<br />
    http://benchmark.lo/10m/files-2/1: byte count wrong<br />
    http://benchmark.lo/10m/files-1/1: byte count wrong<br />
    http://benchmark.lo/10m/files-2/1: byte count wrong<br />
    http://benchmark.lo/10m/files-2/1: byte count wrong<br />
    http://benchmark.lo/10m/files-4/2: timed out<br />
    http://benchmark.lo/10m/files-4/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-3/2: byte count wrong<br />
    http://benchmark.lo/10m/files-3/2: byte count wrong<br />
    http://benchmark.lo/10m/files-3/2: byte count wrong<br />
    http://benchmark.lo/10m/files-4/2: byte count wrong<br />
    http://benchmark.lo/10m/files-4/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-4/2: byte count wrong<br />
    http://benchmark.lo/10m/files-3/2: byte count wrong<br />
    http://benchmark.lo/10m/files-3/2: byte count wrong<br />
    http://benchmark.lo/10m/files-3/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-3/2: byte count wrong<br />
    http://benchmark.lo/10m/files-1/1: byte count wrong<br />
    http://benchmark.lo/10m/files-1/1: byte count wrong<br />
    http://benchmark.lo/10m/files-4/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/1: byte count wrong<br />
    http://benchmark.lo/10m/files-2/1: byte count wrong<br />
    http://benchmark.lo/10m/files-1/1: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/1: byte count wrong<br />
    http://benchmark.lo/10m/files-4/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-4/2: byte count wrong<br />
    &#8212; 180 secs, 260 fetches started, 160 completed, 100 current<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-1/1: byte count wrong<br />
    http://benchmark.lo/10m/files-3/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/1: byte count wrong<br />
    http://benchmark.lo/10m/files-3/2: byte count wrong<br />
    http://benchmark.lo/10m/files-3/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/1: byte count wrong<br />
    http://benchmark.lo/10m/files-4/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    http://benchmark.lo/10m/files-2/2: byte count wrong<br />
    &#8212; 240 secs, 315 fetches started, 215 completed, 100 current<br />
    &#8212; 300 secs, 395 fetches started, 295 completed, 100 current<br />
    &#8212; 360 secs, 464 fetches started, 364 completed, 100 current<br />
    &#8212; 420 secs, 521 fetches started, 421 completed, 100 current<br />
    &#8212; 480 secs, 596 fetches started, 496 completed, 100 current<br />
    &#8212; 540 secs, 664 fetches started, 564 completed, 100 current<br />
    &#8212; 600 secs, 725 fetches started, 625 completed, 100 current<br />
    &#8212; 660 secs, 798 fetches started, 698 completed, 100 current<br />
    &#8212; 720 secs, 865 fetches started, 765 completed, 100 current<br />
    &#8212; 780 secs, 929 fetches started, 829 completed, 100 current<br />
    &#8212; 840 secs, 997 fetches started, 897 completed, 100 current<br />
    1000 fetches, 100 max parallel, 1.03922e+10 bytes, in 886.272 seconds<br />
    1.03922e+07 mean bytes/connection<br />
    1.12832 fetches/sec, 1.17258e+07 bytes/sec<br />
    msecs/connect: 130.639 mean, 3127.72 max, 0.21 min<br />
    msecs/first-response: 186.15 mean, 3578.41 max, 34.601 min<br />
    5 timeouts<br />
    53 bad byte counts<br />
    HTTP response codes:<br />
      code 200 &#8212; 1000
</p></blockquote>
<p><strong>proxy server status</strong></p>
<p>+++ 100KByte +++</p>
<p><a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/100kvarnishiostat_xm5.log" title='varnish.iostat_xm5.log'>100k.varnish.iostat_xm5.log</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/100kvarnishvmstat5.log" title='varnish.vmstat5.log'>100k.varnish.vmstat5.log</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/100ksquid2iostat_xm5.log" title='squid2.iostat_xm5.log'>100k.squid2.iostat_xm5.log</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/100ksquid2vmstat5.log" title='squid2.vmstat5.log'>100k.squid2.vmstat5.log</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/100ksquid3iostat_xm5.log" title='squid3.iostat_xm5.log'>100k.squid3.iostat_xm5.log</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/100ksquid3vmstat5.log" title='squid3.vmstat5.log'>100k.squid3.vmstat5.log</a></p>
<p>+++ 10MByte +++</p>
<p><a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/10mvarnishiostat_xm5.log" title='varnish.iostat_xm5.log'>10m.varnish.iostat_xm5.log</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/10mvarnishvmstat5.log" title='10m.varnish.vmstat5.log'>10m.varnish.vmstat5.log</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/10msquid2iostat_xm5.log" title='10m.squid2.iostat_xm5.log'>10m.squid2.iostat_xm5.log</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/10msquid2vmstat5.log" title='10m.squid2.vmstat5.log'>10m.squid2.vmstat5.log</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/10msquid3iostat_xm5.log" title='10m.squid3.iostat_xm5.log'>10m.squid3.iostat_xm5.log</a><br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/10msquid3vmstat5.log" title='10m.squid3.vmstat5.log'>10m.squid3.vmstat5.log</a></p>
<p>After finished each benchmark, the status is as follow:<br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/bench_varnishstat.png" title='varnishstat' onclick="javascript:pageTracker._trackPageview ('/downloads/png/bench_varnishstat.png');"><img src='http://dotimes.com/iscale/wp-content/uploads/2008/03/bench_varnishstat.thumbnail.png' alt='varnishstat' /></a>    <a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/bench_squid2_mgr_info.png" title='squid2_mgr_info' onclick="javascript:pageTracker._trackPageview ('/downloads/png/bench_squid2_mgr_info.png');"><img src='http://dotimes.com/iscale/wp-content/uploads/2008/03/bench_squid2_mgr_info.thumbnail.png' alt='squid2_mgr_info' /></a>    <a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/bench_squid3_mgr_info.png" title='squid3_mgr_info' onclick="javascript:pageTracker._trackPageview ('/downloads/png/bench_squid3_mgr_info.png');"><img src='http://dotimes.com/iscale/wp-content/uploads/2008/03/bench_squid3_mgr_info.thumbnail.png' alt='squid3_mgr_info' /></a></p>
<p><strong>conclusion</strong></p>
<p>The data here, the reference in your mind.<br />
That which is the better choice as a caching proxy, depends on your own judgement.</p>
<p><strong>notes</strong></p>
<p>1. Varnish can cache files immediately.<br />
I found this while comparing the fetching of 10MB files.<br />
Varnish just request the nginx server for the file only once, but Squid will requests them for about<br />
10 times of varnish does.</p>
<p>2. Varnish provides easier access to proxy status.</p>
<p>3. Squid is more than a web proxy, while Varnish is more than an http accelerator (cache proxy).<br />
The Varnish web site claims that Varnish is ten to twenty times faster than the popular Squid<br />
cache on the same hardware.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotimes.com/iscale/2008/03/benchmark-caching-of-varnish-and-squid.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>i&#8217;m using the fs of a murderer</title>
		<link>http://dotimes.com/iscale/2008/03/im-using-the-fs-of-a-murderer.html</link>
		<comments>http://dotimes.com/iscale/2008/03/im-using-the-fs-of-a-murderer.html#comments</comments>
		<pubDate>Mon, 10 Mar 2008 06:33:14 +0000</pubDate>
		<dc:creator>Cherife Li</dc:creator>
		
		<category><![CDATA[storage]]></category>

		<category><![CDATA[filesystem]]></category>

		<guid isPermaLink="false">http://dotimes.com/iscale/2008/03/im-using-the-fs-of-a-murderer.html</guid>
		<description><![CDATA[Chat log in IRC:

&#60;Cherife&#62; hi all, namesys.com couldn't be solved, what happened?
&#60;LinuxyErin&#62; blah i cant sleep
&#60;echelon_&#62; what's namesys and how is it our problem?
&#60;Cherife&#62; it's the official reiserfs site, isn't it?
&#60;echelon_&#62; is it?
&#60;rob0&#62; Domain is still valid for another year.
&#60;rob0&#62; but nameservers are not responding
&#60;echelon_&#62; yup.. same here
* pdw (n=pdw@catv-5984bc75.catv.broadband.hu) has joined ##slackware
&#60;rob0&#62; Yes it [...]]]></description>
			<content:encoded><![CDATA[<p>Chat log in IRC:</p>
<pre>
&lt;Cherife&gt; hi all, namesys.com couldn't be solved, what happened?
&lt;LinuxyErin&gt; blah i cant sleep
&lt;echelon_&gt; what's namesys and how is it our problem?
&lt;Cherife&gt; it's the official reiserfs site, isn't it?
&lt;echelon_&gt; is it?
&lt;rob0&gt; Domain is still valid for another year.
&lt;rob0&gt; but nameservers are not responding
&lt;echelon_&gt; yup.. same here
* pdw (n=pdw@catv-5984bc75.catv.broadband.hu) has joined ##slackware
&lt;rob0&gt; Yes it is the reiserfs site.
&lt;echelon_&gt; that's what they get for using russian dns servers
&lt;Cherife&gt; lol
&lt;rob0&gt; Probably can find it in google cache or wayback machine.
&lt;sallygal&gt; echelon_, you just kill me
&lt;sallygal&gt; :)
&lt;rob0&gt; It's nominally a Russian-based company, only the owner is in jail in USA.
&lt;echelon_&gt; now what did he do that was so bad?
&lt;sallygal&gt; killed her
&lt;rob0&gt; Accused of murder, you hadn't heard?
&lt;rob0&gt; His estranged wife is missing
&lt;echelon_&gt; <strong>nice.. i'm using the fs of a murderer</strong> :D
.
.
.
</pre>
<p>So I married a Kernel Programmer&#8230;<br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/ep057.jpg" title='So I married a Kernel Programmer' onclick="javascript:pageTracker._trackPageview ('/downloads/jpg/ep057.jpg');"><img src='http://dotimes.com/iscale/wp-content/uploads/2008/03/ep057.jpg' alt='So I married a Kernel Programmer' /></a></p>
<p>Just joking, lol.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotimes.com/iscale/2008/03/im-using-the-fs-of-a-murderer.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>FUSE - Filesystem in Userspace</title>
		<link>http://dotimes.com/iscale/2008/03/fuse-filesystem-in-userspace.html</link>
		<comments>http://dotimes.com/iscale/2008/03/fuse-filesystem-in-userspace.html#comments</comments>
		<pubDate>Sun, 09 Mar 2008 12:13:57 +0000</pubDate>
		<dc:creator>Cherife Li</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[storage]]></category>

		<category><![CDATA[filesystem]]></category>

		<category><![CDATA[slackware]]></category>

		<guid isPermaLink="false">http://dotimes.com/iscale/2008/03/fuse-filesystem-in-userspace.html</guid>
		<description><![CDATA[Yesterday, Slackware -current repo got a big update &#8212; mainly kernel related stuff. Besides, Pat moved ntfsprogs tgz from /extra to ap/, which now includes full read-write support when the NTFS filesystem is mounted with ntfsmount or -t fuse.ntfs. This feature requires FUSE, which is added by Pat too.
Now we Slackers won&#8217;t need to do [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, Slackware -current repo got a big update &#8212; mainly kernel related stuff. Besides, Pat moved ntfsprogs tgz from /extra to ap/, which now includes full read-write support when the NTFS filesystem is mounted with ntfsmount or -t fuse.ntfs. This feature requires FUSE, which is added by Pat too.<br />
Now we Slackers won&#8217;t need to do much superfluous things ourselves to implementation full read-write support feature. I&#8217;m just a bit lazy, sometimes :-)</p>
<p>An simple intro from the <a href="http://fuse.sourceforge.net/" target="_blank" title="FUSE: Filesystem in Userspace" onclick="javascript:pageTracker._trackPageview ('/outbound/fuse.sourceforge.net');">FUSE website</a>:</p>
<pre>
With FUSE it is possible to implement a fully functional filesystem in a userspace program.  Features include:

    * Simple library API
    * Simple installation (no need to patch or recompile the kernel)
    * Secure implementation
    * Userspace - kernel interface is very efficient
    * Usable by non privileged users
    * Runs on Linux kernels 2.4.X and 2.6.X
    * Has proven very stable over time
</pre>
<p>The following figure shows the path of a filesystem call:<br />
<a href="http://dotimes.com/iscale/wp-content/uploads/2008/03/fuse_structure.png" title='fuse structure' onclick="javascript:pageTracker._trackPageview ('/downloads/png/fuse_structure.png');"><img src='http://dotimes.com/iscale/wp-content/uploads/2008/03/fuse_structure.png' alt='fuse structure' /></a></p>
<p>Operating Systems FUSE Supportes are Linux-2.4.X, Linux-2.6.X, FreeBSD, NetBSD, Mac OS X, Windows, OpenSolaris, GNU/Hurd. Check <a href="http://fuse.sourceforge.net/wiki/index.php/OperatingSystems" target="_blank" title="Detailed Operating Systems FUSE Supports" onclick="javascript:pageTracker._trackPageview ('/outbound/fuse.sourceforge.net');">this link</a> for detail.</p>
<p>There are various types of Filesystems based on FUSE, like:</p>
<pre>
# ArchiveFileSystems - accessing files inside archives (tar, cpio, zip, etc.)
# CompressedFileSystems - accessing files in a compressed image (gz, zlib, LiveCDs, etc.)
# DatabaseFileSystems - storing files in a relational database (MySQL, BerkeleyDB, etc.) \
    or ones allowing searching using tags or SQL queries
# EncryptedFileSystems - storing files in a more secure way by using a secret key
# MediaFileSystems - storing files on media devices such as cameras and music players \
    or accessing and categorizing media files
# HardwareFileSystems - provide access to weird hardware
# MonitoringFileSystems - provide notification when a file changes
# NetworkFileSystems - storing files on remote computers, including file servers and web sites
# NonNativeFileSystems - traditional disk-based file systems that aren't standard on \
    Linux (NTFS, ZFS, etc.)
# UnionFileSystems - merging multiple file systems into a single tree
# VersioningFileSystems - file systems that remember old versions of files and ones which \
    provide access to version control systems
</pre>
<p>Check <a href="http://fuse.sourceforge.net/wiki/index.php/FileSystems" target="_blank" title="Filesystems based on FUSE" onclick="javascript:pageTracker._trackPageview ('/outbound/fuse.sourceforge.net');">this link</a> for up-to-date detail.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotimes.com/iscale/2008/03/fuse-filesystem-in-userspace.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>SystemImager - Make Things Automatically Done</title>
		<link>http://dotimes.com/iscale/2008/03/systemimager-make-things-automatically-done.html</link>
		<comments>http://dotimes.com/iscale/2008/03/systemimager-make-things-automatically-done.html#comments</comments>
		<pubDate>Sun, 02 Mar 2008 14:10:37 +0000</pubDate>
		<dc:creator>Cherife Li</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[systemimager]]></category>

		<guid isPermaLink="false">http://dotimes.com/iscale/2008/03/systemimager-make-things-automatically-done.html</guid>
		<description><![CDATA[Intro:
SystemImager is a part of System Installation Suite which automates Linux installs, software distribution, and production deployment.
SystemImager makes it easy to do automated installs (clones), software distribution, content or data distribution, configuration changes, and operating system updates to your network of Linux machines. You can even update from one Linux release version to another!
It can [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Intro:</strong></p>
<p>SystemImager is a part of System Installation Suite which automates Linux installs, software distribution, and production deployment.</p>
<p>SystemImager makes it easy to do automated installs (clones), software distribution, content or data distribution, configuration changes, and operating system updates to your network of Linux machines. You can even update from one Linux release version to another!</p>
<p>It can also be used to ensure safe production deployments. By saving your current production image before updating to your new production image, you have a highly reliable contingency mechanism. If the new production enviroment is found to be flawed, simply roll-back to the last production image with a simple update command!</p>
<p>Some typical environments include: Internet server farms, database server farms, high performance clusters, computer labs, and corporate desktop environments. </p>
<p><strong>Benchmark</strong></p>
<p>Check <a href="http://wiki.systemimager.org/index.php/BitTorrent#Benchmark" title="a benchmark of systemimager - Installing more than 1000 nodes in 15min with SystemImager" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/wiki.systemimager.org');">this link</a> for detail.</p>
<p><strong>Useful Resource</strong></p>
<pre>
    * Article on linux.com: <a href="http://www.linux.com/article.pl?sid=06/04/24/1724216" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/www.linux.com');">Automate Linux installation and recovery with SystemImager</a>
    * HowTo sur Capweb.biz : <a href="http://www.capweb.biz/?page=tutoriaux&#038;voir=articles/linux/backup/image_backup_with_systemimager" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/www.capweb.biz');">Créer des images de votre système Linux avec SystemImager</a> (FR)
    * <a href="http://www.linuxjournal.com/article/9045" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/www.linuxjournal.com');">Clustering Is Not Rocket Science</a>
    * <a href="http://www.gridtoday.com/grid/720347.html" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/www.gridtoday.com');">Avatars and Grid 2.0</a> (article on Grid Today quoting SystemImager as a core component \
        used in the famous virtual world Second Life)
    * <a href="http://howto.krisbuytaert.be/AutomatingVirtualMachineDeployment" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/howto.krisbuytaert.be');">Automating Xen Virtual Machine Deployment</a> (how to integrate SystemImager with Xen to \
        create a totally open source deployment framework of virtual machines) 

    * <a href="http://www.nostarch.com/frameset.php?startat=cluster" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/www.nostarch.com');">The Linux Enterprise Cluster</a>
    * <a href="http://www.oreilly.com/catalog/highperlinuxc/" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/www.oreilly.com');">High Performance Linux Clusters with OSCAR, Rocks, OpenMosix, and MPI</a>
    * <a href="http://www.samspublishing.com/bookstore/product.asp?isbn=1578702747&#038;aid=E9AA1AB7-0303-47AB-9F3E-775CF68B45AC&#038;rl=1" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/www.samspublishing.com');">Linux Clustering: Building and Maintaining Linux Clusters</a>
    * <a href="http://www.springer.com/west/home?SGWID=4-102-22-33313559-0&#038;changeHeader=true&#038;referer=www.springeronline.com&#038;SHORTCUT=www.springer.com/west/0-7923-7892-X" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/www.springer.com');">Distributed and Parallel Systems: From Instruction Parallelism to Cluster Computing</a>
    * <a href="http://www.intel.com/cd/ids/developer/asmo-na/eng/102952.htm" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/www.intel.com');">High Performance Computing Clusters with Intel® Architecture, Part 2 </a>

    * <a href="http://dague.net/sean/sispaper.pdf" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/dague.net');">System Installation Suite: Massive Installation for Linux</a> - Sean Dague

    * <a href="http://sisuite.org/presentations/OLS_2002/sisols.pdf" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/sisuite.org');">SystemImager @ Ottawa Linux Symposium 2002</a> - Sean Dague
    * <a href="http://www.linuxtag.org/2007/en/conf/events/vp-donnerstag/details-talkid-63.html" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/www.linuxtag.org');">SystemImager @ LinuxTag 2007 in Berlin</a> - Andrea Righi, Brian Elliott Finley, Erich Focht
          o Get <a href="http://download.systemimager.org/pub/docs/SystemImager-LinuxTag-2007-paper.pdf" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/download.systemimager.org');">paper</a> and <a href="http://download.systemimager.org/pub/docs/SystemImager-LinuxTag-2007-presentation.pdf" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/download.systemimager.org');">presentation</a> of the talk in PDF 

    * <a href="http://www.cineca.it/bdp/sezioni/risorse/hardware/scheda?CODICE=bcx_5120_hpc&#038;BSDVAR_TIPOLOGIA=hpcspeciali" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/www.cineca.it');">SystemImager at CINECA</a>
          o The IBM BCX/5120 cluster in CINECA uses SystemImager
    * <a href="https://wiki.fysik.dtu.dk/niflheim/SystemImager_Installation" target="_blank" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/wiki.fysik.dtu.dk');">SystemImager at niflheim</a>
          o Wiki about SystemImager used for the NIFLHEIM cluster installation
</pre>
]]></content:encoded>
			<wfw:commentRss>http://dotimes.com/iscale/2008/03/systemimager-make-things-automatically-done.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Configuration of MySQL Replication</title>
		<link>http://dotimes.com/iscale/2007/12/configuration-of-mysql-replication.html</link>
		<comments>http://dotimes.com/iscale/2007/12/configuration-of-mysql-replication.html#comments</comments>
		<pubDate>Mon, 31 Dec 2007 09:25:33 +0000</pubDate>
		<dc:creator>Cherife Li</dc:creator>
		
		<category><![CDATA[database]]></category>

		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://dotimes.com/iscale/2007/12/configuration-of-mysql-replication.html</guid>
		<description><![CDATA[The Replication Process
Before this how to set up replication, take a quickly look at the steps that MySQL goes through to maintain a replicated server. The process is different depending on the version of MySQL. For purposes of this article, my comments will be for version 4.0 or higher, since most systems now are using [...]]]></description>
			<content:encoded><![CDATA[<p><strong>The Replication Process</strong></p>
<p>Before this how to set up replication, take a quickly look at the steps that MySQL goes through to maintain a replicated server. The process is different depending on the version of MySQL. For purposes of this article, my comments will be for version 4.0 or higher, since most systems now are using the later versions.</p>
<p>When replication is running, basically, as SQL statements are executed on the master server, MySQL records them in a binary log (bin.log) along with a log position identification number. The slave server in turn, through an IO thread, regularly and very often reads the master&#8217;s binary log for any changes. If it finds a change, it copies the new statements to its relay log (relay.log). It then records the new position identification number in a file (master.info) on the slave server. The slave then goes back to checking the master binary log, using the same IO thread. When the slave server detects a change to its relay log, through an SQL thread the slave executes the new SQL statement recorded in the relay log. As a safeguard, the slave also queries the master server through the SQL thread to compare its data with the master&#8217;s data. If the comparison shows inconsistency, the replication process is stopped and an error message is recorded in the slave&#8217;s error log (error.log). If the results of the query match, the new log position identification number is recorded in a file on the slave (relay-log.info) and the slave waits for another change to the relay log file.</p>
<p>This process may seem involved and complicated at first glance, but it all occurs quickly, it isn&#8217;t a significant drain on the master server, and it ensures reliable replication. Also, it&#8217;s surprisingly easy to set up. It only requires a few lines of options to be added to the configuration file (i.e., my.cnf) on the master and slave servers.</p>
<p><strong>How to Set Up Replication</strong></p>
<p>There are a number of different methods for setting up replication, and the exact method that you use will depend on how you are setting up replication, and whether you already have data within your master database.</p>
<p><strong>I. Creating a User for Replication</strong></p>
<p>Each Slave must connect to the Master using a standard username and password. It&#8217;s best not to use an existing account for security reasons, for the username and password will be stored in plain text within the <em>master.info</em> file. To do this, enter an SQL statement like the following on the master server, logged in as root or a user that has <em>GRANT OPTION</em> privileges:</p>
<pre>
mysql> GRANT REPLICATION SLAVE ON *.*
       -> TO 'replic'@'192.168.0.6' IDENTIFIED BY 'passwdhere';
</pre>
<p>
In this SQL statement, the user account <em>replic</em> is granted only what&#8217;s needed for replication. The user name can be almost anything. The IP address(or host name) <em>192.168.0.6</em> is given in quotes which is allowed to connect for replication. You should enter this same statement on the slave server with the same user name and password, but with the master&#8217;s host name or IP address. This way, if the master fails and will be down for a while, you could redirect users to the slave with DNS or by some other method. When the master is back up, you can then use replication to get it up to date by temporarily making it a slave to the former slave server. Incidentally, if you upgraded MySQL to version 4.0 recently, but didn&#8217;t upgrade your mysql database, the GRANT statement above won&#8217;t work because these privileges didn&#8217;t exist in the earlier versions.
</p>
<p><strong>II. Configuring Replication Master</strong></p>
<p>For replication to work you <em>must</em> enable binary logging on the master, for it is the binary log that is used to exchange data between the master and slaves.</p>
<p>Each server within a replication group must have a unique <em>server-id</em>. The server-id is used to identify individual servers within the group. You will need to add the following options to the configuration file <em>my.cnf</em> within the <em>[mysqld]</em> section. For example, to enable binary logging, using a log filename prefix of mysql-bin, and setting a server ID of 1:</p>
<pre>
[mysqld]
log-bin=mysql-bin
server-id=1
</pre>
<p>
Ensure that the skip-networking option has not been enabled on your replication master. If networking has been disabled, then your slave will not able to communicate with the master and replication will fail.</p>
<p><strong>III. Configuring Replication Slave</strong></p>
<p>
The only option you must configure on the slave is to set the unique server ID. Ensure that the slave server has the followling effective option:</p>
<pre>
[mysqld]
server-id=2
</pre>
<p>
If you are setting up multiple slaves, each one must have a unique <em>server-id</em> value that differs from that of the master and from each of the other slaves. You do not have to enable binary logging on the slave for replication to be enabled. However, if you enable binary logging on the slave then you can use the binary log for data backups and crash recovery on the slave, and also use the slave as part of a more complex replication topology.
</p>
<p><strong>IV. Obtaining the Master Replication Information</strong></p>
<p>
To configure replication on the slave you must determine the masters current point within the master binary log. You will need this information so that when the slave starts the replication process, it is able to start processing events from the binary log at the correct point.</p>
<p>If you have existing data on your master that you want to synchronize on your slaves before starting the replication process, then you must stop processing statements on the master, obtain the current position, and then dump the data, before allowing the master to continue executing statements. If you do not stop the execution of statements then the data dump, the master status information that you use will not match and you will end up with inconsistent or corrupted databases on the slaves.
</p>
<p>Start the command line client and flush all tables and block write statements by executing the FLUSH TABLES WITH READ LOCK statement:</p>
<pre>
mysql> FLUSH TABLES WITH READ LOCK;
</pre>
<p>Use the SHOW MASTER STATUS statement to determine the current binary log name and offset on the master:</p>
<pre>
mysql > SHOW MASTER STATUS;
+-----------------+----------+-----------------+---------------------+
| File                | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-----------------+----------+-----------------+---------------------+
|mysql-bin.0006| 98         |                      |                          |
+-----------------+----------+-----------------+---------------------+
</pre>
<p>
The File column shows the name of the log and Position shows the offset within the file. In this example, the binary log file is mysql-bin.006 and the offset is 98. Record these values. You need them later when you are setting up the slave.
</p>
<p>Keep the databases tables with read lock and follow the next step.</p>
<p><strong>V. Creating a Data Snapshot of Master</strong></p>
<p>There are several different ways to take a databases snapshot. From my experience, I prefer <em>mysqlhotcopy</em>(only for backing up <em>MyISAM</em> tables). For example, on master:</p>
<pre>
shell> mysqlhotcopy --allowold --noindices -u root -p passwdhere database-names /path-to-destdir
</pre>
<p>
When choosing databases to include in the copy, remember that you will need to filter out databases on each slave that you do not want to include in the replication process. Once you have created the archive or copy of the database, you will need to copy the files to each slave before starting the slave replication process. Now you could free the read lock on master:</p>
<pre>
mysql> UNLOCK TABLES;
</pre>
<p><strong>VI. Making Replication Process Running</strong></p>
<p>Importing the databases into slave, then starting the slave, skipping replication by using the <em>&#8211;skip-slave</em> option.</p>
<p>
To set up the slave to communicate with the master for replication, you must tell the slave the necessary connection information. To do this, execute the following statement on the slave, replacing the option values with the actual values relevant to your system:</p>
<pre>
mysql> CHANGE MASTER TO
       -> MASTER_HOST='master_host_name',
       -> MASTER_USER='replication_user_name',
       -> MASTER_PASSWORD='replication_password',
       -> MASTER_LOG_FILE='recorded_log_file_name',
       -> MASTER_LOG_POS=recorded_log_position;
</pre>
<p>After that, start the replication threads:</p>
<pre>
mysql> START SLAVE;
</pre>
<p>After you have performed this procedure, the slave should connect to the master and catch up on any updates that have occurred since the snapshot was taken.</p>
<p>There are more replication startup options and variables, check the manual for details.</p>
<p><strong>VII. Checking Replication Status</strong></p>
<p>
It&#8217;s required that you ensure that replication is taking place and that there have been no errors between the slave and the master. One command for this is SHOW SLAVE STATUS which you must execute on each slave:</p>
<pre>
mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
                  Slave_IO_State: Waiting for master to send event
                      Master_Host: 192.168.0.16
                     Master_User: replic
                      Master_Port: 3306
                  Connect_Retry: 60
                 Master_Log_File: mysql-bin.000024
         Read_Master_Log_Pos: 4279
                   Relay_Log_File: slave1-relay-bin.000056
                   Relay_Log_Pos: 950
         Relay_Master_Log_File: mysql-bin.000024
               Slave_IO_Running: Yes
             Slave_SQL_Running: Yes
                 Replicate_Do_DB:
            Replicate_Ignore_DB:
             Replicate_Do_Table:
       Replicate_Ignore_Table:
     Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
                           Last_Errno: 0
                            Last_Error:
                       Skip_Counter: 0
           Exec_Master_Log_Pos: 4279
                 Relay_Log_Space: 4418
                     Until_Condition: None
                      Until_Log_File:
                      Until_Log_Pos: 0
            Master_SSL_Allowed: No
            Master_SSL_CA_File:
           Master_SSL_CA_Path:
                 Master_SSL_Cert:
              Master_SSL_Cipher:
                  Master_SSL_Key:
       Seconds_Behind_Master: 0
1 row in set (0.01 sec)
</pre>
<p>The key fields from the status report to examine are:</p>
<blockquote><p>Slave_IO_State &#8212; indicates the current status of the slave.<br />
Slave_IO_Running &#8212; shows whether the IO thread for the reading the master&#8217;s binary log is running.<br />
Slave_SQL_Running &#8212; shows whether the SQL thread for the executing events in the relay log is running.<br />
Last_Error &#8212; shows the last error registered when processing the relay log. Ideally this should be blank, indicating no errors.<br />
Seconds_Behind_Master &#8212; shows the number of seconds that the slave SQL thread is behind processing the master binary log.<br />
    A high number (or an increasing one) can indicate that the slave is unable to cope with the large number of queries from the master.</p></blockquote>
<p>On the master, you can check the status of slaves by examining the list of running processes. Slaves execute the Binlog Dump command:</p>
<pre>
*************************** 1. row ***************************
     Id: 112
   User: syn
   Host: 192.168.0.16:56644
     db: NULL
Command: Binlog Dump
   Time: 71268
  State: Has sent all binlog to slave; waiting for binlog to be updated
   Info: NULL
*************************** 2. row ***************************
     Id: 112935
   User: root
   Host: localhost
     db: NULL
Command: Query
   Time: 0
  State: NULL
   Info: SHOW PROCESSLIST
2 rows in set (0.00 sec)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://dotimes.com/iscale/2007/12/configuration-of-mysql-replication.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>ganglia - a scalable distributed monitoring system</title>
		<link>http://dotimes.com/iscale/2007/12/ganglia-a-scalable-distributed-monitoring-system.html</link>
		<comments>http://dotimes.com/iscale/2007/12/ganglia-a-scalable-distributed-monitoring-system.html#comments</comments>
		<pubDate>Sat, 29 Dec 2007 19:26:40 +0000</pubDate>
		<dc:creator>Cherife Li</dc:creator>
		
		<category><![CDATA[monitoring]]></category>

		<category><![CDATA[ganglia]]></category>

		<guid isPermaLink="false">http://dotimes.com/iscale/2007/12/ganglia-a-scalable-distributed-monitoring-system.html</guid>
		<description><![CDATA[So, what is Ganglia in details?
Quoted from ganglia official site:

Ganglia is a scalable distributed monitoring system for high-performance computing
systems such as clusters and Grids. It is based on a hierarchical design targeted at
federations of clusters. It leverages widely used technologies such as XML for data
representation, XDR for compact, portable data transport, and RRDtool for data
storage [...]]]></description>
			<content:encoded><![CDATA[<p>So, what is Ganglia in details?<br />
Quoted from <a href="http://ganglia.info" onclick="javascript:pageTracker._trackPageview ('/outbound/ganglia.info');">ganglia official site</a>:</p>
<pre>
Ganglia is a scalable distributed monitoring system for high-performance computing
systems such as clusters and Grids. It is based on a hierarchical design targeted at
federations of clusters. It leverages widely used technologies such as XML for data
representation, XDR for compact, portable data transport, and RRDtool for data
storage and visualization. It uses carefully engineered data structures and algorithms
to achieve very low per-node overheads and high concurrency. The implementation
is robust, has been ported to an extensive set of operating systems and processor
architectures, and is currently in use on thousands of clusters around the world. It
has been used to link clusters across university campuses and around the world and
can scale to handle clusters with 2000 nodes.

Ganglia is an open-source project that grew out of the <strong>University of California,
Berkeley</strong> <a href="http://www.millennium.berkeley.edu/" onclick="javascript:pageTracker._trackPageview ('/outbound/www.millennium.berkeley.edu');">Millennium Project</a> which was initially funded in large part by the
<a href="http://www.npaci.edu/" onclick="javascript:pageTracker._trackPageview ('/outbound/www.npaci.edu');">National Partnership for Advanced Computational Infrastructure</a> (NPACI)
and <a href="http://www.nsf.gov/" onclick="javascript:pageTracker._trackPageview ('/outbound/www.nsf.gov');">National Science Foundation</a> RI Award EIA-9802069.
NPACI is funded by the <a href="http://www.nsf.gov/" onclick="javascript:pageTracker._trackPageview ('/outbound/www.nsf.gov');">National Science Foundation</a> and strives to
advance science by creating a ubiquitous, continuous, and pervasive national
computational infrastructure: the Grid. Current support comes from <a href="http://www.planet-lab.org/" onclick="javascript:pageTracker._trackPageview ('/outbound/www.planet-lab.org');">Planet Lab</a>: an
open platform for developing, deploying, and accessing planetary-scale services.
</pre>
<p>The ganglia system is comprised of two unique daemons, a PHP-based web frontend and a few other small utility programs.</p>
<p>
The two unique daemons are Ganglia Monitoring Daemon (gmond) and Ganglia Meta Daemon (gmetad).<br />
<strong>Gmond</strong> is a multi-threaded daemon which runs on each cluster node you want to monitor. It monitors changes in host state, announce relevant changes, listen to the state of all other ganglia nodes via a unicast or multicast channel and answer requests for an XML description of the cluster state.<br />
<strong>Gmetad</strong> periodically polls a collection of child data sources, parses the collected XML, saves all numeric, volatile metrics to round-robin databases and exports the aggregated XML over a TCP sockets to clients. Data sources may be either gmond daemons, representing specific clusters, or other gmetad daemons, representing sets of clusters. Data sources use source IP addresses for access control and can be specified using multiple IP addresses for failover.<br />
Ganglia PHP <strong>Web Frontend</strong> provides a view of the gathered information via real-time dynamic web pages. It depends on the existence of the gmetad which provides it with data from several Ganglia sources. Specifically, the web frontend will open the local port 8651 (by default) and expects to receive a Ganglia XML tree.
</p>
<p>
So, how to get ganglia running for you? The official installation and configuration guide and other information can be found <a href="http://ganglia.sourceforge.net/docs/ganglia.html#installation" onclick="javascript:pageTracker._trackPageview ('/outbound/ganglia.sourceforge.net');">here</a>. I just won&#8217;t give an iterant and gash guide because ganglia is so easy and express to install and configure. From my experience, compared with other monitoring tools&#8217; introductions such as <a href="http://www.nagios.org/" onclick="javascript:pageTracker._trackPageview ('/outbound/www.nagios.org');">Nagios</a>, <a href="http://cacti.net/" onclick="javascript:pageTracker._trackPageview ('/outbound/cacti.net');">Cacti</a>, <a href="http://www.tildeslash.com/monit/" onclick="javascript:pageTracker._trackPageview ('/outbound/www.tildeslash.com');">Monit</a>, <a href="http://pandora.sourceforge.net/" onclick="javascript:pageTracker._trackPageview ('/outbound/pandora.sourceforge.net');">Pandora FMS</a> and so on, I think ganglia is conciser and easier to install and manage.(Honestly speaking, I haven&#8217;t used any one of them.) As you may see that, now or later, more functions which the other monitoring tools supplies may not included in gangila, but you can use your own scripts to achieve a few ones by using ganglia&#8217;s utility programs. <br />
The official site gives some demo, go and check it if you are interested.
</p>
<p>Simplicity is powerful. Lots of famous sites are using it. Yeah, Ganglia is worth a try. Maybe you will love it:-)</p>
]]></content:encoded>
			<wfw:commentRss>http://dotimes.com/iscale/2007/12/ganglia-a-scalable-distributed-monitoring-system.html/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
