<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SpaLinux.com &#187; Benchmark</title>
	<atom:link href="http://spalinux.com/category/benchmark/feed" rel="self" type="application/rss+xml" />
	<link>http://spalinux.com</link>
	<description>Resources for Relaxing Linux System Administrators</description>
	<lastBuildDate>Mon, 26 Jul 2010 09:51:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>เปรียบเทียบ RAID-0 จากคำสั่ง mdadm และ lvm ตอนที่ 3</title>
		<link>http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_3</link>
		<comments>http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_3#comments</comments>
		<pubDate>Sun, 07 Jun 2009 10:12:40 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[Disk]]></category>
		<category><![CDATA[Filesystem]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[RAID]]></category>
		<category><![CDATA[linear]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[stripe]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=774</guid>
		<description><![CDATA[ในตอนสุรปนี้ จะเพิ่มผลลัพธ์จากการรันคำสั่ง sysbench เพื่อทดสอบ fileio ทั้งการอ่านและเขียนไฟล์แบบ sequential, random ก่อนการรัน sysbench เพื่อทดสอบ ต้องสร้างไฟล์ (prepare) ใน mount point ของ filesystem ที่ต้องการทดสอบ เช่นถ้า mount ไว้ที่ /mnt/lv0/ ต้อง cd เข้าไปในพาธนี้แล้วรันคำสั่ง [root@fc10-disk ~]# cd /mnt/lv0/ [root@fc10-disk lv0]# sysbench --test=fileio prepare Sequential Read test (seqrd) รันคำสั่ง [root@fc10-disk ~]# sysbench --test=fileio --file-test-mode=seqrd run Sequential Write test (seqwr) รันคำสั่ง [root@fc10-disk ~]# sysbench --test=fileio [...]]]></description>
			<content:encoded><![CDATA[<p>ในตอนสุรปนี้ จะเพิ่มผลลัพธ์จากการรันคำสั่ง sysbench เพื่อทดสอบ fileio ทั้งการอ่านและเขียนไฟล์แบบ sequential, random</p>
<p><span id="more-774"></span></p>
<p>ก่อนการรัน sysbench เพื่อทดสอบ ต้องสร้างไฟล์ (prepare) ใน mount point ของ filesystem ที่ต้องการทดสอบ เช่นถ้า mount ไว้ที่ /mnt/lv0/ ต้อง cd เข้าไปในพาธนี้แล้วรันคำสั่ง</p>
<pre>[root@fc10-disk ~]# c<strong>d /mnt/lv0/
</strong>[root@fc10-disk lv0]# <strong>sysbench --test=fileio prepare</strong></pre>
<p><strong>Sequential Read test (seqrd) </strong>รันคำสั่ง</p>
<pre>[root@fc10-disk ~]# <strong>sysbench --test=fileio --file-test-mode=seqrd run</strong></pre>
<p><strong>Sequential Write test (seqwr) </strong>รันคำสั่ง</p>
<pre>[root@fc10-disk ~]# <strong>sysbench --test=fileio --file-test-mode=seqwr run</strong></pre>
<p><strong>Random Read test (rndrd)</strong> รันคำสั่ง</p>
<pre>[root@fc10-disk ~]# <strong>sysbench --test=fileio --file-test-mode=rndrd run</strong></pre>
<p><strong>Random Write test (rndwr)</strong> รันคำสั่ง</p>
<pre>[root@fc10-disk ~]# s<strong>ysbench --test=fileio --file-test-mode=rndwr run</strong></pre>
<p>ผลลัพธ์การรันคำสั่ง dd ในตอนที่ผ่านมา จะใกล้เคียงกับการรัน Sequential Write test</p>
<p>ตารางสรุปผลการทดสอบ</p>
<table style="width: 581pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0" width="777">
<colgroup span="1">
<col style="width: 83pt;" span="7" width="111"></col>
</colgroup>
<tbody>
<tr style="height: 16.05pt;" height="21">
<td class="xl24" style="border: 0.5pt none #ece9d8; background-color: #003300; width: 83pt; height: 16.05pt;" width="111" height="21"></td>
<td class="xl25" style="background-color: #003300; width: 83pt; border: 0.5pt 0.5pt 0.5pt medium none #ece9d8;" width="111" align="right"><strong><span style="color: #ffffff; font-size: x-small;">/dev/sdc1</span></strong></td>
<td class="xl25" style="background-color: #003300; width: 83pt; border: 0.5pt 0.5pt 0.5pt medium none #ece9d8;" width="111" align="right"><strong><span style="color: #ffffff; font-size: x-small;">/dev/sdd1</span></strong></td>
<td class="xl25" style="background-color: #003300; width: 83pt; border: 0.5pt 0.5pt 0.5pt medium none #ece9d8;" width="111" align="right"><strong><span style="color: #ffffff; font-size: x-small;">mdadm linear</span></strong></td>
<td class="xl25" style="background-color: #003300; width: 83pt; border: 0.5pt 0.5pt 0.5pt medium none #ece9d8;" width="111" align="right"><strong><span style="color: #ffffff; font-size: x-small;">mdadm stripe</span></strong></td>
<td class="xl25" style="background-color: #003300; width: 83pt; border: 0.5pt 0.5pt 0.5pt medium none #ece9d8;" width="111" align="right"><strong><span style="color: #ffffff; font-size: x-small;">LVM linear</span></strong></td>
<td class="xl25" style="background-color: #003300; width: 83pt; border: 0.5pt 0.5pt 0.5pt medium none #ece9d8;" width="111" align="right"><strong><span style="color: #ffffff; font-size: x-small;">LVM stripe</span></strong></td>
</tr>
<tr style="height: 16.05pt;" height="21">
<td class="xl26" style="background-color: #ccffcc; height: 16.05pt; border: medium 0.5pt 0.5pt none #ece9d8;" height="21"><span style="font-size: x-small;">xfs (blocks)</span></td>
<td class="xl27" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">195,263,012</span></td>
<td class="xl27" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">195,263,012</span></td>
<td class="xl27" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">390,585,600</span></td>
<td class="xl27" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">390,585,344</span></td>
<td class="xl27" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">390,578,176</span></td>
<td class="xl27" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">390,577,152</span></td>
</tr>
<tr style="height: 16.05pt;" height="21">
<td class="xl26" style="background-color: #ccffcc; height: 16.05pt; border: medium 0.5pt 0.5pt none #ece9d8;" height="21"><span style="font-size: x-small;">dd (MB/s)</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">52.00</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">47.10</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">52.70</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">96.50</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">51.80</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">94.80</span></td>
</tr>
<tr style="height: 16.05pt;" height="21">
<td class="xl26" style="background-color: #ccffcc; height: 16.05pt; border: medium 0.5pt 0.5pt none #ece9d8;" height="21"><span style="font-size: x-small;">seqrd (MB/s)</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">58.08</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">60.71</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">57.71</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">115.78</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">58.22</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">104.64</span></td>
</tr>
<tr style="height: 16.05pt;" height="21">
<td class="xl26" style="background-color: #ccffcc; height: 16.05pt; border: medium 0.5pt 0.5pt none #ece9d8;" height="21"><span style="font-size: x-small;">seqrw (MB/s)</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">43.76</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">38.96</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">46.89</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">85.04</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">47.92</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">84.15</span></td>
</tr>
<tr style="height: 16.05pt;" height="21">
<td class="xl26" style="background-color: #ccffcc; height: 16.05pt; border: medium 0.5pt 0.5pt none #ece9d8;" height="21"><span style="font-size: x-small;">rndrd (MB/s)</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">3.92</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">3.96</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">3.92</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">4.34</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">3.97</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">4.31</span></td>
</tr>
<tr style="height: 16.05pt;" height="21">
<td class="xl26" style="background-color: #ccffcc; height: 16.05pt; border: medium 0.5pt 0.5pt none #ece9d8;" height="21"><span style="font-size: x-small;">rndwr (MB/s)</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">0.61</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">0.69</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">2.88</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">2.08</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">2.91</span></td>
<td class="xl28" style="BORDER-BOTTOM: #ece9d8 0.5pt; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: #ccffcc; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8 0.5pt" align="right"><span style="font-size: x-small;">2.08</span></td>
</tr>
</tbody>
</table>
<p>คงไม่สรุปใดๆ ทั้งสิ้น เกี่ยวกับผลลัพธ์ที่ได้ ว่าคอนฟิก mdadm หรือ lvm เร็วกว่ากัน เพราะตัวเลขออกมาใกล้เคียงกัน อีกทั้งการทดสอบนี้ อาจไม่ตรงกับหลักการทางสถิติ เช่น ทดลองรันไม่กี่ครั้ง หรือในขณะที่รันทดสอบอาจมี process อื่นๆ ในเครื่องรันขึ้นมาทำงาน (ทั้งๆ ที่พยายามลดให้เหลือน้อยที่สุดแล้ว) และด้วยคุณสมบัติของ mdadm และ LVM ที่แตกต่างกัน ทางเลือกคงขึ้นอยู่กับลักษณะการใช้งานของแต่ละเครื่องว่าเป็นอย่างไร &#8230;</p>
<p>แต่&#8230;ถ้าให้เลือก ความเห็นส่วนตัว ผมเลือก LVM ครับ <img src='http://spalinux.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_1">เปรียบเทียบ RAID-0 จากคำสั่ง mdadm และ lvm ตอนที่ 1</a></li>
<li><a href="http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_2">เปรียบเทียบ RAID-0 จากคำสั่ง mdadm และ lvm ตอนที่ 2</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_3/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>เปรียบเทียบ RAID-0 จากคำสั่ง mdadm และ lvm ตอนที่ 2</title>
		<link>http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_2</link>
		<comments>http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_2#comments</comments>
		<pubDate>Sun, 07 Jun 2009 08:29:07 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[Disk]]></category>
		<category><![CDATA[Filesystem]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[RAID]]></category>
		<category><![CDATA[linear]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[stripe]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=762</guid>
		<description><![CDATA[ในตอนแรก เปรียบเทียบ RAID-0 จากคำสั่ง mdadm และ lvm ตอนที่ 1 เราได้ทดลองใช้คำสั่ง mdadm เพื่อคอนฟิกดิสก์เป็นแบบ linear และ stripe ซึ่งให้ผลลัพธ์ความเร็วในการเขียนข้อมูลแตกต่างกัน ในตอนนี้จะลองใช้คำสั่ง LVM บ้าง เพื่อสร้างคอนฟิกแบบ linear และ stripe เพื่อเป็นการเปรียบเทียบกัน สร้าง LVM Physical Volume และ Volume Group ก่อนอื่นเราต้องคอนฟิกดิสก์แต่ละพารทิชั่น ทำเป็น Physical Volume และ Volume Group สุดท้ายค่อยเลือกว่าจะสร้าง Logical Volume เป็นแบบ linear หรือ stripe [root@fc10-disk ~]# pvcreate /dev/sdc1 /dev/sdd1   Wiping software RAID md [...]]]></description>
			<content:encoded><![CDATA[<p>ในตอนแรก <a href="http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_1">เปรียบเทียบ RAID-0 จากคำสั่ง mdadm และ lvm ตอนที่ 1</a> เราได้ทดลองใช้คำสั่ง mdadm เพื่อคอนฟิกดิสก์เป็นแบบ linear และ stripe ซึ่งให้ผลลัพธ์ความเร็วในการเขียนข้อมูลแตกต่างกัน ในตอนนี้จะลองใช้คำสั่ง LVM บ้าง เพื่อสร้างคอนฟิกแบบ linear และ stripe เพื่อเป็นการเปรียบเทียบกัน</p>
<p><span id="more-762"></span></p>
<h4>สร้าง LVM Physical Volume และ Volume Group</h4>
<p>ก่อนอื่นเราต้องคอนฟิกดิสก์แต่ละพารทิชั่น ทำเป็น Physical Volume และ Volume Group สุดท้ายค่อยเลือกว่าจะสร้าง Logical Volume เป็นแบบ linear หรือ stripe</p>
<pre>[root@fc10-disk ~]# <strong>pvcreate /dev/sdc1 /dev/sdd1
</strong>  Wiping software RAID md superblock on /dev/sdc1
  Physical volume "/dev/sdc1" successfully created
  Wiping software RAID md superblock on /dev/sdd1
  Physical volume "/dev/sdd1" successfully created</pre>
<p>ตรวจสอบสถานะของ physical volume</p>
<pre>[root@fc10-disk ~]# <strong>pvdisplay
</strong>  "/dev/sdc1" is a new physical volume of "186.31 GB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc1
  VG Name
  PV Size               186.31 GB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               ...</pre>
<pre>  "/dev/sdd1" is a new physical volume of "186.31 GB"
  --- NEW Physical volume ---
  PV Name               /dev/sdd1
  VG Name
  PV Size               186.31 GB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               ...</pre>
<p>คอนฟิกรวมทั้งสอง physical volume สร้างเป็น volume group เดียวกัน</p>
<pre>[root@fc10-disk ~]# <strong>vgcreate VG_1 /dev/sdc1 /dev/sdd1
</strong>  Volume group "VG_1" successfully created</pre>
<p>ตรวจสอบสถานะของ volume group</p>
<pre>[root@fc10-disk ~]# <strong>vgdisplay
</strong>  --- Volume group ---
  VG Name               VG_1
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               372.61 GB
  PE Size               4.00 MB
  Total PE              95388
  Alloc PE / Size       0 / 0
  Free  PE / Size       95388 / 372.61 GB
  VG UUID               ...</pre>
<h4>คำสั่ง lvcreate สร้าง logical volume แบบ linear</h4>
<p>คอนฟิกนี้จะใช้คำสั่ง lvcreate เพื่อสร้างดิสก์สองก้อนเป็นแบบ linear ซึ่งหลักการเขียนข้อมูลจะเหมือนกันคือ ข้อมูลจะถูกเขียนลงบนตัวแรกให้เต็มก่อนแล้วค่อยเขียนตัวถัดไป</p>
<p>การระบุออปชั่น &#8211;extents 100%free คือให้ใช้พื้นที่ทั้งหมดของ volume group สร้างเป็น logical volume</p>
<pre>[root@fc10-disk ~]# <strong>lvcreate --extents 100%free VG_1 --name LV_0
</strong>  Logical volume "LV_0" created</pre>
<p>ผลลัพธ์ที่ได้จะสร้าง logical volume ชื่อ /dev/VG_1/LV_0 ขึ้นมา ซึ่งเรานำมาสร้าง filesystem แล้วมา mount ใช้งานได้</p>
<p>รันคำสั่ง lvdisplay ตรวจสอบสถานะของดิสก์</p>
<pre>[root@fc10-disk ~]# <strong>lvdisplay --maps
</strong>  --- Logical volume ---
  LV Name                <span style="color: #0000ff;">/dev/VG_1/LV_0</span>
  VG Name                VG_1
  LV UUID                eOdh1C-nSw3-wLjd-fuPz-Y6HA-rNvU-nWaOfY
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                372.61 GB
  Current LE             95388
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0</pre>
<pre>  --- Segments ---
  Logical extent 0 to 47693:
    Type                <span style="color: #0000ff;">linear</span>
    Physical volume     <span style="color: #0000ff;">/dev/sdc1
</span>    Physical extents    0 to 47693</pre>
<pre>  Logical extent 47694 to 95387:
    Type                <span style="color: #0000ff;">linear</span>
    Physical volume     <span style="color: #0000ff;">/dev/sdd1
</span>    Physical extents    0 to 47693</pre>
<p>สร้าง filesystem เป็นแบบ xfs และ mount เข้ากับพาธที่สร้าง</p>
<pre>[root@fc10-disk ~]# <strong>mkfs.xfs -f /dev/VG_1/LV_0
</strong>[root@fc10-disk ~]# <strong>mkdir /mnt/lv0
</strong>[root@fc10-disk ~]# <strong>mount /dev/VG_1/LV_0 /mnt/lv0</strong></pre>
<p>ดูขนาดของ filesystem ที่สร้างได้</p>
<pre>[root@fc10-disk ~]# <strong>cd /mnt/lv0/
</strong>[root@fc10-disk lv0]# <strong>df -k .
</strong>Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VG_1-LV_0
                     <span style="color: #0000ff;">390578176</span>      4256 390573920   1% /mnt/lv0</pre>
<p>ทดสอบการเขียนไฟล์ขนาด 2 GB บนคอนฟิก &#8220;linear&#8221;</p>
<pre>[root@fc10-disk lv0]# <strong>dd if=/dev/zero of=file-2g.bin bs=1000000 count=2000
</strong>2000+0 records in
2000+0 records out
2000000000 bytes (2.0 GB) copied, 38.6144 s, <span style="color: #0000ff;">51.8 MB/s</span></pre>
<p>ความเร็วที่ได้จะใกล้เคียงกับการเขียนไฟล์ลงดิสก์ก้อนเดียว</p>
<p>ยกเลิกการ mount ดิสก์ และลบ logical volume แบบ linear</p>
<pre>[root@fc10-disk lv0]# <strong>cd
</strong>[root@fc10-disk ~]# <strong>umount /mnt/lv0
</strong>[root@fc10-disk ~]# <strong>lvremove /dev/VG_1/LV_0
</strong>Do you really want to remove active logical volume "LV_0"? [y/n]: <strong>y</strong>
  Logical volume "LV_0" successfully removed</pre>
<h4>คำสั่ง lvcreate สร้าง logical volume แบบ stripe</h4>
<p>คอนฟิกนี้จะใช้คำสั่ง lvcreate เพื่อสร้าง logical volume เป็นแบบ stripe เพื่อให้เวลาเขียนข้อมูลแยกการเขียนลงดิสก์ทั้งสองก้อนพร้อมๆ กัน ทำให้ความเร็วที่ได้เพิ่มขึ้น</p>
<p>ในที่นี้เราต้องระบุจำนวน stripe หรือจำนวนดิกส์ที่จะเขียนข้อมูลพร้อมๆ กัน ในที่นี้เรามี physical volume อยู่ 2 ก้อน ก็ระบุเป็นตัวเลข 2</p>
<pre>[root@fc10-disk ~]# <strong>lvcreate --extents 100%free <span style="color: #0000ff;">--stripes 2</span> VG_1 --name LV_0
</strong>  Using default stripesize 64.00 KB
  Logical volume "LV_0" created</pre>
<p>ตรวจสอบสถานะของ logical volume แบบ stripe</p>
<pre>[root@fc10-disk ~]# l<strong>vdisplay --maps
</strong>  --- Logical volume ---
  LV Name                <span style="color: #0000ff;">/dev/VG_1/LV_0
</span>  VG Name                VG_1
  LV UUID                JJuw2a-4C6O-4DED-jqCO-qTRF-iDw0-VPeatg
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                372.61 GB
  Current LE             95388
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     512
  Block device           253:0</pre>
<pre>  --- Segments ---
  Logical extent 0 to 95387:
    Type                <span style="color: #0000ff;">striped</span>
    Stripes             <span style="color: #0000ff;">2</span>
    Stripe size         64 KB
    Stripe 0:
      Physical volume   <span style="color: #0000ff;">/dev/sdc1
</span>      Physical extents  0 to 47693
    Stripe 1:
      Physical volume   <span style="color: #0000ff;">/dev/sdd1
</span>      Physical extents  0 to 47693</pre>
<p>สร้าง filesystem เป็นแบบ xfs และ mount เข้ากับพาธที่สร้างไว้</p>
<pre>[root@fc10-disk ~]# <strong>mkfs.xfs -f /dev/VG_1/LV_0
</strong>[root@fc10-disk ~]# <strong>mount /dev/VG_1/LV_0 /mnt/lv0</strong></pre>
<p>ดูขนาดของ filesystem ที่สร้างได้</p>
<pre>[root@fc10-disk ~]# <strong>cd /mnt/lv0/
</strong>[root@fc10-disk lv0]# <strong>df -k .
</strong>Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VG_1-LV_0
                     <span style="color: #0000ff;">390577152</span>      4640 390572512   1% /mnt/lv0</pre>
<p>ทดสอบการเขียนไฟล์ขนาด 2 GB บนคอนฟิก &#8220;linear&#8221;</p>
<pre>[root@fc10-disk lv0]# <strong>dd if=/dev/zero of=file-2g.bin bs=1000000 count=2000
</strong>2000+0 records in
2000+0 records out
2000000000 bytes (2.0 GB) copied, 21.0913 s, <span style="color: #0000ff;">94.8 MB/s</span></pre>
<p>ความเร็วที่ได้ใกล้เคียงกับผลรวมของความเร็วในการเขียนข้อมูลลงดิสก์แต่ละก้อน</p>
<p>ยกเลิกการ mount ดิสก์ และลบ logical volume แบบ &#8220;stripe&#8221;</p>
<pre>[root@fc10-disk lv0]# <strong>cd
</strong>[root@fc10-disk ~]# <strong>umount /mnt/lv0
</strong>[root@fc10-disk ~]# <strong>lvremove /dev/VG_1/LV_0
</strong>Do you really want to remove active logical volume "LV_0"? [y/n]: <strong>y</strong>
  Logical volume "LV_0" successfully removed</pre>
<h4>ลบ LVM Volume Group, Physical Volume</h4>
<p>หลังจากทดสอบเรียบร้อย ถ้าต้องการลบคอนฟิก LVM ออกสามารถทำได้ดังนี้</p>
<p>ใช้คำสั่ง vgremove เพื่อลบ Volume Group</p>
<pre>[root@fc10-disk ~]# <strong>vgremove /dev/VG_1
</strong>  Volume group "VG_1" successfully removed</pre>
<p>ใช้คำสั่ง pvremove เพื่อลบ physical volume</p>
<pre>[root@fc10-disk ~]# <strong>pvremove /dev/sdc1 /dev/sdd1
</strong>  Labels on physical volume "/dev/sdc1" successfully wiped
  Labels on physical volume "/dev/sdd1" successfully wiped</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_1">เปรียบเทียบ RAID-0 จากคำสั่ง mdadm และ lvm ตอนที่ 1</a></li>
<li><a href="http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_3">เปรียบเทียบ RAID-0 จากคำสั่ง mdadm และ lvm ตอนที่ 3<br />
</a></li>
<li><a href="http://spalinux.com/2008/05/use_lvm_to_manage_disk_part1">การใช้งาน LVM เพื่อจัดการพื้นที่ฮาร์ดดิสก์ ตอนที่ 1</a></li>
<li><a href="http://spalinux.com/2008/05/use_lvm_to_manage_disk_part2">การใช้งาน LVM เพื่อจัดการพื้นที่ฮาร์ดดิสก์ ตอนที่ 2</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>เปรียบเทียบ RAID-0 จากคำสั่ง mdadm และ lvm ตอนที่ 1</title>
		<link>http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_1</link>
		<comments>http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_1#comments</comments>
		<pubDate>Sun, 07 Jun 2009 07:08:15 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[Disk]]></category>
		<category><![CDATA[Filesystem]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[RAID]]></category>
		<category><![CDATA[linear]]></category>
		<category><![CDATA[raid-0]]></category>
		<category><![CDATA[stripe]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=755</guid>
		<description><![CDATA[เกิดความสงสัยขึ้นมา ขณะคอนฟิกเซิร์ฟเวอร์ที่มีดิสก์หลายๆ ก้อน เพื่อทำหน้าที่เป็น file server ว่า ระหว่างการใช้ mdadm และ lvm เพื่อรวมดิสก์แต่ละก้อนเข้าด้วยกันทำเป็น RAID-0 อย่างไหนจะเร็วกว่ากัน เลยทดสอบและนำผลลัพธ์แต่ละคอนฟิกมาเปรียบเทียบกัน และเพื่อความครบถ้วนของการเปรียบเทียบ เลยทดสอบคอนฟิกทั้งเป็นแบบ linear และ stripe (RAID-0) จากการใช้คำสั่งทั้งสองด้วย โดยแยกเป็นสองบทความ ในตอนแรกจะใช้คำสั่ง mdadm ก่อน หมายเหตุ โดยทั่วไป คำว่า RAID-0 หมายถึงการคอนฟิกแบบ stripe ข้อควรระวังการเลือกใช้คอนฟิก RAID-0 เพียงอย่างเดียว ถ้าดิสก์ก้อนใดก้อนนึงเสียไป มีโอกาสทำให้ข้อมูลบางส่วนหรือทั้งหมดเสียหายได้ โดยทั่วไปนิยมคอนฟิก RAID-0 ทับไปบนคอนฟิก RAID-1 หรือ RAID-5 เพื่อทำเป็น RAID-10, หรือ RAID-50 ความเสียหายของข้อมูลเมื่อดิสก์ก้อนหนึ่งเสีย ในการคอนฟิกแต่ละแบบจะไม่เหมือนกันเช่น ถ้าคอนฟิกเป็นแบบ &#8220;linear&#8221; การกู้ข้อมูลกลับคืนมาจะมีโอกาสมากกว่า เพราะข้อมูลส่วนใหญ่จะถูกเขียนลงบนดิสก์ก้อนเดียว แต่ข้อเสียของ &#8220;linear&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>เกิดความสงสัยขึ้นมา ขณะคอนฟิกเซิร์ฟเวอร์ที่มีดิสก์หลายๆ ก้อน เพื่อทำหน้าที่เป็น file server ว่า ระหว่างการใช้ mdadm และ lvm เพื่อรวมดิสก์แต่ละก้อนเข้าด้วยกันทำเป็น RAID-0 อย่างไหนจะเร็วกว่ากัน เลยทดสอบและนำผลลัพธ์แต่ละคอนฟิกมาเปรียบเทียบกัน</p>
<p>และเพื่อความครบถ้วนของการเปรียบเทียบ เลยทดสอบคอนฟิกทั้งเป็นแบบ linear และ stripe (RAID-0) จากการใช้คำสั่งทั้งสองด้วย โดยแยกเป็นสองบทความ ในตอนแรกจะใช้คำสั่ง mdadm ก่อน</p>
<p><span id="more-755"></span></p>
<p>หมายเหตุ</p>
<ul>
<li>โดยทั่วไป คำว่า RAID-0 หมายถึงการคอนฟิกแบบ stripe</li>
<li><span style="color: #ff0000;">ข้อควรระวังการเลือกใช้คอนฟิก RAID-0 เพียงอย่างเดียว ถ้าดิสก์ก้อนใดก้อนนึงเสียไป มีโอกาสทำให้ข้อมูลบางส่วนหรือทั้งหมดเสียหายได้</span> โดยทั่วไปนิยมคอนฟิก RAID-0 ทับไปบนคอนฟิก RAID-1 หรือ RAID-5 เพื่อทำเป็น RAID-10, หรือ RAID-50</li>
<li>ความเสียหายของข้อมูลเมื่อดิสก์ก้อนหนึ่งเสีย ในการคอนฟิกแต่ละแบบจะไม่เหมือนกันเช่น ถ้าคอนฟิกเป็นแบบ &#8220;linear&#8221; การกู้ข้อมูลกลับคืนมาจะมีโอกาสมากกว่า เพราะข้อมูลส่วนใหญ่จะถูกเขียนลงบนดิสก์ก้อนเดียว แต่ข้อเสียของ &#8220;linear&#8221; คือความเร็วในการเขียนข้อมูลจะน้อยกว่าแบบ &#8220;stripe&#8221;</li>
</ul>
<h4>ทดสอบดิสก์แต่ละก้อน</h4>
<p>ก่อนจะเริ่มคอนฟิก RAID-0 ขอเริ่มทดสอบดิสก์ทีละตัว เพื่อดูความเร็วคร่าวๆ ในการเขียนข้อมูล</p>
<p>ตัวอย่างการสร้างพาร์ทิชั่นของดิสก์แต่ละก้อน</p>
<pre>[root@fc10-disk ~]# <strong>fdisk -l /dev/sdc
</strong>...
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       24321   195358401   83  Linux</pre>
<pre>[root@fc10-disk ~]# <strong>fdisk -l /dev/sdd
</strong>...
   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       24321   195358401   83  Linux</pre>
<p>สร้าง filesystem เป็นแบบ xfs ในแต่ละพาร์ทิชั่น และ mount เข้ากับพาธที่สร้าง</p>
<pre>[root@fc10-disk ~]# <strong>mkfs.xfs -f /dev/sdc1
</strong>[root@fc10-disk ~]# <strong>mkfs.xfs -f /dev/sdd1</strong></pre>
<pre>[root@fc10-disk ~]# <strong>mkdir /mnt/sdc1
</strong>[root@fc10-disk ~]# <strong>mkdir /mnt/sdd1
</strong>[root@fc10-disk ~]# <strong>mount /dev/sdc1 /mnt/sdc1
</strong>[root@fc10-disk ~]# <strong>mount /dev/sdd1 /mnt/sdd1</strong></pre>
<p>ทดสอบการเขียนไฟล์ขนาด 2 GB ในแต่ละพาร์ทิชั่น</p>
<pre>[root@fc10-disk sdc1]# <strong>cd /mnt/sdc1/
</strong>[root@fc10-disk sdc1]# <strong>dd if=/dev/zero of=file-2g.bin bs=1000000 count=2000
</strong>2000+0 records in
2000+0 records out
2000000000 bytes (2.0 GB) copied, 38.4796 s, <span style="color: #0000ff;">52.0 MB/s</span></pre>
<pre>[root@fc10-disk sdd1]# <strong>cd /mnt/sdd1/
</strong>[root@fc10-disk sdd1]# <strong>dd if=/dev/zero of=file-2g.bin bs=1000000 count=2000
</strong>2000+0 records in
2000+0 records out
2000000000 bytes (2.0 GB) copied, 42.4467 s, <span style="color: #0000ff;">47.1 MB/s</span></pre>
<p>ได้ความเร็วประมาณ 50 MB/s</p>
<p>ยกเลิกการ mount ดิสก์แต่ละก้อน</p>
<pre>[root@fc10-disk sdd1]# <strong>cd</strong>
[root@fc10-disk ~]# <strong>umount /mnt/sdc1
</strong>[root@fc10-disk ~]# <strong>umount /mnt/sdd1</strong></pre>
<h4>คำสั่ง mdadm สร้างดิสก์แบบ linear</h4>
<p>คอนฟิกแรกจะใช้คำสั่ง mdadm เพื่อสร้างดิสก์เป็นแบบ &#8220;linear&#8221; ซึ่งเป็นการนำพื้นที่ดิสก์ทั้งสองก้อนมาต่อเรียงกัน เวลาเขียนข้อมูลจะเขียนบนดิสก์ตัวเดียวก่อน ถ้าก้อนแรกเต็มถึงจะเขียนดิสก์อีกก้อน</p>
<pre>[root@fc10-disk ~]# <strong>mdadm --create --verbose /dev/md0 <span style="color: #0000ff;">--level=linear </span>--raid-devices=2 /dev/sdc1 /dev/sdd1
</strong>mdadm: chunk size defaults to 64K
mdadm: array /dev/md0 started.</pre>
<p>ตรวจสอบสถานะของดิสก์</p>
<pre>[root@fc10-disk ~]#<strong> mdadm --detail /dev/md0
</strong><span style="color: #0000ff;">/dev/md0</span>:
        Version : 0.90
  Creation Time : Sun Jun  7 12:35:05 2009
<span style="color: #0000ff;">     Raid Level : linear
</span>     Array Size : 390716672 (372.62 GiB 400.09 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 0
    Persistence : Superblock is persistent</pre>
<pre>    Update Time : Sun Jun  7 12:35:05 2009
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0</pre>
<pre>       Rounding : 64K</pre>
<pre>           UUID : 450c959b:c5d34b87:792b422a:65152846
         Events : 0.1</pre>
<pre>    Number   Major   Minor   RaidDevice State
<span style="color: #0000ff;">       0       8       33        0      active sync   /dev/sdc1
       1       8       49        1      active sync   /dev/sdd1
</span></pre>
<p>สร้าง filesystem เป็นแบบ xfs และ mount เข้ากับพาธที่สร้าง</p>
<pre>[root@fc10-disk ~]# <strong>mkfs.xfs -f /dev/md0
</strong>[root@fc10-disk ~]# <strong>mkdir /mnt/md0
</strong>[root@fc10-disk ~]# <strong>mount /dev/md0 /mnt/md0/</strong></pre>
<pre>ดูขนาด filesystem ที่สร้างได้</pre>
<pre>[root@fc10-disk ~]# <strong>cd /mnt/md0/
</strong>[root@fc10-disk md0]# <strong>df -k .
</strong>Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md0             <span style="color: #0000ff;">390585600</span>      4256 390581344   1% /mnt/md0</pre>
<p>ทดสอบการเขียนไฟล์ขนาด 2 GB บนคอนฟิก &#8220;linear&#8221;</p>
<pre>[root@fc10-disk md0]# <strong>dd if=/dev/zero of=file-2g.bin bs=1000000 count=2000
</strong>2000+0 records in
2000+0 records out
2000000000 bytes (2.0 GB) copied, 37.9349 s, <span style="color: #0000ff;">52.7 MB/s</span></pre>
<p>ความเร็วที่ได้จะใกล้เคียงกับการเขียนไฟล์ลงดิสก์ก้อนเดียว</p>
<p>ยกเลิกการ mount ดิสก์ และปิด (stop) การใช้ดิสก์แบบ linear</p>
<pre>[root@fc10-disk md0]# <strong>cd</strong>
[root@fc10-disk ~]# <strong>umount /mnt/md0
</strong>[root@fc10-disk ~]# <strong>mdadm --stop /dev/md0
</strong>mdadm: stopped /dev/md0
[root@fc10-disk ~]# <strong>cat /proc/mdstat
</strong>Personalities : [linear]
unused devices: &lt;none&gt;</pre>
<h4>คำสั่ง mdadm สร้างดิสก์แบบ  stripe (RAID-0)</h4>
<p>คอนฟิกที่สอง จะใช้คำสั่ง mdadm เพื่อคอนฟิกดิกส์สองกันเป็นแบบ stripe หรือ RAID-0 เวลาเขียนข้อมูลจะเขียนลงบนดิสก์ทั้งสองก้อนพร้อมกัน ทำให้ความเร็วเพิ่มขึ้น</p>
<p>หมายเหตุ การระบุออปชั่น &#8220;&#8211;level&#8221; เป็นแบบ &#8220;stripe&#8221; หรือ &#8220;raid-0&#8243;  ให้ผลเหมือนกัน</p>
<pre>[root@fc10-disk ~]# <strong>mdadm --create --verbose /dev/md0 <span style="color: #0000ff;">--level=stripe</span> --raid-devices=2 /dev/sdc1 /dev/sdd1
</strong>mdadm: chunk size defaults to 64K
mdadm: /dev/sdc1 appears to be part of a raid array:
    level=linear devices=2 ctime=Sun Jun  7 13:28:06 2009
mdadm: /dev/sdd1 appears to be part of a raid array:
    level=linear devices=2 ctime=Sun Jun  7 13:28:06 2009
Continue creating array? <strong>y</strong>
mdadm: array /dev/md0 started.</pre>
<p>ตรวจสอบสถานะของดิสก์</p>
<pre>[root@fc10-disk ~]# <strong>mdadm --detail /dev/md0</strong>
<span style="color: #0000ff;">/dev/md0</span>:
        Version : 0.90
  Creation Time : Sun Jun  7 13:40:02 2009
<span style="color: #0000ff;">     Raid Level : raid0
</span>     Array Size : 390716672 (372.62 GiB 400.09 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 0
    Persistence : Superblock is persistent</pre>
<pre>    Update Time : Sun Jun  7 13:40:02 2009
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0</pre>
<pre>     Chunk Size : 64K</pre>
<pre>           UUID : 1ee50769:2becc762:fb9a3596:c284b115
         Events : 0.1</pre>
<pre>    Number   Major   Minor   RaidDevice State
<span style="color: #0000ff;">       0       8       33        0      active sync   /dev/sdc1
       1       8       49        1      active sync   /dev/sdd1
</span></pre>
<p>สร้าง filesystem เป็นแบบ xfs และ mount เข้ากับพาธที่สร้างไว้</p>
<pre>[root@fc10-disk ~]# <strong>mkfs.xfs -f /dev/md0
</strong>[root@fc10-disk ~]# <strong>mount /dev/md0 /mnt/md0/</strong></pre>
<pre>ดูขนาด filesystem ที่สร้างได้</pre>
<pre>[root@fc10-disk ~]# <strong>cd /mnt/md0/
</strong>[root@fc10-disk md0]# <strong>df -k .
</strong>Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md0             <span style="color: #0000ff;">390585344</span>      4640 390580704   1% /mnt/md0</pre>
<p>ทดสอบความเร็วการเขียนข้อมูลบนดิสก์ RAID-0</p>
<pre>[root@fc10-disk md0]# <strong>dd if=/dev/zero of=file-2g.bin bs=1000000 count=2000
</strong>2000+0 records in
2000+0 records out
2000000000 bytes (2.0 GB) copied, 20.7292 s, <span style="color: #0000ff;">96.5 MB/s</span></pre>
<p>ความเร็วที่ได้ใกล้เคียงกับผลรวมของความเร็วในการเขียนข้อมูลลงดิสก์แต่ละก้อน</p>
<p>ยกเลิกการ mount ดิสก์ และปิด (stop) การใช้ดิสก์แบบ &#8220;stripe&#8221;</p>
<pre>[root@fc10-disk md0]# <strong>cd
</strong>[root@fc10-disk ~]# <strong>umount /mnt/md0
</strong>[root@fc10-disk ~]# <strong>mdadm --stop /dev/md0
</strong>mdadm: stopped /dev/md0
[root@fc10-disk ~]# <strong>cat /proc/mdstat
</strong>Personalities : [linear] [raid0]
unused devices: &lt;none&gt;</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_2">เปรียบเทียบ RAID-0 จากคำสั่ง mdadm และ lvm ตอนที่ 2</a></li>
<li><a href="http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_3">เปรียบเทียบ RAID-0 จากคำสั่ง mdadm และ lvm ตอนที่ 3<br />
</a></li>
<li><a href="http://spalinux.com/2008/08/creating_software_raid_on_linux">การสร้าง Software RAID บนลินุกซ์</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/06/compare_raid-0_between_mdadm_and_lvm_part_1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>คอมไพล์ sysbench บน Solaris 10 (x86)</title>
		<link>http://spalinux.com/2009/05/compile_sysbench_on_solaris_10_x86</link>
		<comments>http://spalinux.com/2009/05/compile_sysbench_on_solaris_10_x86#comments</comments>
		<pubDate>Sat, 23 May 2009 16:40:34 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[solaris 10 benchmark]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=696</guid>
		<description><![CDATA[บทความนี้ขอแสดงวิธีการคอมไพล์โปรแกรม sysbench บน Solaris 10 (x86) เพื่อใช้วัดประสิทธิภาพเปรียบเทียบกับ Fedora 10 ในที่นี้ขอใช้แค่เวอร์ชั่น 0.4.10 และเลือกไม่คอมไพล์รวม mysql เพื่อความง่ายในการคอมไพล์และทดสอบ เพราะการที่จะคอมไพล์ sysbench เวอร์ชั่นใหม่กว่านี้ จะติดปัญหาหลายๆ อย่าง เช่นดาวน์โหลดโปรแกรม library มาติดตั้งเพิ่มเติม เพื่อแก้ไขปัญหา libtool ที่มีการเปลี่ยนแปลงได้ อย่างไรก็ตามเรายังสามารถนำผลที่ได้มาเปรียบเทียบแบบคร่าวๆ เพราะวิธีการ benchmark ยังคงเป็นรูปแบบเดียวกัน ดาวน์โหลดไฟล์ เลือกดาวน์โหลดเวอร์ชั่น 0.4.10 จากเว็บไซต์ Download sysbench &#8211; SourceForge.net: System performance benchmark: Files แตกไฟล์ (extract) ใน /usr/local/src/ โปรแกรมที่นำมาคอมไพล์และติดตั้งเอง แนะนำให้ไว้ใน /usr/local/ เพราะเวลาปรับปรุง หรือติดตั้งใหม่ จะได้สะดวกต่อการอ้างอิงและค้นหา ในที่นี้จะไว้ใน  /usr/local/src/ เพื่อเก็บ source [...]]]></description>
			<content:encoded><![CDATA[<p>บทความนี้ขอแสดงวิธีการคอมไพล์โปรแกรม sysbench บน Solaris 10 (x86) เพื่อใช้วัดประสิทธิภาพเปรียบเทียบกับ Fedora 10</p>
<p>ในที่นี้ขอใช้แค่เวอร์ชั่น 0.4.10 และเลือกไม่คอมไพล์รวม mysql เพื่อความง่ายในการคอมไพล์และทดสอบ เพราะการที่จะคอมไพล์ sysbench เวอร์ชั่นใหม่กว่านี้ จะติดปัญหาหลายๆ อย่าง เช่นดาวน์โหลดโปรแกรม library มาติดตั้งเพิ่มเติม เพื่อแก้ไขปัญหา libtool ที่มีการเปลี่ยนแปลงได้ อย่างไรก็ตามเรายังสามารถนำผลที่ได้มาเปรียบเทียบแบบคร่าวๆ เพราะวิธีการ benchmark ยังคงเป็นรูปแบบเดียวกัน</p>
<h4>ดาวน์โหลดไฟล์</h4>
<p><span id="more-696"></span></p>
<p>เลือกดาวน์โหลดเวอร์ชั่น 0.4.10 จากเว็บไซต์<a href="http://sourceforge.net/project/showfiles.php?group_id=102348&amp;package_id=109810" target="_blank"> Download sysbench &#8211; SourceForge.net: System performance benchmark: Files</a></p>
<h4>แตกไฟล์ (extract) ใน /usr/local/src/</h4>
<p>โปรแกรมที่นำมาคอมไพล์และติดตั้งเอง แนะนำให้ไว้ใน /usr/local/ เพราะเวลาปรับปรุง หรือติดตั้งใหม่ จะได้สะดวกต่อการอ้างอิงและค้นหา ในที่นี้จะไว้ใน  /usr/local/src/ เพื่อเก็บ source file และไฟล์ที่ใช้ระหว่างการคอมไพล์โปรแกรม</p>
<pre># <strong>mkdir -p /usr/local/src</strong>
# <strong>cd /usr/local/src/</strong>
# <strong>ls -l</strong>
total 928
-rw-r--r--   1 user1    other     463936 May 23 22:11 sysbench-0.4.10.tar.gz</pre>
<p>ใช้คำสั่ง gzip และ tar เพื่อแตกไฟล์</p>
<pre># <strong>gzip -dv sysbench-0.4.10.tar.gz</strong>
sysbench-0.4.10.tar.gz:  78.9% -- replaced with sysbench-0.4.10.tar</pre>
<pre># <strong>tar xvf sysbench-0.4.10.tar</strong>
x sysbench-0.4.10, 0 bytes, 0 tape blocks
x sysbench-0.4.10/doc, 0 bytes, 0 tape blocks
x sysbench-0.4.10/doc/manual.html, 0 bytes, 0 tape blocks
x sysbench-0.4.10/doc/manual.xml, 36255 bytes, 71 tape blocks
x sysbench-0.4.10/doc/Makefile.am, 672 bytes, 2 tape blocks
x sysbench-0.4.10/doc/xsl, 0 bytes, 0 tape blocks
x sysbench-0.4.10/doc/xsl/xhtml.xsl, 486 bytes, 1 tape blocks
x sysbench-0.4.10/doc/xsl/catalog.xml.in, 729 bytes, 2 tape blocks
x sysbench-0.4.10/doc/xsl/xhtml-chunk.xsl, 1815 bytes, 4 tape blocks
...
...
...
x sysbench-0.4.10/sysbench/Makefile.in, 21292 bytes, 42 tape blocks
x sysbench-0.4.10/COPYING, 17992 bytes, 36 tape blocks
x sysbench-0.4.10/install-sh, 7122 bytes, 14 tape blocks
x sysbench-0.4.10/configure, 818532 bytes, 1599 tape blocks
x sysbench-0.4.10/Makefile.am, 800 bytes, 2 tape blocks
x sysbench-0.4.10/configure.ac, 5477 bytes, 11 tape blocks
x sysbench-0.4.10/INSTALL, 9240 bytes, 19 tape blocks
x sysbench-0.4.10/Makefile.in, 21039 bytes, 42 tape blocks
x sysbench-0.4.10/ChangeLog, 9329 bytes, 19 tape blocks
x sysbench-0.4.10/acinclude.m4, 16599 bytes, 33 tape blocks</pre>
<p>ใช้คำสั่ง cd เข้าไปในไดเร็คทอรี ใช้คำสั่ง ls เพื่อดูไฟล์</p>
<pre># <strong>cd sysbench-0.4.10</strong>
# <strong>ls</strong>
COPYING        Makefile.am    TODO           autogen.sh     configure.ac   missing
ChangeLog      Makefile.in    acinclude.m4   config         doc            mkinstalldirs
INSTALL        README         aclocal.m4     configure      install-sh     sysbench</pre>
<h4>รัน ./configure</h4>
<p>แล้วรัน ./configure (ไม่เลือกคอมไพล์ mysql) เพื่อตรวจสอบไฟล์ต่างๆ ที่จำเป็นในการคอนไพล์โปรแกรม และสร้าง Makefile สำหรับคอมไพล์โปรแกรม</p>
<pre># <strong>./configure --without-mysql</strong>
checking build system type... i386-pc-solaris2.10
checking host system type... i386-pc-solaris2.10
checking target system type... i386-pc-solaris2.10
checking for a BSD-compatible install... config/install-sh -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking whether make sets $(MAKE)... no
checking whether to compile with MySQL support... (cached) no
checking whether to compile with Oracle support... (cached) no
checking whether to compile with PostgreSQL support... (cached) no
checking for style of include used by make... none
checking for gcc... no
checking for cc... no
checking for cl.exe... no
<span style="color: #ff0000;">configure: error: no acceptable C compiler found in $PATH
</span>See `config.log' for more details.
#</pre>
<p>มี error เกิดขึ้น เหตุเพราะ ./configure ไม่สามารถหา gcc compiler ใน PATH ได้</p>
<p>ตรวจสอบ PATH ที่ใช้อยู่</p>
<pre># <strong>echo $PATH</strong>
/usr/sbin:/usr/bin</pre>
<p>จากการติดตั้ง Solaris 10 จะมี gcc compiler มาให้อยู่แล้วแต่อยู่ใน /usr/sfw/bin เราจำเป็นต้องเพิ่ม PATH นี้เข้าไป</p>
<p>วิธีการเพิ่ม /usr/sfw/bin เข้าไปใน PATH</p>
<pre># <strong>PATH=$PATH<span style="color: #0000ff;">:/usr/sfw/bin</span></strong>
# <strong>echo $PATH</strong>
/usr/sbin:/usr/bin:/usr/sfw/bin</pre>
<p>หมายเหตุ โปรดสังเกตการใช้เครื่องหมาย $ ในการกำหนดค่าตัวแปร</p>
<p>รัน ./configure อีกครั้ง หลังจากเพิ่ม PATH /usr/sfw/bin</p>
<pre># <strong>./configure --without-mysql
</strong>checking build system type... i386-pc-solaris2.10
checking host system type... i386-pc-solaris2.10
checking target system type... i386-pc-solaris2.10
checking for a BSD-compatible install... config/install-sh -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking whether make sets $(MAKE)... no
checking whether to compile with MySQL support... (cached) no
checking whether to compile with Oracle support... (cached) no
checking whether to compile with PostgreSQL support... (cached) no
checking for style of include used by make... none
checking for gcc... gcc
...
...
...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/xsl/Makefile
config.status: creating doc/xsl/catalog.xml
config.status: creating doc/Makefile
config.status: creating sysbench/Makefile
config.status: creating sysbench/drivers/Makefile
config.status: creating sysbench/drivers/mysql/Makefile
config.status: creating sysbench/drivers/oracle/Makefile
config.status: creating sysbench/drivers/pgsql/Makefile
config.status: creating sysbench/tests/Makefile
config.status: creating sysbench/tests/cpu/Makefile
config.status: creating sysbench/tests/fileio/Makefile
config.status: creating sysbench/tests/memory/Makefile
config.status: creating sysbench/tests/threads/Makefile
config.status: creating sysbench/tests/mutex/Makefile
config.status: creating sysbench/tests/oltp/Makefile
config.status: creating config/config.h
config.status: executing depfiles commands</pre>
<p>ไม่มี error จากการรัน ./configure</p>
<h4>รัน make</h4>
<p>รัน make เพื่อเริ่มคอมไฟล์โปรแกรม</p>
<pre># <strong>make</strong>
<span style="color: #ff0000;">make: not found</span></pre>
<p>ไม่สามารถรัน make ได้ เพราะหาคำสั่ง make ไม่พบ &#8220;make: not found&#8221;</p>
<p>เหตุเพราะคำสั่ง make อยู่ในอีก PATH คือ /usr/ccs/bin ต้องเพิ่มเข้าไปใน PATH อีก</p>
<pre># <strong>echo $PATH
</strong>/usr/sbin:/usr/bin:/usr/sfw/bin</pre>
<pre># <strong>PATH=$PATH<span style="color: #0000ff;">:/usr/ccs/bin
</span></strong># <strong>echo $PATH
</strong>/usr/sbin:/usr/bin:/usr/sfw/bin:/usr/ccs/bin</pre>
<p>รัน make อีกครั้ง</p>
<pre># <strong>make</strong>
Making all in doc
Making all in xsl
Making all in sysbench
Making all in drivers
Making all in tests
Making all in cpu
source='sb_cpu.c' object='libsbcpu_a-sb_cpu.o' libtool=no \
DEPDIR=.deps depmode=none /bin/bash ../../../config/depcomp \
gcc -DHAVE_CONFIG_H -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -D_REENTRANT -g -O2 -c -o libsbcpu_a-sb_cpu.o `test -f 'sb_cpu.c' || echo './'`sb_cpu.c
rm -f libsbcpu.a
false cru libsbcpu.a libsbcpu_a-sb_cpu.o
<span style="color: #ff0000;">*** Error code 255
</span>make: Fatal error: Command failed for target `libsbcpu.a'
Current working directory /usr/local/src/sysbench-0.4.10/sysbench/tests/cpu
<span style="color: #ff0000;">*** Error code 1
</span>The following command caused the error:
failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
case $f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='cpu fileio memory threads mutex oltp'; for subdir in $list; do \
echo "Making $target in $subdir"; \
if test "$subdir" = "."; then \
dot_seen=yes; \
local_target="$target-am"; \
else \
local_target="$target"; \
fi; \
(cd $subdir &amp;&amp; make  $local_target) \
|| eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
make  "$target-am" || exit 1; \
fi; test -z "$fail"
<span style="color: #ff0000;">make: Fatal error: Command failed for target `all-recursive'
</span>Current working directory /usr/local/src/sysbench-0.4.10/sysbench/tests
<span style="color: #ff0000;">*** Error code 1</span>
The following command caused the error:
failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
case $f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='drivers tests .'; for subdir in $list; do \
echo "Making $target in $subdir"; \
if test "$subdir" = "."; then \
dot_seen=yes; \
local_target="$target-am"; \
else \
local_target="$target"; \
fi; \
(cd $subdir &amp;&amp; make  $local_target) \
|| eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
make  "$target-am" || exit 1; \
fi; test -z "$fail"
make: Fatal error: Command failed for target `all-recursive'
Current working directory /usr/local/src/sysbench-0.4.10/sysbench
<span style="color: #ff0000;">*** Error code 1</span>
The following command caused the error:
failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
case $f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='doc sysbench'; for subdir in $list; do \
echo "Making $target in $subdir"; \
if test "$subdir" = "."; then \
dot_seen=yes; \
local_target="$target-am"; \
else \
local_target="$target"; \
fi; \
(cd $subdir &amp;&amp; make  $local_target) \
|| eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
make  "$target-am" || exit 1; \
fi; test -z "$fail"
<span style="color: #ff0000;">make: Fatal error: Command failed for target `all-recursive'</span></pre>
<p>การรัน make ยังมี error อยู่หลายจุด แปลว่า คอมไพล์โปรแกรมไม่สำเร็จ</p>
<p>ลองรัน ./configure ใหม่อีกครั้ง แล้วค่อยรัน make</p>
<pre># <strong>./configure --without-mysql
</strong>checking build system type... i386-pc-solaris2.10
checking host system type... i386-pc-solaris2.10
checking target system type... i386-pc-solaris2.10
checking for a BSD-compatible install... config/install-sh -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking whether make sets $(MAKE)... yes
checking whether to compile with MySQL support... (cached) no
checking whether to compile with Oracle support... (cached) no
checking whether to compile with PostgreSQL support... (cached) no
checking for style of include used by make... GNU
checking for gcc... gcc
...
...
...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/xsl/Makefile
config.status: creating doc/xsl/catalog.xml
config.status: creating doc/Makefile
config.status: creating sysbench/Makefile
config.status: creating sysbench/drivers/Makefile
config.status: creating sysbench/drivers/mysql/Makefile
config.status: creating sysbench/drivers/oracle/Makefile
config.status: creating sysbench/drivers/pgsql/Makefile
config.status: creating sysbench/tests/Makefile
config.status: creating sysbench/tests/cpu/Makefile
config.status: creating sysbench/tests/fileio/Makefile
config.status: creating sysbench/tests/memory/Makefile
config.status: creating sysbench/tests/threads/Makefile
config.status: creating sysbench/tests/mutex/Makefile
config.status: creating sysbench/tests/oltp/Makefile
config.status: creating config/config.h
config.status: executing depfiles commands</pre>
<pre># <strong>make</strong>
Making all in doc
Making all in xsl
Making all in sysbench
Making all in drivers
Making all in tests
Making all in cpu
gcc -DHAVE_CONFIG_H -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -D_REENTRANT -g -O2 -MT libsbcpu_a-sb_cpu.o -MD -MP -MF .deps/libsbcpu_a-sb_cpu.Tpo -c -o libsbcpu_a-sb_cpu.o `test -f 'sb_cpu.c' || echo './'`sb_cpu.c
mv -f .deps/libsbcpu_a-sb_cpu.Tpo .deps/libsbcpu_a-sb_cpu.Po
rm -f libsbcpu.a
ar cru libsbcpu.a libsbcpu_a-sb_cpu.o
ranlib libsbcpu.a
Making all in fileio
...
...
...
gcc -DHAVE_CONFIG_H -I. -I../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench   -D_REENTRANT -g -O2 -MT sb_logger.o -MD -MP -MF .deps/sb_logger.Tpo -c -o sb_logger.o sb_logger.c
mv -f .deps/sb_logger.Tpo .deps/sb_logger.Po
gcc -DHAVE_CONFIG_H -I. -I../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench   -D_REENTRANT -g -O2 -MT db_driver.o -MD -MP -MF .deps/db_driver.Tpo -c -o db_driver.o db_driver.c
mv -f .deps/db_driver.Tpo .deps/db_driver.Po
/bin/bash ../libtool --tag=CC    --mode=link gcc -D_REENTRANT -g -O2 -lumem      -o sysbench sysbench.o sb_timer.o  sb_options.o sb_logger.o db_driver.o tests/fileio/libsbfileio.a tests/threads/libsbthreads.a  tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a  tests/mutex/libsbmutex.a    -lrt -lm
mkdir .libs
gcc -D_REENTRANT -g -O2 -o sysbench sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o  -lumem tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a -lrt -lm</pre>
<p>เรียบร้อย รัน make แล้วไม่มี error</p>
<h4>รัน make install</h4>
<p>ถ้ารัน make แล้ว ไม่มีข้อความ error แสดงว่าโปรแกรมคอมไพล์สำเร็จ สามารถใช้คำสั่ง make install เพื่อติดตั้งไฟล์ได้ โดยดีฟอลต์ โปรแกรมที่คอมไฟล์เองจะติดตั้งไฟล์ไว้ใน /usr/local/</p>
<pre># <strong>make install
</strong>Making install in doc
Making install in xsl
test -z "/usr/local/share/doc/sysbench" || ../config/install-sh -c -d "/usr/local/share/doc/sysbench"
../config/install-sh -c -m 644 'manual.html' '/usr/local/share/doc/sysbench/manual.html'
Making install in sysbench
Making install in drivers
Making install in tests
Making install in cpu
Making install in fileio
Making install in memory
Making install in threads
Making install in mutex
Making install in oltp
Making install in .
test -z "/usr/local/bin" || ../config/install-sh -c -d "/usr/local/bin"
/bin/bash ../libtool --mode=install ../config/install-sh -c 'sysbench' '/usr/local/bin/sysbench'
../config/install-sh -c sysbench /usr/local/bin/sysbench</pre>
<pre># <strong>ls -l /usr/local/bin
</strong>total 400
-rwxr-xr-x   1 root     root      195312 May 23 23:17 sysbench</pre>
<h4>รัน CPU Benchmark</h4>
<p>เพิ่ม PATH /usr/local/bin ไว้สำหรับรันโปรแกรม</p>
<pre># <strong>PATH=$PATH<span style="color: #0000ff;">:/usr/local/bin
</span></strong># <strong>echo $PATH
</strong>/usr/sbin:/usr/bin:/usr/sfw/bin:/usr/ccs/bin:/usr/local/bin</pre>
<p>ทดลองรัน sysbench เพื่อทดสอบ CPU Benchmark บน Solaris</p>
<pre># <strong>sysbench --test=cpu --cpu-max-prime=20000 run
</strong>sysbench 0.4.10:  multi-threaded system evaluation benchmark</pre>
<pre>Running the test with following options:
<span style="color: #0000ff;">Number of threads: 1</span></pre>
<pre><span style="color: #0000ff;">Doing CPU performance benchmark</span></pre>
<pre>Threads started!
Done.</pre>
<pre><span style="color: #0000ff;">Maximum prime number checked in CPU test: 20000</span></pre>
<pre><span style="color: #0000ff;">Test execution summary:
total time:                          44.6483s
</span>total number of events:              10000
total time taken by event execution: 44.6394
per-request statistics:
min:                                  4.26ms
avg:                                  4.46ms
max:                                 12.42ms
approx.  95 percentile:               4.80ms</pre>
<pre>Threads fairness:
events (avg/stddev):           10000.0000/0.00
execution time (avg/stddev):   44.6394/0.00</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2009/05/compile_sysbench_on_fedora_10">คอมไพล์ sysbench บน Fedora 10</a></li>
<li><a href="http://spalinux.com/2009/05/sysbench_cpu_benchmark">sysbench วัดความแรงของ CPU</a></li>
<li><a href="http://sourceforge.net/project/showfiles.php?group_id=102348&amp;package_id=109810" target="_blank">Download sysbench &#8211; SourceForge.net: System performance benchmark: Files</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/05/compile_sysbench_on_solaris_10_x86/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sysbench วัดความแรงของ CPU</title>
		<link>http://spalinux.com/2009/05/sysbench_cpu_benchmark</link>
		<comments>http://spalinux.com/2009/05/sysbench_cpu_benchmark#comments</comments>
		<pubDate>Sat, 16 May 2009 19:01:13 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[cpu benchmark]]></category>
		<category><![CDATA[sysbench]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=666</guid>
		<description><![CDATA[หลังจากที่คอมไพล์และติดตั้งโปรแกรม sysbench (คอมไพล์ sysbench บน Fedora 10) แล้ว ตอนนี้เราจะลองใช้ sysbench เพื่อทดสอบประสิทธิภาพความเร็วของ CPU (CPU Benchmark) วิธีการใช้คำสั่ง sysbench ต้องระบุออปชั่น test ว่าเราจะทดสอบอะไร อาจระบุออปชั่นต่างๆ เพิ่มเติม เป็นค่าตัวแปรผันแปรที่ใช้ในการทดสอบ ค่าเหล่านี้จะมีค่าดีฟอลต์อยู่แล้ว ดูได้จากการรันคำสั่ง sysbench แบบไม่มีออปชั่น หรือดูจากผลลัพธ์ในการัน การทดสอบในบทความนี้ เป็นการทดสอบ (test) CPU ให้คำนวณหาค่าจำนวนเฉพาะ (prime number)  ตั้งแต่ 1 ไปจนถึงตัวเลขมากสุดเท่ากับค่าตัวแปร cpu-max-prime ในที่นี้จะระบุ 20000 แล้วตามด้วยออปชั่น run เพื่อสั่งเริ่มการคำนวณ โดยในแต่การทดสอบจะมีการเปลี่ยนแปลงจำนวน CPU และจำนวน Threads ที่ใช้ (num-threads) ในการคำนวณ เพื่อเปรียบเทียบผลลัพธ์ด้วย คำเตือน!!! ไม่ควรรันโปรแกรม sysbench บนเครื่องที่ใช้งานจริง (production) [...]]]></description>
			<content:encoded><![CDATA[<p>หลังจากที่คอมไพล์และติดตั้งโปรแกรม sysbench (<a href="http://spalinux.com/2009/05/compile_sysbench_on_fedora_10">คอมไพล์ sysbench บน Fedora 10</a>) แล้ว ตอนนี้เราจะลองใช้ sysbench เพื่อทดสอบประสิทธิภาพความเร็วของ CPU (CPU Benchmark)</p>
<p>วิธีการใช้คำสั่ง sysbench ต้องระบุออปชั่น test ว่าเราจะทดสอบอะไร อาจระบุออปชั่นต่างๆ เพิ่มเติม เป็นค่าตัวแปรผันแปรที่ใช้ในการทดสอบ ค่าเหล่านี้จะมีค่าดีฟอลต์อยู่แล้ว ดูได้จากการรันคำสั่ง sysbench แบบไม่มีออปชั่น หรือดูจากผลลัพธ์ในการัน</p>
<p>การทดสอบในบทความนี้ เป็นการทดสอบ (test) CPU ให้คำนวณหาค่าจำนวนเฉพาะ (prime number)  ตั้งแต่ 1 ไปจนถึงตัวเลขมากสุดเท่ากับค่าตัวแปร cpu-max-prime ในที่นี้จะระบุ 20000 แล้วตามด้วยออปชั่น run เพื่อสั่งเริ่มการคำนวณ</p>
<p>โดยในแต่การทดสอบจะมีการเปลี่ยนแปลงจำนวน CPU และจำนวน Threads ที่ใช้ (num-threads) ในการคำนวณ เพื่อเปรียบเทียบผลลัพธ์ด้วย</p>
<p><span id="more-666"></span></p>
<p><span style="color: #ff0000;"><strong>คำเตือน!!!</strong> ไม่ควรรันโปรแกรม sysbench บนเครื่องที่ใช้งานจริง (production) เพราะจะมีผลกระทบกับเครื่องมาก และผลลัพธ์ที่ได้ก็ไม่ใช่ผลลัพธ์ที่ถูกต้อง</span></p>
<p><strong>หมายเหตุ</strong> ตัวอย่างในบทความนี้ ทดสอบใน VMware Server ที่รันบน Windows XP เพื่อจะจำลองจำนวน CPU และการระบุจำนวน threads ที่ใช้</p>
<h4>1. Benchmark  1 CPU &#8211; 1 Thread</h4>
<p>การทดสอบ 1, 2 จะคอนฟิกจำนวน CPU ในคอนฟิก VMware Server เท่ากับ 1</p>
<p><img class="alignnone size-full wp-image-668" title="VMware Settings 1 CPU" src="http://spalinux.com/wp-content/uploads/2009/05/01_vmware_settings_1_cpu.png" alt="VMware Settings 1 CPU" width="617" height="476" /></p>
<p>ตรวจสอบสเปคของ CPU ได้จากไฟล์ /proc/cpuinfo</p>
<pre>[root@fc10-dev ~]# <strong>cat /proc/cpuinfo</strong>
<span style="color: #0000ff;">processor       : 0
</span>vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
<span style="color: #0000ff;">model name      : Intel(R) Core(TM)2 Duo CPU     @ 2.53GHz
</span>stepping        : 8
cpu MHz         : 2526.986
cache size      : 6144 KB
...</pre>
<p>แนะนำให้เปิดสองหน้าจอ หน้าจอหนึ่งรันคำสั่ง top ทิ้งไว้เพื่อแสดงการใช้ CPU ของเครื่อง ระหว่างการรัน sysbench ในอีกหน้าจอ</p>
<p>หมายเหตุ</p>
<ul>
<li>เมื่อรันคำสั่ง top โดยดีฟอลต์จะแสดงค่าการใช้ CPU โดยสุรปรวมทั้งหมด</li>
<li>ถ้าต้องการแสดงค่าการใช้ CPU แยกแต่ละตัว ให้กด 1 ในคำสั่ง top</li>
<li>ถ้าต้องการออกจากคำสั่ง top ให้กดปุ่ม q หรือ [Ctrl-C]</li>
</ul>
<p>รันคำสั่ง sysbench เพื่อเริ่มการทดสอบ 1. Benchmark 1 CPU &#8211; 1 Thread</p>
<pre>[root@fc10-dev ~]# <strong>sysbench --test=cpu --cpu-max-prime=20000 run</strong>
sysbench 0.4.12:  multi-threaded system evaluation benchmark</pre>
<pre>Running the test with following options:
<span style="color: #0000ff;">Number of threads: 1</span></pre>
<pre>Doing CPU performance benchmark</pre>
<pre>Threads started!
Done.</pre>
<pre><span style="color: #0000ff;">Maximum prime number checked in CPU test: 20000
</span><span style="color: #0000ff;">Test execution summary:
    total time:                          25.7770s
</span>    total number of events:              10000
    total time taken by event execution: 25.7745
    per-request statistics:
         min:                                  2.39ms
         avg:                                  2.58ms
         max:                                  6.08ms
         approx.  95 percentile:               2.68ms</pre>
<pre>Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   25.7745/0.00</pre>
<pre>[root@fc10-dev ~]#</pre>
<p>ผลลัพธ์ในการรันทดสอบครั้งที่ 1 เวลาที่ใช้ในการคำนวณค่า &#8220;total time&#8221;</p>
<pre><span style="color: #0000ff;">Test execution summary:
    total time:                          25.7770s</span></pre>
<p>แปลว่าต้องใช้เวลาประมาณ 25 วินาทีกว่าๆ ในการหาจำนวนเฉพาะระหว่าง 1 ถึง 200000</p>
<p>การใช้ CPU จากคำสั่ง top ระหว่างการรันคำสั่ง sysbench ในทดสอบครั้งที่ 1</p>
<pre>[root@fc10-dev ~]# <strong>top
</strong>top - 18:17:57 up 9 min,  2 users,  load average: 0.18, 0.21, 0.11
Tasks:  80 total,   2 running,  78 sleeping,   0 stopped,   0 zombie
<span style="color: #0000ff;">Cpu0  :100.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
</span>Mem:    508292k total,   100896k used,   407396k free,     5180k buffers
Swap:  1068312k total,        0k used,  1068312k free,    37588k cached</pre>
<pre>  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
<span style="color: #0000ff;"> 2053 root      20   0 46936 2080 1532 S 99.9  0.4   0:05.65 sysbench</span>
    1 root      20   0  4080  892  636 S  0.0  0.2   0:02.08 init
    2 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 kthreadd
    3 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 migration/0
    4 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0</pre>
<p>การใช้ CPU จาก Windows Task Manager รันบน Windows XP (Host OS) ระหว่างการรันคำสั่ง sysbench ในทดสอบครั้งที่ 1</p>
<p><img class="alignnone size-full wp-image-669" title="Windows Task Manager - 1 CPU - 1 Thread" src="http://spalinux.com/wp-content/uploads/2009/05/02_windows_task_manager_1_cpu_1_thread.png" alt="Windows Task Manager - 1 CPU - 1 Thread" width="404" height="457" /></p>
<h4> </h4>
<h4>2. Benchmark  1 CPU &#8211; 2 Threads</h4>
<p>การทดสอบครั้งที่สองยังคงใช้แค่ 1 CPU แต่จะเปลี่ยนค่าตัวแปรของคำสั่ง sysbench ให้สร้าง 2 threads เพื่อใช้ในการคำนวณ โดยต้องระบุออปชั่น &#8211;num-threads=2</p>
<p>รันคำสั่ง sysbench เพื่อเริ่มการทดสอบ 2. Benchmark 1 CPU &#8211; 2 Thread</p>
<pre>[root@fc10-dev ~]# <strong>sysbench --test=cpu --cpu-max-prime=20000 <span style="color: #0000ff;">--num-threads=2</span> run</strong>
sysbench 0.4.12:  multi-threaded system evaluation benchmark</pre>
<pre>Running the test with following options:
<span style="color: #0000ff;">Number of threads: 2</span></pre>
<pre>Doing CPU performance benchmark</pre>
<pre>Threads started!
Done.</pre>
<pre><span style="color: #0000ff;">Maximum prime number checked in CPU test: 20000
</span><span style="color: #0000ff;">Test execution summary:
    total time:                          25.8331s
</span>    total number of events:              10000
    total time taken by event execution: 51.6430
    per-request statistics:
         min:                                  2.39ms
         avg:                                  5.16ms
         max:                                 33.79ms
         approx.  95 percentile:              13.36ms</pre>
<pre>Threads fairness:
    events (avg/stddev):           5000.0000/2.00
    execution time (avg/stddev):   25.8215/0.00</pre>
<pre>[root@fc10-dev ~]#</pre>
<p>เวลาที่ใช้ในการคำนวน (total time) ครั้งที่ 2 ใกล้เคียงกับการทดสอบครั้งที่ 1</p>
<p>การใช้ CPU จากคำสั่ง top ระหว่างการรันคำสั่ง sysbench ในทดสอบครั้งที่ 2</p>
<pre>[root@fc10-dev ~]# <strong>top</strong>
top - 18:20:16 up 11 min,  2 users,  load average: 0.36, 0.23, 0.13
Tasks:  80 total,   1 running,  79 sleeping,   0 stopped,   0 zombie
<span style="color: #0000ff;">Cpu0  :100.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st</span>
Mem:    508292k total,   101028k used,   407264k free,     5340k buffers
Swap:  1068312k total,        0k used,  1068312k free,    37588k cached</pre>
<pre>  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
<span style="color: #0000ff;"> 2055 root      20   0 46968 2116 1532 S 99.9  0.4   0:06.34 sysbench
</span>    1 root      20   0  4080  892  636 S  0.0  0.2   0:02.08 init
    2 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 kthreadd
    3 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 migration/0
    4 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0</pre>
<p>การใช้ CPU จาก Windows Task Manager รันบน Windows XP (Host OS) ระหว่างการรันคำสั่ง sysbench ในทดสอบครั้งที่ 2</p>
<p><img class="alignnone size-full wp-image-670" title="Windows Task Manager - 1 CPU - 2 Threads" src="http://spalinux.com/wp-content/uploads/2009/05/03_windows_task_manager_1_cpu_2_threads.png" alt="Windows Task Manager - 1 CPU - 2 Threads" width="404" height="457" /></p>
<h4>3. Benchmark  2 CPU &#8211; 1 Thread</h4>
<p>การทดสอบครั้งที่ 3, 4 จะเปลี่ยนจำนวน CPU ในคอนฟิก VMware Server เป็น 2 CPU</p>
<p><img class="alignnone size-full wp-image-671" title="VMware Settings 2 CPU" src="http://spalinux.com/wp-content/uploads/2009/05/04_vmware_settings_2_cpu.png" alt="VMware Settings 2 CPU" width="617" height="476" /></p>
<p>ตรวจสอบสเปคของ CPU ได้จากไฟล์ /proc/cpuinfo</p>
<pre>[root@fc10-dev ~]# <strong>cat /proc/cpuinfo</strong>
<span style="color: #0000ff;">processor       : 0
</span>vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
<span style="color: #0000ff;">model name      : Intel(R) Core(TM)2 Duo CPU     @ 2.53GHz
</span>stepping        : 8
cpu MHz         : 2526.985
cache size      : 6144 KB
...</pre>
<pre><span style="color: #0000ff;">processor       : 1
</span>vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
<span style="color: #0000ff;">model name      : Intel(R) Core(TM)2 Duo CPU     @ 2.53GHz
</span>stepping        : 8
cpu MHz         : 2526.985
cache size      : 6144 KB
...</pre>
<p>การทดสอบครั้งที่ 3 มี 2 CPU แล้ว แต่จะรันทดสอบโดยใช้แค่ 1 thread ก่อน</p>
<p>รันคำสั่ง sysbench เพื่อเริ่มการทดสอบ 3. Benchmark 2 CPU &#8211; 1 Thread</p>
<pre>[root@fc10-dev ~]# <strong>sysbench --test=cpu --cpu-max-prime=20000 run</strong>
sysbench 0.4.12:  multi-threaded system evaluation benchmark</pre>
<pre>Running the test with following options:
<span style="color: #0000ff;">Number of threads: 1</span></pre>
<pre>Doing CPU performance benchmark</pre>
<pre>Threads started!
Done.</pre>
<pre><span style="color: #0000ff;">Maximum prime number checked in CPU test: 20000
Test execution summary:
    total time:                          26.2995s
</span>    total number of events:              10000
    total time taken by event execution: 26.2713
    per-request statistics:
         min:                                  2.40ms
         avg:                                  2.63ms
         max:                                 14.51ms
         approx.  95 percentile:               2.96ms</pre>
<pre>Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   26.2713/0.00</pre>
<pre>[root@fc10-dev ~]#</pre>
<p>ผลลัพธ์ที่ได้จากรันทดสอบครั้งที่ 3 เวลาที่ใช้ในการคำนวณค่า &#8220;total time&#8221; ก็ยังคงใกล้เคียงกับครั้งที่ 1, 2</p>
<p>การใช้ CPU จากคำสั่ง top ระหว่างการรันคำสั่ง sysbench ในทดสอบครั้งที่ 3 จะเห็นว่ามีการใช้แค่ CPU เดียวเท่านั้น  CPU อีกตัว 100.0%id คือไม่ได้ถูกใช้เลย</p>
<pre>[root@fc10-dev ~]# <strong>top</strong>
top - 18:31:55 up 3 min,  2 users,  load average: 0.18, 0.13, 0.05
Tasks:  93 total,   2 running,  91 sleeping,   0 stopped,   0 zombie
<span style="color: #0000ff;">Cpu0  : 79.0%us, 21.0%sy,  0.0%ni, <strong> 0.0%id</strong>,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  :  0.0%us,  0.0%sy,  0.0%ni,<strong>100.0%id</strong>,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
</span>Mem:    508196k total,   114384k used,   393812k free,     5008k buffers
Swap:  1068312k total,        0k used,  1068312k free,    39524k cached</pre>
<pre>  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
<span style="color: #0000ff;"> 2163 root      20   0 47828 2076 1528 S 99.9  0.4   0:08.95 sysbench
</span>    1 root      20   0  4080  896  636 S  0.0  0.2   0:01.44 init
    2 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 kthreadd
    3 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 migration/0
    4 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0</pre>
<p>การใช้ CPU จาก Windows Task Manager รันบน Windows XP (Host OS) ระหว่างการรันคำสั่ง sysbench ในทดสอบครั้งที่ 3 กราฟที่แสดง มีการใช้ CPU เพียงแค่ตัวเดียวเท่านั้น ซึ่งตรงกับผลัพธ์จากคำสั่ง top</p>
<p><img class="alignnone size-full wp-image-672" title="Windows Task Manager - 2 CPU - 1 Thread" src="http://spalinux.com/wp-content/uploads/2009/05/05_windows_task_manager_2_cpu_1_thread.png" alt="Windows Task Manager - 2 CPU - 1 Thread" width="404" height="457" /></p>
<p> </p>
<h4>4. Benchmark 2 CPU &#8211; 2 Threads</h4>
<p>การทดสอบครั้งที่ 4 เครื่องมี 2 CPU แต่จะเปลี่ยนค่าตัวแปรของคำสั่ง sysbench ให้สร้าง 2 threads เพื่อใช้ในการคำนวณ &#8211;num-threads=2</p>
<p>รันคำสั่ง sysbench เพื่อเริ่มการทดสอบ 4. Benchmark 2 CPU &#8211; 2 Threads</p>
<pre>[root@fc10-dev ~]# <strong>sysbench --test=cpu --cpu-max-prime=20000 <span style="color: #0000ff;">--num-threads=2</span> run</strong>
sysbench 0.4.12:  multi-threaded system evaluation benchmark</pre>
<pre>Running the test with following options:
<span style="color: #0000ff;">Number of threads: 2</span></pre>
<pre>Doing CPU performance benchmark</pre>
<pre>Threads started!
Done.</pre>
<pre><span style="color: #0000ff;">Maximum prime number checked in CPU test: 20000
Test execution summary:
    total time:                          13.4928s
</span>    total number of events:              10000
    total time taken by event execution: 26.9476
    per-request statistics:
         min:                                  2.52ms
         avg:                                  2.69ms
         max:                                 17.48ms
         approx.  95 percentile:               2.93ms</pre>
<pre>Threads fairness:
    events (avg/stddev):           5000.0000/16.00
    execution time (avg/stddev):   13.4738/0.00</pre>
<pre>[root@fc10-dev ~]#</pre>
<p>ผลลัพธ์ในการรันทดสอบครั้งที่ 4 เวลาที่ใช้ในการคำนวณค่า &#8220;total time&#8221; มีค่าน้อยกว่าค่าที่ได้จากครั้งที่ 1,2 และ 3 เกือบครึ่ง หมายความว่าการใช้คอนฟิกแบบนี้ 2 CPU และใช้ 2 threads สามารถคำนวณค่าจำนวนเฉพาะได้เร็วกว่านั่นเอง</p>
<p>การใช้ CPU จากคำสั่ง top ระหว่างการรันคำสั่ง sysbench ในทดสอบครั้งที่ 4 แสดงให้เห็นว่ามีการใช้ CPU ทั้ง 2 ตัว พร้อมกัน (0.0%id)</p>
<pre>[root@fc10-dev ~]# <strong>top</strong>
top - 18:33:44 up 5 min,  2 users,  load average: 0.53, 0.23, 0.10
Tasks:  93 total,   2 running,  91 sleeping,   0 stopped,   0 zombie
<span style="color: #0000ff;">Cpu0  : 80.1%us, 19.9%sy,  0.0%ni,  <strong>0.0%id</strong>,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  : 93.6%us,  6.4%sy,  0.0%ni,  <strong>0.0%id</strong>,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
</span>Mem:    508196k total,   114640k used,   393556k free,     5152k buffers
Swap:  1068312k total,        0k used,  1068312k free,    39524k cached</pre>
<pre>  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
<span style="color: #0000ff;"> 2165 root      20   0 46968 2096 1532 S 199.4  0.4   0:23.56 sysbench
</span>    1 root      20   0  4080  896  636 S  0.0  0.2   0:01.44 init
    2 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 kthreadd
    3 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 migration/0
    4 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0</pre>
<p>การใช้ CPU จาก Windows Task Manager รันบน Windows XP (Host OS) ระหว่างการรันคำสั่ง sysbench ในทดสอบครั้งที่ 4 กราฟแสดงให้เห็นว่ามีการใช้ CPU ทั้ง 2 ตัว</p>
<p><img class="alignnone size-full wp-image-673" title="Windows Task Manager - 2 CPU - 2 Thread" src="http://spalinux.com/wp-content/uploads/2009/05/06_windows_task_manager_2_cpu_2_thread.png" alt="Windows Task Manager - 2 CPU - 2 Thread" width="404" height="457" /></p>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2009/05/compile_sysbench_on_fedora_10">คอมไพล์ sysbench บน Fedora 10</a></li>
<li><a href="http://sysbench.sourceforge.net/docs/" target="_blank">SysBench manual</a></li>
<li><a href="http://spalinux.com/2009/05/compile_sysbench_on_solaris_10_x86">คอมไพล์ sysbench บน Solaris 10 (x86)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/05/sysbench_cpu_benchmark/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>คอมไพล์ sysbench บน Fedora 10</title>
		<link>http://spalinux.com/2009/05/%e0%b8%84%e0%b8%ad%e0%b8%a1%e0%b9%84%e0%b8%9e%e0%b8%a5%e0%b9%8c-sysbench-%e0%b8%9a%e0%b8%99-fedora-10</link>
		<comments>http://spalinux.com/2009/05/%e0%b8%84%e0%b8%ad%e0%b8%a1%e0%b9%84%e0%b8%9e%e0%b8%a5%e0%b9%8c-sysbench-%e0%b8%9a%e0%b8%99-fedora-10#comments</comments>
		<pubDate>Sat, 16 May 2009 10:40:35 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Filesystem]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[sysbench]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=656</guid>
		<description><![CDATA[SysBench เป็นโปรแกรมที่ใช้วัดประสิทธิภาพ (benchmark) ของเครื่องได้หลายอย่าง ทั้ง CPU, Memory, Disk และ Database ทั้งนี้ยังสามารถระบุออปชั่นสำหรับการทดสอบได้เช่น จำนวน thread ที่รัน ขนาดที่จะทดสอบ ระยะเวลาที่ใช้ในการรัน เราสามารถนำผลลัพธ์ที่ได้มาเปรียบเทียบเพื่อการตัดสินใจเลือกซื้อ ปรับแต่งเครื่อง หรือแก้ไขคอนฟิกให้ระบบทำงานได้ดีขึ้น เนื่องจากในแผ่นติดั้ง หรือ จาก Fedora 10 Everything ไม่มีโปรแกรม sysbench ในรูปแบบ rpm ทำให้การที่จะใช้โปรแกรมนี้ได้ ในบทความนี้ขอนำเสนอขั้นตอนและวิธีการคอมไพล์โปรแกรม sysbench และติดตั้งเอง หมายเหตุ เครื่องที่จะคอมไพล์ source file ได้นั้น จำเป็นต้องติดตั้ง package ประเภท development ด้วย ดาวน์โหลดไฟล์ เวอร์ชั่นล่าสุดตอนที่เขียนบทความนี้ (16 May 2009) คือ sysbench-0.4.12 สามารถดาวน์โหลดได้ที่ Download sysbench &#8211; SourceForge.net: [...]]]></description>
			<content:encoded><![CDATA[<p>SysBench เป็นโปรแกรมที่ใช้วัดประสิทธิภาพ (benchmark) ของเครื่องได้หลายอย่าง ทั้ง CPU, Memory, Disk และ Database ทั้งนี้ยังสามารถระบุออปชั่นสำหรับการทดสอบได้เช่น จำนวน thread ที่รัน ขนาดที่จะทดสอบ ระยะเวลาที่ใช้ในการรัน</p>
<p>เราสามารถนำผลลัพธ์ที่ได้มาเปรียบเทียบเพื่อการตัดสินใจเลือกซื้อ ปรับแต่งเครื่อง หรือแก้ไขคอนฟิกให้ระบบทำงานได้ดีขึ้น</p>
<p>เนื่องจากในแผ่นติดั้ง หรือ จาก Fedora 10 Everything ไม่มีโปรแกรม sysbench ในรูปแบบ rpm ทำให้การที่จะใช้โปรแกรมนี้ได้ ในบทความนี้ขอนำเสนอขั้นตอนและวิธีการคอมไพล์โปรแกรม sysbench และติดตั้งเอง</p>
<p><span id="more-656"></span></p>
<p>หมายเหตุ เครื่องที่จะคอมไพล์ source file ได้นั้น จำเป็นต้องติดตั้ง package ประเภท development ด้วย</p>
<h4>ดาวน์โหลดไฟล์</h4>
<p>เวอร์ชั่นล่าสุดตอนที่เขียนบทความนี้ (16 May 2009) คือ sysbench-0.4.12 สามารถดาวน์โหลดได้ที่ <a href="http://sourceforge.net/project/showfiles.php?group_id=102348&amp;package_id=109810" target="_blank">Download sysbench &#8211; SourceForge.net: System performance benchmark: Files</a></p>
<h4>แตกไฟล์ (extract) ใน /usr/local/src/</h4>
<p>โปรแกรมที่นำมาคอมไพล์และติดตั้งเอง แนะนำให้ไว้ใน /usr/local/ เพราะเวลาปรับปรุง หรือติดตั้งใหม่ จะได้สะดวกต่อการอ้างอิงและค้นหา ในที่นี้จะไว้ใน /usr/local/src/ เพื่อเก็บ source file และไฟล์ที่ใช้ระหว่างการคอมไพล์โปรแกรม</p>
<pre>[root@fc10-dev ~]# <strong>cp sysbench-0.4.12.tar.gz /usr/local/src/</strong>
[root@fc10-dev ~]# <strong>cd /usr/local/src/
</strong>[root@fc10-dev src]# <strong>ls -l
</strong>total 420
-rw-r--r-- 1 root root 421932 2009-05-16 17:02 sysbench-0.4.12.tar.gz</pre>
<p>ใช้คำสั่ง tar เพื่อแตกไฟล์</p>
<pre>[root@fc10-dev src]# <strong>tar zxvf sysbench-0.4.12.tar.gz
</strong>sysbench-0.4.12/
sysbench-0.4.12/configure
sysbench-0.4.12/TODO
sysbench-0.4.12/missing
sysbench-0.4.12/INSTALL
sysbench-0.4.12/autogen.sh
sysbench-0.4.12/Makefile.in
sysbench-0.4.12/README
sysbench-0.4.12/Makefile.am
sysbench-0.4.12/README-WIN.txt
...
...
...
sysbench-0.4.12/sysbench/sysbench.h
sysbench-0.4.12/sysbench/sb_options.h
sysbench-0.4.12/sysbench/sb_list.h
sysbench-0.4.12/sysbench/sb_logger.h
sysbench-0.4.12/sysbench/sb_logger.c
sysbench-0.4.12/sysbench/sb_options.c
sysbench-0.4.12/sysbench/sb_timer.c
sysbench-0.4.12/sysbench/sb_timer.h
sysbench-0.4.12/sysbench/CMakeLists.txt
sysbench-0.4.12/sysbench/sb_win.c</pre>
<p>ใช้คำสั่ง cd เข้าไปในไดเร็คทอรี ใช้คำสั่ง ls เพื่อดูไฟล์</p>
<pre>[root@fc10-dev src]# cd sysbench-0.4.12/
[root@fc10-dev sysbench-0.4.12]# ls
acinclude.m4  autogen.sh  config     configure.ac  doc      install-sh   Makefile.in  mkinstalldirs  README-WIN.txt  TODO
aclocal.m4    ChangeLog   configure  COPYING       INSTALL  Makefile.am  missing      README         sysbench</pre>
<h4>รัน ./configure</h4>
<p>รัน ./configure เพื่อตรวจสอบไฟล์ต่างๆ ที่จำเป็นในการคอนไพล์โปรแกรม และสร้าง Makefile สำหรับคอมไพล์โปรแกรม</p>
<pre>[root@fc10-dev sysbench-0.4.12]# <strong>./configure
</strong>checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to compile with MySQL support... (cached) yes
checking whether to compile with Oracle support... (cached) no
checking whether to compile with PostgreSQL support... (cached) no
checking for style of include used by make... GNU
checking for gcc... gcc
...
...
...
checking for cc_r... gcc
checking for sqrt in -lm... yes
checking for mysql_config... no
<span style="color: #ff0000;">configure: error: mysql_config executable not found
********************************************************************************
ERROR: cannot find MySQL libraries. If you want to compile with MySQL support,
       you must either specify file locations explicitly using
       --with-mysql-includes and --with-mysql-libs options, or make sure path to
       mysql_config is listed in your PATH environment variable. If you want to
       disable MySQL support, use --without-mysql option.
********************************************************************************</span></pre>
<pre>[root@fc10-dev sysbench-0.4.12]#</pre>
<p>ถ้าเจอข้อความฟ้องเตือน error แปลว่าขาดไฟล์ที่ต้องใช้  จำเป็นต้องติดตั้งไฟล์เพิ่มเติมก่อน แล้วรัน ./configure อีกครั้ง</p>
<p><span style="color: #808080;">แต่ถ้าในกรณีเราไม่ต้องการใช้โปรแกรม sysbench เพื่อทดสอบประสิทธิภาพของ mysql สามารถรัน ./configure ตามด้วยออปชั่น &#8211;without-mysql ก็รัน ./configure ผ่านได้</span></p>
<pre><span style="color: #808080;">[root@fc10-dev sysbench-0.4.12]# </span><span style="color: #808080;"><strong>./configure --without-mysql
</strong>checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to compile with MySQL support... (cached) no
checking whether to compile with Oracle support... (cached) no
checking whether to compile with PostgreSQL support... (cached) no
checking for style of include used by make... GNU
checking for gcc... gcc
...
...
...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/xsl/Makefile
config.status: creating doc/xsl/catalog.xml
config.status: creating doc/Makefile
config.status: creating sysbench/Makefile
config.status: creating sysbench/drivers/Makefile
config.status: creating sysbench/drivers/mysql/Makefile
config.status: creating sysbench/drivers/oracle/Makefile
config.status: creating sysbench/drivers/pgsql/Makefile
config.status: creating sysbench/tests/Makefile
config.status: creating sysbench/tests/cpu/Makefile
config.status: creating sysbench/tests/fileio/Makefile
config.status: creating sysbench/tests/memory/Makefile
config.status: creating sysbench/tests/threads/Makefile
config.status: creating sysbench/tests/mutex/Makefile
config.status: creating sysbench/tests/oltp/Makefile
config.status: creating config/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
[root@fc10-dev sysbench-0.4.12]#</span></pre>
<p>ข้อความ error ด้านบน &#8220;<span style="color: #ff0000;">configure: error: mysql_config executable not found</span>&#8221; หมายถึงเครื่องนี้ไม่มีไฟล์ mysql_config ซึ่งได้จากการติดตั้ง mysql</p>
<p>สามารถติดตั้ง mysql เพิ่มเติม จากแผ่น DVD ติดตั้ง ใส่แผ่น DVD ใช้คำสั่ง mount เพื่อติดตั้งไฟล์ package ของ mysql</p>
<pre>[root@fc10-dev sysbench-0.4.12]# <strong>mount /dev/scd0 /media/
</strong>mount: block device /dev/sr0 is write-protected, mounting read-only
[root@fc10-dev sysbench-0.4.12]# <strong>cd /media/Packages/</strong></pre>
<pre>[root@fc10-dev Packages]# <strong>rpm -i mysql-libs-5.0.67-2.fc10.x86_64.rpm
</strong>[root@fc10-dev Packages]# <strong>rpm -i perl-DBI-1.607-1.fc10.x86_64.rpm
</strong>[root@fc10-dev Packages]# <strong>rpm -i mysql-5.0.67-2.fc10.x86_64.rpm</strong></pre>
<pre>[root@fc10-dev Packages]# <strong>cd -
</strong>/usr/local/src/sysbench-0.4.12
[root@fc10-dev sysbench-0.4.12]#</pre>
<p>รัน ./configure อีกครั้ง</p>
<pre>[root@fc10-dev sysbench-0.4.12]# <strong>./configure
</strong>checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to compile with MySQL support... (cached) yes
checking whether to compile with Oracle support... (cached) no
checking whether to compile with PostgreSQL support... (cached) no
checking for style of include used by make... GNU
checking for gcc... gcc
...
...
...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/xsl/Makefile
config.status: creating doc/xsl/catalog.xml
config.status: creating doc/Makefile
config.status: creating sysbench/Makefile
config.status: creating sysbench/drivers/Makefile
config.status: creating sysbench/drivers/mysql/Makefile
config.status: creating sysbench/drivers/oracle/Makefile
config.status: creating sysbench/drivers/pgsql/Makefile
config.status: creating sysbench/tests/Makefile
config.status: creating sysbench/tests/cpu/Makefile
config.status: creating sysbench/tests/fileio/Makefile
config.status: creating sysbench/tests/memory/Makefile
config.status: creating sysbench/tests/threads/Makefile
config.status: creating sysbench/tests/mutex/Makefile
config.status: creating sysbench/tests/oltp/Makefile
config.status: creating config/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
[root@fc10-dev sysbench-0.4.12]#</pre>
<p>ก่อนจะข้ามไปขั้นตอนต่อไปต้องดูผลลัพธ์ของ ./configure ด้วยว่ายังมี error ใดๆ อีกหรือไม่</p>
<h4>รัน make</h4>
<p>รัน make เพื่อเริ่มคอมไฟล์โปรแกรม</p>
<pre>[root@fc10-dev sysbench-0.4.12]# <strong>make
</strong>Making all in doc
make[1]: Entering directory `/usr/local/src/sysbench-0.4.12/doc'
Making all in xsl
make[2]: Entering directory `/usr/local/src/sysbench-0.4.12/doc/xsl'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/usr/local/src/sysbench-0.4.12/doc/xsl'
make[2]: Entering directory `/usr/local/src/sysbench-0.4.12/doc'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/usr/local/src/sysbench-0.4.12/doc'
make[1]: Leaving directory `/usr/local/src/sysbench-0.4.12/doc'
Making all in sysbench
make[1]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench'
Making all in drivers
make[2]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench/drivers'
Making all in mysql
make[3]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench/drivers/mysql'
gcc -DHAVE_CONFIG_H -I. -I../../../config  -I/usr/include/mysql  -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbmysql_a-drv_mysql.o -MD -MP -MF .deps/libsbmysql_a-drv_mysql.Tpo -c -o libsbmysql_a-drv_mysql.o `test -f 'drv_mysql.c' || echo './'`drv_mysql.c
<span style="color: #ff0000;">drv_mysql.c:35:19: error: mysql.h: No such file or directory
drv_mysql.c:36:26: error: mysqld_error.h: No such file or directory
</span>drv_mysql.c: In function ‘mysql_drv_describe’:
drv_mysql.c:284: error: ‘MYSQL_RES’ undeclared (first use in this function)
drv_mysql.c:284: error: (Each undeclared identifier is reported only once
drv_mysql.c:284: error: for each function it appears in.)
drv_mysql.c:284: error: ‘res’ undeclared (first use in this function)
drv_mysql.c:285: error: ‘MYSQL_ROW’ undeclared (first use in this function)
drv_mysql.c:285: error: expected ‘;’ before ‘row’
drv_mysql.c:286: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
drv_mysql.c:286: error: ‘fields’ undeclared (first use in this function)
drv_mysql.c:328: error: ‘row’ undeclared (first use in this function)
drv_mysql.c: In function ‘mysql_drv_connect’:
drv_mysql.c:360: error: ‘MYSQL’ undeclared (first use in this function)
drv_mysql.c:360: error: ‘con’ undeclared (first use in this function)
drv_mysql.c:366: error: expected expression before ‘)’ token
drv_mysql.c:401: error: ‘MYSQL_VERSION_ID’ undeclared (first use in this function)
drv_mysql.c: In function ‘mysql_drv_disconnect’:
drv_mysql.c:441: error: ‘MYSQL’ undeclared (first use in this function)
drv_mysql.c:441: error: ‘con’ undeclared (first use in this function)
drv_mysql.c: In function ‘mysql_drv_bind_param’:
drv_mysql.c:520: error: ‘MYSQL’ undeclared (first use in this function)
drv_mysql.c:520: error: ‘con’ undeclared (first use in this function)
drv_mysql.c:520: error: expected expression before ‘)’ token
drv_mysql.c: In function ‘mysql_drv_query’:
drv_mysql.c:729: error: ‘MYSQL’ undeclared (first use in this function)
drv_mysql.c:729: error: ‘con’ undeclared (first use in this function)
drv_mysql.c:739: error: ‘ER_LOCK_DEADLOCK’ undeclared (first use in this function)
drv_mysql.c:739: error: ‘ER_LOCK_WAIT_TIMEOUT’ undeclared (first use in this function)
drv_mysql.c:739: error: ‘ER_CHECKREAD’ undeclared (first use in this function)
drv_mysql.c: In function ‘mysql_drv_store_results’:
drv_mysql.c:789: error: ‘MYSQL’ undeclared (first use in this function)
drv_mysql.c:789: error: ‘con’ undeclared (first use in this function)
drv_mysql.c:790: error: ‘MYSQL_RES’ undeclared (first use in this function)
drv_mysql.c:790: error: ‘res’ undeclared (first use in this function)
drv_mysql.c:791: error: ‘MYSQL_ROW’ undeclared (first use in this function)
drv_mysql.c:791: error: expected ‘;’ before ‘row’
drv_mysql.c:839: error: ‘ER_LOCK_DEADLOCK’ undeclared (first use in this function)
drv_mysql.c:839: error: ‘ER_LOCK_WAIT_TIMEOUT’ undeclared (first use in this function)
drv_mysql.c:855: error: ‘row’ undeclared (first use in this function)
drv_mysql.c: In function ‘mysql_drv_free_results’:
drv_mysql.c:879: error: ‘MYSQL_RES’ undeclared (first use in this function)
drv_mysql.c:879: error: expected expression before ‘)’ token
make[3]: *** [libsbmysql_a-drv_mysql.o] Error 1
make[3]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench/drivers/mysql'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench/drivers'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench'
make: *** [all-recursive] Error 1
[root@fc10-dev sysbench-0.4.12]#</pre>
<p>ถ้ามีข้อความ error ฟ้องเตือนขึ้นมา แสดงว่าคอมไพล์โปรแกรมไม่สำเร็จ ต้องทำการแก้ไข ส่วนมากคือขาดไฟล์ที่ต้องใช้ ในที่นี้</p>
<pre><span style="color: #ff0000;">drv_mysql.c:35:19: error: mysql.h: No such file or directory
drv_mysql.c:36:26: error: mysqld_error.h: No such file or directory</span></pre>
<p>แปลว่าขาดไฟล์ header ของ mysql ต้องติดตั้งเพิ่มเติม ไฟล์ header (mysql.h, mysqld_error.h) อยู่ใน package ชื่อ mysql-devel ซึ่งไม่มีอยู่ในแผ่นติดตั้ง DVD ต้องดาวน์โหลดเพิ่มเติมจาก  <a href="ftp://www.mirror.in.th./fedora/releases/10/Everything/x86_64/os/Packages/" target="_blank">FC10 Everything (x86_64)</a></p>
<pre>[root@fc10-dev sysbench-0.4.12]# <strong>cd ~
</strong>[root@fc10-dev ~]# <strong>rpm -i mysql-devel-5.0.67-2.fc10.x86_64.rpm</strong></pre>
<pre>[root@fc10-dev ~]# <strong>cd -</strong>
/usr/local/src/sysbench-0.4.12
[root@fc10-dev sysbench-0.4.12]#</pre>
<p>รันคำสั่ง make อีกครั้ง</p>
<pre>[root@fc10-dev sysbench-0.4.12]# <strong>make
</strong>Making all in doc
make[1]: Entering directory `/usr/local/src/sysbench-0.4.12/doc'
Making all in xsl
make[2]: Entering directory `/usr/local/src/sysbench-0.4.12/doc/xsl'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/usr/local/src/sysbench-0.4.12/doc/xsl'
make[2]: Entering directory `/usr/local/src/sysbench-0.4.12/doc'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/usr/local/src/sysbench-0.4.12/doc'
make[1]: Leaving directory `/usr/local/src/sysbench-0.4.12/doc'
Making all in sysbench
make[1]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench'
Making all in drivers
make[2]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench/drivers'
Making all in mysql
make[3]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench/drivers/mysql'
gcc -DHAVE_CONFIG_H -I. -I../../../config  -I/usr/include/mysql  -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbmysql_a-drv_mysql.o -MD -MP -MF .deps/libsbmysql_a-drv_mysql.Tpo -c -o libsbmysql_a-drv_mysql.o `test -f 'drv_mysql.c' || echo './'`drv_mysql.c
mv -f .deps/libsbmysql_a-drv_mysql.Tpo .deps/libsbmysql_a-drv_mysql.Po
rm -f libsbmysql.a
ar cru libsbmysql.a libsbmysql_a-drv_mysql.o
ranlib libsbmysql.a
make[3]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench/drivers/mysql'
make[3]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench/drivers'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench/drivers'
make[2]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench/drivers'
Making all in tests
make[2]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench/tests'
Making all in cpu
make[3]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench/tests/cpu'
gcc -DHAVE_CONFIG_H -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbcpu_a-sb_cpu.o -MD -MP -MF .deps/libsbcpu_a-sb_cpu.Tpo -c -o libsbcpu_a-sb_cpu.o `test -f 'sb_cpu.c' || echo './'`sb_cpu.c
mv -f .deps/libsbcpu_a-sb_cpu.Tpo .deps/libsbcpu_a-sb_cpu.Po
rm -f libsbcpu.a
ar cru libsbcpu.a libsbcpu_a-sb_cpu.o
ranlib libsbcpu.a
make[3]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench/tests/cpu'
Making all in fileio
make[3]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench/tests/fileio'
gcc -DHAVE_CONFIG_H -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbfileio_a-sb_fileio.o -MD -MP -MF .deps/libsbfileio_a-sb_fileio.Tpo -c -o libsbfileio_a-sb_fileio.o `test -f 'sb_fileio.c' || echo './'`sb_fileio.c
mv -f .deps/libsbfileio_a-sb_fileio.Tpo .deps/libsbfileio_a-sb_fileio.Po
gcc -DHAVE_CONFIG_H -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbfileio_a-crc32.o -MD -MP -MF .deps/libsbfileio_a-crc32.Tpo -c -o libsbfileio_a-crc32.o `test -f 'crc32.c' || echo './'`crc32.c
mv -f .deps/libsbfileio_a-crc32.Tpo .deps/libsbfileio_a-crc32.Po
rm -f libsbfileio.a
ar cru libsbfileio.a libsbfileio_a-sb_fileio.o libsbfileio_a-crc32.o
ranlib libsbfileio.a
make[3]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench/tests/fileio'
Making all in memory
make[3]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench/tests/memory'
gcc -DHAVE_CONFIG_H -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbmemory_a-sb_memory.o -MD -MP -MF .deps/libsbmemory_a-sb_memory.Tpo -c -o libsbmemory_a-sb_memory.o `test -f 'sb_memory.c' || echo './'`sb_memory.c
mv -f .deps/libsbmemory_a-sb_memory.Tpo .deps/libsbmemory_a-sb_memory.Po
rm -f libsbmemory.a
ar cru libsbmemory.a libsbmemory_a-sb_memory.o
ranlib libsbmemory.a
make[3]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench/tests/memory'
Making all in threads
make[3]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench/tests/threads'
gcc -DHAVE_CONFIG_H -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbthreads_a-sb_threads.o -MD -MP -MF .deps/libsbthreads_a-sb_threads.Tpo -c -o libsbthreads_a-sb_threads.o `test -f 'sb_threads.c' || echo './'`sb_threads.c
mv -f .deps/libsbthreads_a-sb_threads.Tpo .deps/libsbthreads_a-sb_threads.Po
rm -f libsbthreads.a
ar cru libsbthreads.a libsbthreads_a-sb_threads.o
ranlib libsbthreads.a
make[3]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench/tests/threads'
Making all in mutex
make[3]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench/tests/mutex'
gcc -DHAVE_CONFIG_H -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbmutex_a-sb_mutex.o -MD -MP -MF .deps/libsbmutex_a-sb_mutex.Tpo -c -o libsbmutex_a-sb_mutex.o `test -f 'sb_mutex.c' || echo './'`sb_mutex.c
mv -f .deps/libsbmutex_a-sb_mutex.Tpo .deps/libsbmutex_a-sb_mutex.Po
rm -f libsbmutex.a
ar cru libsbmutex.a libsbmutex_a-sb_mutex.o
ranlib libsbmutex.a
make[3]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench/tests/mutex'
Making all in oltp
make[3]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench/tests/oltp'
gcc -DHAVE_CONFIG_H -I. -I../../../config  -I./.. -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench -I/usr/include/mysql  -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC  -pthread -g -O2 -MT libsboltp_a-sb_oltp.o -MD -MP -MF .deps/libsboltp_a-sb_oltp.Tpo -c -o libsboltp_a-sb_oltp.o `test -f 'sb_oltp.c' || echo './'`sb_oltp.c
mv -f .deps/libsboltp_a-sb_oltp.Tpo .deps/libsboltp_a-sb_oltp.Po
rm -f libsboltp.a
ar cru libsboltp.a libsboltp_a-sb_oltp.o
ranlib libsboltp.a
make[3]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench/tests/oltp'
make[3]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench/tests'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench/tests'
make[2]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench/tests'
Making all in .
make[2]: Entering directory `/usr/local/src/sysbench-0.4.12/sysbench'
gcc -DHAVE_CONFIG_H -I. -I../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench  -pthread -g -O2 -MT sysbench.o -MD -MP -MF .deps/sysbench.Tpo -c -o sysbench.o sysbench.c
mv -f .deps/sysbench.Tpo .deps/sysbench.Po
gcc -DHAVE_CONFIG_H -I. -I../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench  -pthread -g -O2 -MT sb_timer.o -MD -MP -MF .deps/sb_timer.Tpo -c -o sb_timer.o sb_timer.c
mv -f .deps/sb_timer.Tpo .deps/sb_timer.Po
gcc -DHAVE_CONFIG_H -I. -I../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench  -pthread -g -O2 -MT sb_options.o -MD -MP -MF .deps/sb_options.Tpo -c -o sb_options.o sb_options.c
mv -f .deps/sb_options.Tpo .deps/sb_options.Po
gcc -DHAVE_CONFIG_H -I. -I../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench  -pthread -g -O2 -MT sb_logger.o -MD -MP -MF .deps/sb_logger.Tpo -c -o sb_logger.o sb_logger.c
mv -f .deps/sb_logger.Tpo .deps/sb_logger.Po
gcc -DHAVE_CONFIG_H -I. -I../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench  -pthread -g -O2 -MT db_driver.o -MD -MP -MF .deps/db_driver.Tpo -c -o db_driver.o db_driver.c
mv -f .deps/db_driver.Tpo .deps/db_driver.Po
/bin/sh ../libtool --tag=CC   --mode=link gcc -pthread -g -O2      -o sysbench sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -rdynamic -L/usr/lib64/mysql -lmysqlclient_r -lz -lcrypt -lnsl -lm -L/usr/lib64 -lssl -lcrypto   -lrt -lm
<span style="color: #ff0000;">../libtool: line 838: X--tag=CC: command not found
../libtool: line 871: libtool: ignoring unknown tag : command not found
../libtool: line 838: X--mode=link: command not found
../libtool: line 1004: *** Warning: inferring the mode of operation is deprecated.: command not found
../libtool: line 1005: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
../libtool: line 2231: X-g: command not found
../libtool: line 2231: X-O2: command not found
../libtool: line 2231: X-rdynamic: command not found
../libtool: line 1951: X-L/usr/lib64/mysql: No such file or directory
../libtool: line 1951: X-L/usr/lib64: No such file or directory
../libtool: line 2400: Xsysbench: command not found
../libtool: line 2405: X: command not found
../libtool: line 2412: Xsysbench: command not found
../libtool: line 2547: X-lmysqlclient_r: command not found
../libtool: line 2547: X-lz: command not found
../libtool: line 2547: X-lcrypt: command not found
../libtool: line 2547: X-lnsl: command not found
../libtool: line 2547: X-lm: command not found
../libtool: line 2547: X-lssl: command not found
../libtool: line 2547: X-lcrypto: command not found
../libtool: line 2547: X-lrt: command not found
../libtool: line 2547: X-lm: command not found
../libtool: line 2629: X-L/usr/local/src/sysbench-0.4.12/sysbench: No such file or directory
../libtool: line 2547: X-lmysqlclient_r: command not found
../libtool: line 2547: X-lz: command not found
../libtool: line 2547: X-lcrypt: command not found
../libtool: line 2547: X-lnsl: command not found
../libtool: line 2547: X-lssl: command not found
../libtool: line 2547: X-lcrypto: command not found
../libtool: line 2547: X-lrt: command not found
../libtool: line 2547: X-lm: command not found
../libtool: line 2629: X-L/usr/local/src/sysbench-0.4.12/sysbench: No such file or directory
../libtool: line 2547: X-lmysqlclient_r: command not found
../libtool: line 2547: X-lz: command not found
../libtool: line 2547: X-lcrypt: command not found
../libtool: line 2547: X-lnsl: command not found
../libtool: line 2547: X-lssl: command not found
../libtool: line 2547: X-lcrypto: command not found
../libtool: line 2547: X-lrt: command not found
../libtool: line 2547: X-lm: command not found
../libtool: line 5162: Xgcc -pthread "" "" -o @OUTPUT@ sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o ""  tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -L/usr/local/src/sysbench-0.4.12/sysbench -lmysqlclient_r -lz -lcrypt -lnsl -lssl -lcrypto -lrt -lm: No such file or directory
../libtool: line 5163: Xgcc -pthread "" "" -o @OUTPUT@ sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o ""  tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -L/usr/local/src/sysbench-0.4.12/sysbench -lmysqlclient_r -lz -lcrypt -lnsl -lssl -lcrypto -lrt -lm: No such file or directory
../libtool: line 5168: X: command not found
../libtool: line 5172: : command not found
</span>make[2]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench'
make[1]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench'
make[1]: Entering directory `/usr/local/src/sysbench-0.4.12'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/usr/local/src/sysbench-0.4.12'
[root@fc10-dev sysbench-0.4.12]#</pre>
<p>การรัน make ครั้งนี้ก็ยังมี error อีก</p>
<pre><span style="color: #ff0000;">../libtool: line 838: X--tag=CC: command not found
../libtool: line 871: libtool: ignoring unknown tag : command not found
../libtool: line 838: X--mode=link: command not found</span></pre>
<p>เท่าที่ทดสอบและตรวจสอบข้อมูลจากเว็บไซต์ของ <a href="http://sourceforge.net/forum/forum.php?thread_id=3137221&amp;forum_id=353124" target="_blank">sysbench</a> เอง มีการเปลี่ยนแปลงเวอร์ชั่นของ libtool ซึ่งเป็น library ที่ใช้ในการคอมไพล์โปรแกรม เวอร์ชั่นตั้งแต่ 0.4.11  ต้องรันคำสั่งด้านล่างนี้เพื่อแก้ไขปัญหา</p>
<pre>[root@fc10-dev sysbench-0.4.12]# <strong>libtoolize --force --copy
</strong>You should update your `aclocal.m4' by running aclocal.
Putting files in AC_CONFIG_AUX_DIR, `config'.</pre>
<pre>[root@fc10-dev sysbench-0.4.12]# <strong>./autogen.sh
</strong>[root@fc10-dev sysbench-0.4.12]#</pre>
<p>รันคำสั่ง make อีกครั้ง หลังจากรันคำสั่งแก้ไข</p>
<pre>[root@fc10-dev sysbench-0.4.12]# <strong>make</strong>
/bin/sh ./config.status --recheck
running CONFIG_SHELL=/bin/sh /bin/sh ./configure   --no-create --no-recursion
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to compile with MySQL support... (cached) yes
checking whether to compile with Oracle support... (cached) no
checking whether to compile with PostgreSQL support... (cached) no
checking for style of include used by make... GNU
checking for gcc... gcc
...
...
...
/bin/sh ../libtool --tag=CC   --mode=link gcc -pthread -g -O2      -o sysbench sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -rdynamic -L/usr/lib64/mysql -lmysqlclient_r -lz -lcrypt -lnsl -lm -L/usr/lib64 -lssl -lcrypto   -lrt -lm
mkdir .libs
gcc -pthread -g -O2 -o sysbench sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o -rdynamic  tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -L/usr/lib64/mysql -lmysqlclient_r -lz -lcrypt -lnsl -L/usr/lib64 -lssl -lcrypto -lrt -lm
make[2]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench'
make[1]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench'
make[1]: Entering directory `/usr/local/src/sysbench-0.4.12'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/usr/local/src/sysbench-0.4.12'
[root@fc10-dev sysbench-0.4.12]#</pre>
<p>ตรวจสอบอีกครั้งว่าไม่มี error ขึ้นมาอีก จากการันคำสั่ง make แล้วค่อยไปขั้นตอนต่อไป</p>
<h4>รัน make install</h4>
<p>ถ้ารัน make แล้ว ไม่มีข้อความ error แสดงว่าโปรแกรมคอมไพล์สำเร็จ สามารถใช้คำสั่ง make install เพื่อติดตั้งไฟล์ได้ โดยดีฟอลต์ โปรแกรมที่คอมไฟล์เองจะติดตั้งไฟล์ไว้ใน /usr/local/</p>
<pre>[root@fc10-dev sysbench-0.4.12]# <strong>make install
</strong>Making install in doc
make[1]: Entering directory `/usr/local/src/sysbench-0.4.12/doc'
Making install in xsl
make[2]: Entering directory `/usr/local/src/sysbench-0.4.12/doc/xsl'
make[3]: Entering directory `/usr/local/src/sysbench-0.4.12/doc/xsl'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/usr/local/src/sysbench-0.4.12/doc/xsl'
make[2]: Leaving directory `/usr/local/src/sysbench-0.4.12/doc/xsl'
...
...
...
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench'
make[2]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench'
make[1]: Leaving directory `/usr/local/src/sysbench-0.4.12/sysbench'
make[1]: Entering directory `/usr/local/src/sysbench-0.4.12'
make[2]: Entering directory `/usr/local/src/sysbench-0.4.12'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/usr/local/src/sysbench-0.4.12'
make[1]: Leaving directory `/usr/local/src/sysbench-0.4.12'
[root@fc10-dev sysbench-0.4.12]#</pre>
<p>ตรวจสอบโปรแกรม sysbench ที่ถูกติดตั้ง ไว้ใน /usr/local/bin/</p>
<pre>[root@fc10-dev sysbench-0.4.12]# <strong>ls -l /usr/local/bin/
</strong>total 308
-rwxr-xr-x 1 root root 307952 2009-05-16 17:20 sysbench
[root@fc10-dev sysbench-0.4.12]#</pre>
<h4>ทดลองรัน sysbench</h4>
<p>ทดลองรัน sysbench โดยไม่ได้ระบุออปชั่น ถ้าคอมไพล์และติดตั้งถูกต้อง หน้าจอจะขึ้นวิธีการใช้ (usage) ขึ้นมา</p>
<p><strong>หมายเหตุ </strong>โดยดีฟอลต์จากการติดตั้งลีนุกซ์ส่วนใหญ่แล้ว /usr/local/bin/ จะอยู่ใน PATH อยู่แล้ว ทำให้เราไม่ต้องระบุ PATH เต็มๆ เวลารันไฟล์ ที่อยู่ใน /usr/local/bin/</p>
<pre>[root@fc10-dev sysbench-0.4.12]# <strong>sysbench</strong>
Missing required command argument.
Usage:
  sysbench [general-options]... --test=&lt;test-name&gt; [test-options]... command</pre>
<pre>General options:
  --num-threads=N            number of threads to use [1]
  --max-requests=N           limit for total number of requests [10000]
  --max-time=N               limit for total execution time in seconds [0]
  --forced-shutdown=STRING   amount of time to wait after --max-time before forcing shutdown [off]
  --thread-stack-size=SIZE   size of stack per thread [32K]
  --init-rng=[on|off]        initialize random number generator [off]
  --test=STRING              test to run
  --debug=[on|off]           print more debugging info [off]
  --validate=[on|off]        perform validation checks where possible [off]
  --help=[on|off]            print help and exit
  --version=[on|off]         print version and exit</pre>
<pre>Compiled-in tests:
  fileio - File I/O test
  cpu - CPU performance test
  memory - Memory functions speed test
  threads - Threads subsystem performance test
  mutex - Mutex performance test
  oltp - OLTP test</pre>
<pre>Commands: prepare run cleanup help version</pre>
<pre>See 'sysbench --test=&lt;name&gt; help' for a list of options for each test.</pre>
<pre>[root@fc10-dev sysbench-0.4.12]#</pre>
<h4>ลบไฟล์ที่คอมไพล์ (optional)</h4>
<p>หลังจากคอมไพล์และติดตั้งลงโปรแกรมไว้ใน /usr/local/bin/ แล้ว เราสามารถลบไฟล์ที่คอมไพล์ออกไปได้ เพื่อประหยัดพื้นที่ดิสก์</p>
<pre>[root@fc10-dev sysbench-0.4.12]# cd ..
[root@fc10-dev src]# <strong>rm -rvf sysbench-0.4.12/ sysbench-0.4.12.tar.gz
</strong>removed `sysbench-0.4.12/configure'
removed `sysbench-0.4.12/Makefile.in'
removed `sysbench-0.4.12/TODO'
removed `sysbench-0.4.12/install-sh'
removed `sysbench-0.4.12/aclocal.m4'
removed `sysbench-0.4.12/Makefile'
removed `sysbench-0.4.12/README'
removed `sysbench-0.4.12/autogen.sh'
removed `sysbench-0.4.12/sysbench/sysbench.o'
removed directory: `sysbench-0.4.12/sysbench/.libs'
removed `sysbench-0.4.12/sysbench/db_driver.c'
removed `sysbench-0.4.12/sysbench/sb_win.h'
...
...
...
removed directory: `sysbench-0.4.12/config'
removed `sysbench-0.4.12/libtool'
removed `sysbench-0.4.12/config.log'
removed `sysbench-0.4.12/Makefile.am'
removed `sysbench-0.4.12/README-WIN.txt'
removed directory: `sysbench-0.4.12'
removed `sysbench-0.4.12.tar.gz'
[root@fc10-dev src]#  ls -l
total 0
[root@fc10-dev src]#</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://sysbench.sourceforge.net/" target="_blank">System performance benchmark</a></li>
<li><a href="http://sourceforge.net/project/showfiles.php?group_id=102348&amp;package_id=109810" target="_blank">Download sysbench &#8211; SourceForge.net: System performance benchmark: Files</a></li>
<li><a href="http://sourceforge.net/forum/forum.php?thread_id=3137221&amp;forum_id=353124" target="_blank">Problem with compile on Centos 4.6</a></li>
<li><a href="ftp://www.mirror.in.th./fedora/releases/10/Everything/x86_64/os/Packages/" target="_blank">FC10 Everything (x86_64)</a></li>
<li><a href="http://spalinux.com/2009/05/sysbench_cpu_benchmark">sysbench วัดความแรงของ CPU</a></li>
<li><a href="http://spalinux.com/2009/05/compile_sysbench_on_solaris_10_x86">คอมไพล์ sysbench บน Solaris 10 (x86)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/05/%e0%b8%84%e0%b8%ad%e0%b8%a1%e0%b9%84%e0%b8%9e%e0%b8%a5%e0%b9%8c-sysbench-%e0%b8%9a%e0%b8%99-fedora-10/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ทดสอบความเร็วของฮาร์ดดิสก์ด้วยคำสั่ง dd</title>
		<link>http://spalinux.com/2008/05/test_hard_disk_by_dd</link>
		<comments>http://spalinux.com/2008/05/test_hard_disk_by_dd#comments</comments>
		<pubDate>Fri, 09 May 2008 20:44:29 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[Filesystem]]></category>

		<guid isPermaLink="false">http://vm8.wordpress.org/?p=15</guid>
		<description><![CDATA[บทความนี้ขอแนะนำวิธีการง่ายๆ ในการทดสอบความเร็วของฮารดดิสก์บนลินุกซ์ ด้วยคำสั่ง dd ทดสอบความเร็วในการเขียนไฟล์ขนาด 1GByte [root@linux ~]# dd if=/dev/zero of=filetest.bin bs=1000000 count=1000 1000+0 records in 1000+0 records out 1000000000 bytes (1.0 GB) copied, 3.96078 seconds, 252 MB/s ผลลัพธ์ที่ได้ 252 MB/s คือความเร็วที่สามารถเขียนไฟล์ลงฮาร์ดดิสก์ได้ ทดสอบความเร็วในการอ่านไฟล์ขนาด 1GByte [root@linux ~]# dd if=file1G-3.bin of=/dev/zero bs=1000000 count=1000 1000+0 records in 1000+0 records out 1000000000 bytes (1.0 GB) copied, 1.07976 seconds, 926 [...]]]></description>
			<content:encoded><![CDATA[<p>บทความนี้ขอแนะนำวิธีการง่ายๆ ในการทดสอบความเร็วของฮารดดิสก์บนลินุกซ์ ด้วยคำสั่ง dd</p>
<p><span id="more-15"></span></p>
<p>ทดสอบความเร็วในการเขียนไฟล์ขนาด 1GByte</p>
<p><code><br />
[root@linux ~]# <b>dd if=/dev/zero of=filetest.bin bs=1000000 count=1000</b><br />
1000+0 records in<br />
1000+0 records out<br />
1000000000 bytes (1.0 GB) copied, 3.96078 seconds, <b>252 MB/s</b><br />
</code></p>
<p>ผลลัพธ์ที่ได้ <b>252 MB/s</b> คือความเร็วที่สามารถเขียนไฟล์ลงฮาร์ดดิสก์ได้</p>
<p>ทดสอบความเร็วในการอ่านไฟล์ขนาด 1GByte</p>
<p><code><br />
[root@linux ~]# <b>dd if=file1G-3.bin of=/dev/zero bs=1000000 count=1000</b><br />
1000+0 records in<br />
1000+0 records out<br />
1000000000 bytes (1.0 GB) copied, 1.07976 seconds, <b>926 MB/s</b><br />
</code></p>
<p>ผลลัพธ์ที่ได้ <b>926 MB/s</b> คือความเร็วที่สามารถอ่านไฟล์จากฮาร์ดดิสก์ได้</p>
<p>เท่านี้เราก็สามารถเปรียบเทียบความเร็วของฮาร์ดดิสก์รุ่นต่างๆ ได้แล้ว</p>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/05/test_hard_disk_by_dd/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
