<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>負載平衡器 on 又LAG隨性筆記</title><link>https://www.lagagain.com/tags/%E8%B2%A0%E8%BC%89%E5%B9%B3%E8%A1%A1%E5%99%A8/</link><description>Recent content in 負載平衡器 on 又LAG隨性筆記</description><generator>Hugo -- gohugo.io</generator><language>zh-TW</language><lastBuildDate>Tue, 17 Nov 2026 06:30:00 +0800</lastBuildDate><atom:link href="https://www.lagagain.com/tags/%E8%B2%A0%E8%BC%89%E5%B9%B3%E8%A1%A1%E5%99%A8/index.xml" rel="self" type="application/rss+xml"/><item><title>Ch4 - 權重、優先級怎麼設？從百貨公司案例，看懂 APISIX 的負載平衡魔法！</title><link>https://www.lagagain.com/post/2025-it%E9%90%B5%E4%BA%BA%E8%B3%BD-apisix%E4%BD%BF%E7%94%A8%E7%B6%93%E9%A9%97%E5%88%86%E4%BA%AB08/</link><pubDate>Tue, 17 Nov 2026 06:30:00 +0800</pubDate><guid>https://www.lagagain.com/post/2025-it%E9%90%B5%E4%BA%BA%E8%B3%BD-apisix%E4%BD%BF%E7%94%A8%E7%B6%93%E9%A9%97%E5%88%86%E4%BA%AB08/</guid><description>&lt;blockquote>
&lt;p>本系列文章於2025年，已在&lt;a href="https://ithelp.ithome.com.tw/users/20112470/ironman/8791">iT邦幫忙：【與雲原生精靈共舞：APISIX使用者的兩年旅程】&lt;/a>發布過。&lt;/p>
&lt;/blockquote>
&lt;p>&lt;img src="https://i.ibb.co/N27FjLyB/20112470-Fd-Je-Ubs0d4.png" alt="SSO服務架構1-第 1 页.drawio">&lt;/p>
&lt;p>(What &amp;amp; Why)&lt;/p>
&lt;p>背景：公司的SSO服務原本是依辦公區域建立四組。再一次後來的調整與升級，將所有節點視作一個巨大群集，並且將原本的反向代理工具Nginx，替換成Apache APISIX。並且&lt;strong>希望在各自辦公區域的客戶端，優先使用該區域的服務節點&lt;/strong>。這該怎麼做到呢？&lt;/p>
&lt;h2 id="apisix的負載平衡設定-how">APISIX的負載平衡設定 (How)&lt;/h2>
&lt;p>讓我們把焦點只放在本系列主角APISIX負責任務上，它是怎麼設定負載平衡的？&lt;/p>
&lt;p>在前一天，「新竹百貨公司」的例子(已停用高乘載管制)，每次透過APISIX拜訪新竹百貨公司，都會被帶到新竹巨城、新竹SOGO、新竹大遠百、竹北大遠百任何一個。這種透過輪詢進行負載平衡的機制，叫做「Round Robin(RR)」。常見的機制還有「Least conn」和「CHash」&lt;/p>
&lt;p>&lt;img src="https://i.ibb.co/n8g1JDsb/201124706-Yoty8-ZFJD.png" alt="圖片">&lt;/p>
&lt;ul>
&lt;li>Least conn: 依照最少連線數量的，優先分配請求。&lt;/li>
&lt;li>CHash: 依照特定資訊進行Hash，進行分配請求。&lt;/li>
&lt;/ul>
&lt;p>Least conn並不那麼容易DEMO，所以只在特別DEMO 「CHash」：&lt;/p></description></item></channel></rss>