2004/Aug/13

ผมพบว่า Developer ส่วนใหญ่ไม่ค่อยเข้าใจความแตกต่างของ Cluster และ Load Balance เนื่องจากจะได้คำถามประมาณว่า ถ้า Server ทำเป็น Cluster แล้วจะทำ Load Balance แบบ Sticky ดีหรือเปล่า อยู่บ่อยๆ ดังนั้นวันนี้ผมจะมาไขข้อข้องใจของหลายๆคนนะครับ

Clustering คือการจัดกลุ่มของคอมพิวเตอร์หลายๆตัวเพื่อให้สามารถทำงานได้เหมือนกับเป็นคอมพิวเตอร์ตัวเดียวกัน

ดังนั้นไม่ว่า User เข้ามาใช้งานเครื่องใดภายในกลุ่มก็จะรู้สึกเหมือนใช้งานคอมพิวเตอร์เครื่องเดียวกัน คุณสมบัติสำคัญของการทำ Clustering คือการทำ Replication โดยในแง่ของ Web Application คือการทำ Session Replication ซึ่งตามปกติแล้ว Session ของ User จะถูกจัดเก็บใน Web Server เครื่องที่ User กำลังใช้งานอยู่เท่านั้น แต่การทำ Clustering จะเป็นการคัดลอก (Replicate) Session นั้นไปยัง Web Server อื่นภายในกลุ่มด้วย ทำให้ไม่ว่า User เข้าไปใช้งานใน Server เครื่องใดก็จะมี Session ของ User อยู่ด้วยเสมอ

Load balancing คือการจัดกลุ่มของคอมพิวเตอร์หลายๆตัวเพื่อแบ่งงานกัน หรือกระจาย load การใช้งานของ user ไปยังคอมพิวเตอร์ภายในกลุ่ม เพื่อให้สามารถรับจำนวน user ที่เข้ามาใช้งานได้มากขึ้น หรือสามารถรับงานที่เข้ามาได้มากขึ้น นอกจากนั้นยังมีคุณสมบัติของ Fail Over คือหากมีคอมพิวเตอร์ภายในกลุ่มไม่สามารถทำงานได้ เช่น Down อยู่ หรือไม่สามารถรับงานหรือuserเพิ่มได้เนื่องจาก resource ที่ใช้ทำงานไม่พอ ตัว Load Balancer ที่เป็นตัวแจก load ให้คอมพิวเตอร์ภายในกลุ่มก็จะส่ง load ไปยังคอมพิวเตอร์เครื่องอื่นๆแทน จนกว่าคอมพิวเตอร์เครื่องนั้นจะกลับมาใช้งานได้ใหม่

การทำงานของ Load Balancer นั้นมี 3 ลักษณะด้วยกันได้แก่
1. Round-robin เป็นการส่ง traffic ไปยัง Server ภายในกลุ่มวนไปเรื่อยๆ
2. Sticky เป็นการส่ง traffic โดยยึดติดกับ Session ที่ user เคยเข้าไปใช้งาน เช่น ถ้า user เคยเข้าไปใช้ใน server ที่ 1 ภายในกลุ่ม traffic ของ user คนนั้นก็จะถูกส่งไปยัง server 1 เท่านั้น
3. Work load เป็นการส่ง traffic โดยดูที่ performance ของ server ภายในกลุ่มเป็นสำคัญ เช่นหาก server 1 มีงานมากกว่า server 2 ตัว load balancer ก็จะส่ง traffic ไปยัง server 2

การทำ Cluster Load Balance คือการผสมผสานการทำงานทั้งสองลักษณะเข้าด้วยกัน แต่หากจะเลือกใช้การทำงานแบบนี้แล้ว การใช้ Load Balance แบบ Sticky ก็จะไม่มีความหมายไป เนื่องจาก ทุกๆ Server ภายในกลุ่มเป็น Cluster กันอยู่แล้ว ดังนั้นจึงไม่มีเหตุผลใดที่จะส่ง Traffic ไปให้เครื่องเดิมเสมออีก ควรจะทำ Load Balance แบบ Round-robin หรือ Work load แทน

อย่างไรก็ดีการทำ Cluster ไม่จำเป็นต้องพึ่ง Feature ของ Server เป็นหลัก แต่เราสามารถ Develop ตัว Application ให้เป็น Cluster เองได้ โดยไม่ต้องพึ่ง Feature ของ Server เช่น การใช้หลักการของ File Sharing หรือ Database เข้ามาช่วยก็สามารถทำงานได้เหมือนกัน เช่นเดียวกับการทำ Load Balance เราไม่จำเป็นต้องหา Hardware หรือ Software พิเศษที่จะทำหน้าที่เป็น Load Balancer แต่เราสามารถเขียน Application เพื่อทำการกระจาย Traffic ไปยัง Server ต่างๆได้เหมือนกัน โดยใช้หลักการของ Redirection เป็นต้น

ชื่อ: 
เว็บไซต์: 
Captcha: 
คอมเมนต์:




smilebig smileopen-mounthed smileconfused smilesad smileangry smiletonguequestionembarrassedsurprised smilewinkdouble winkcry
ขอบคุณครับ
#1  by  impboy At 2004-08-13 14:27, 
ขอบคุณครับพี่บอมบ์เบอร์ ... ละเอียดดี (บางเรื่องผมก็ไม่รู้จักเลย 555)
#2  by  iwat At 2004-08-16 00:13, 
ละเอียดดีครับ ผมยังแยกความแตกต่างไม่ออกเลยครับ
#3  by  plynoi แว่วศรี At 2004-08-16 22:13, 
เมื่อไหร่จะมีบทความใหม่ครับ
แอบอ่านมานาน ภาวนาเอาใจช่วยให้มีเวลาว่างเร็วๆ
#4  by  dog mulder At 2005-04-01 11:08, 
แอธๆๆ อยากได้เนื้อหาเยอะก่านี้อะ
#5  by  พี (202.91.23.1) At 2005-04-29 13:44, 
มี link ที่แนะนำวิธีการ implement Cluster หรือ Load Balance โดยไม่ต้องใช้ hardware หรือ software มั๊ยครับ อยากได้ข้อมูลเพิ่มเติม ไปค้นคว้าต่ออีกหน่อยน่ะครับ
ขอบคุณครับ
ปล. อยากถามว่าหลักการทำ Cluster Load Balance สามารถนำมา apply เพื่ิิอ implement ระบบ Single Sign-on ได้หรือเปล่าครับ แนะนำหน่อยนะครับ
#6  by  Tsubasa (202.183.215.219) At 2005-09-12 08:59, 
ขอบคุณสำหรับเนื้อหาดีๆ นะครับ
#7  by  CP-HOME At 2005-09-27 12:37, 
อ่านแล้วได้ความรู้ดีมาก

ฝากเว็บไซต์ด้วย
http://www.sontayamyblog.com

ทุกเรื่องของการคอนฟิก Linux Server
#8  by  sontayamyblog.com (203.152.41.4 /unknown, 192.168.1.10, 203.121.156.35) At 2007-03-24 17:34, 
Hello! Good Site! Thanks you! vaywpsoohfe
#9  by  wsfqxyylir (217.159.190.94) At 2008-01-30 04:07, 
จำเป็นป่าวครับ ว่าต้องใช้กับ Renuxe อย่างเดียว
#10  by   (58.64.69.114) At 2009-01-14 03:42, 
น่าจะอ้างอิงถึงผู้เขียนหน่อยนะ
นายฆอซาลี หีมสุหรี
นางสาวภาราดา โตอุรวงศ์
นางสาวชญาน์ภักดิ์ สุพรรณ์

รุ่น MIT 9

นักศึกษาหลักสูตรวิทยาศาสตรมหาบัณฑิต (การจัดการเทคโนโลยีสารสนเทศ)
สำนักวิชาสารสนเทศศาสตร์ มหาวิทยาลัยวลัย
#11  by  ผู้เขียน (125.24.137.39) At 2009-03-18 20:54, 
#12  by   (118.172.68.236) At 2009-07-06 09:57, 
ไม่ดีๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆangry smile angry smile tongue
#13  by  มนตรี (202.149.25.235) At 2009-11-05 20:30, 
ขอบคุณมากนะคะ
สำหรับความรู้ที่ดีมากๆค่ะ...^-^
#14  by   (61.90.147.248) At 2011-08-26 16:13, 
หาข้อมูลไป present อยู่พอดีเลย ขอบคุณมากครับ
#15  by  Firedub (110.77.137.90) At 2011-08-30 10:44, 
I received my first <a href="http://goodfinance-blog.com/topics/business-loans">business loans</a> when I was a teenager and this helped my business a lot. However, I need the financial loan over again.
#16  by  EllenCarver28 (91.212.226.143) At 2011-11-07 22:40, 
That’s hands-down to buy an essay and lots of people don’t get know that the great ideas just about this postcould subsist and because of it people buy research papers.
#17  by  buy essays (193.105.210.41) At 2011-11-16 08:29, 
Students have an access order the buy a research paper and buy essay at the research paper writing services about this topic.
#18  by  buy essay (193.105.210.41) At 2011-11-16 09:13, 
Are not acknowledged of search engine ADWords options? Wish to have high speed for your site? I know that traffic optimization issue is not simple to do independently, however, the directory submission services can do it for low costs!
#19  by  quality directory submission services (193.105.210.41) At 2011-11-21 12:47, 
A lot of people have to make a choise 'tween buy dissertation service and thesis writing services to opt for dissertation international more or less about this topic.
#20  by  dissertation writing service (91.212.226.143) At 2011-11-22 10:22, 
Different people have to treat thesis summary referring to this post in a right way, because they would need it a buy dissertation service in future.
#21  by  buy thesis (91.212.226.143) At 2011-11-24 09:52, 
Your knowledge close to this good topic seems to be perfect and different scholars would take it for their english dissertation. And some of scholars still take the assistance of dissertation service.
#22  by  dissertation writing (91.212.226.143) At 2011-11-24 09:52, 
Your study year is ending and you have got a lot of stuff to cope with? Do not have enough time to do it? The essay writing service can be ready help you with academic assignments creating guaranteed!
#23  by  pay for writing essay (31.184.236.16) At 2011-12-22 15:24, 
The text just about this good post was used by custom writing service to have a possibility to buy essay and custom writing.
#24  by  buy custom essay papers (31.184.238.21) At 2012-01-10 09:46, 
I think that people must get know about this good topic and essay writing. At the writing service that’s easy to order written essay and custom essay about this topic.
#25  by  custom essays (31.184.238.21) At 2012-01-11 11:18, 

<< Home