Untitled
title: Redis bytes_outRedis byteoutbyteout(或稱「bytes_out」) 表示 Redis 伺服器 送出給客戶端的資料量,也就是「Redis 從伺服器傳出去的流量」。
客戶端發請求 → Redis 回應資料
這些回應的資料(字串、結果、查詢內容)加起來的總位元組數,就是 byteout
Redis 的運作核心在於「記憶體內存取」+「網路通訊」。所有操作最終都透過 TCP 傳輸資料給客戶端。因此:
bytes_in:代表接收到的資料量(客戶端 → Redis)
bytes_out:代表傳送出去的資料量(Redis → 客戶端)
這兩者都是 Redis 網路 I/O 層的關鍵監控指標,能幫你了解 Redis 的流量負載情況。
本質上,byteout 高通常意味著:
回傳資料太大(例如 GET 很大的 value、LRANGE 取太多元素)
客戶端請求頻繁(流量大、QPS 高)
資料被重複讀取(Cache 未命中、熱點 Key 被重複讀)
可能有惡意或異常行為(例如攻擊者持續 Dump 資料)
切緩https://docs.google. ...
Untitled
title: High Availability (HA)HA(High Availability,高可用性)
HA 之前,先搞懂 Stateful vs Stateless✅ Stateless component 是什麼?像是:Application Server(AS)/ Nginx
特性是:不會保存任何「狀態」(state),也就是沒有 session、使用者資料、執行進度這些。
所以它可以橫向擴充(scale out)非常容易,想加幾台就加幾台,反正大家都是 stateless。
如何維持 HA(高可用)?
靠 heartbeat(心跳)機制判斷哪台死掉。
有問題就換台 server 接手即可。
✅ Stateful component 是什麼?像是:PostgreSQL / Kafka / RabbitMQ
這類會保存狀態資料,例如資料庫內的使用者資料、訊息佇列的訊息等。
所以要維持 HA,比起 stateless 難很多,因為 state 不能亂丟、不能亂同步。
二、Redis 是什麼?Stateless 嗎?如果 Redis 只是做 c ...
購物車初步篩選可用金流
系統架構核心流程裝置環境與 App 版本矩陣`PaymentServiceProvider` 解耦與版本分流`Express` 與 `PayPage` 的強制限縮黑名單會員的最終交集限制輸出 `EnablePayProfileTypeDef` 串接下游
.hl-hero{position:relative;overflow:hidden;border-radius:18px;padding:36px 40px;margin:0 0 30px;background:linear-gradient(160deg,#f4f2ec 0%,#eae8dc 65%,#e3dfcd 100%);border:1.5px solid #d7cfba;}
.hl-hero::after{content:"";position:absolute;top:-30px;right:-30px;width:120px;height:120px;border-radius:50%;background:radial-gradient(circle at 35% 35%,#c9403c,#8f1c1a);opaci ...
購物車資料結構解密:ShoppingCart 與 ShoppingCartExtendInfo
購物車延伸ShoppingCart:單列單品項明細表ShoppingCartExtendInfo:分組貼紙表兩表如何用外鍵串起來實際案例:三種商品型態讀取流程:程式怎麼拼回關聯重點回顧
.hl-hero{position:relative;overflow:hidden;border-radius:18px;padding:36px 40px;margin:0 0 30px;background:linear-gradient(160deg,#f4f2ec 0%,#eae8dc 65%,#e3dfcd 100%);border:1.5px solid #d7cfba;}
.hl-hero::after{content:"";position:absolute;top:-30px;right:-30px;width:120px;height:120px;border-radius:50%;background:radial-gradient(circle at 35% 35%,#c9403c,#8f1c1a);opacity:.16;}
.hl-hero .hh-tag{display: ...
Concurrency-safe
情境切入AtomicityIsolation方法一:鎖住 A方法二:Conditional UPDATE方法三:SerializableRDBMSDynamoDB 的差異總覽
.pg{
display:block;
font-family:'Segoe UI',-apple-system,BlinkMacSystemFont,'PingFang TC','Microsoft JhengHei',sans-serif;
background:
radial-gradient(700px 400px at 94% -6%, rgba(51,103,145,.10), transparent 60%),
radial-gradient(900px 500px at -6% 106%, rgba(28,28,28,.06), transparent 55%),
#fdfdfd;
color:#1c1f22!important;
line-height:1.75;
border-radius:20px;
padding:1px 0 28px;
margin:0 0 20px;
overflow: ...
Concurrency-safe
先看情境轉帳這種先查詢、再判斷、最後修改的邏輯,就算包在 BEGIN 與 COMMIT 之間,同時有兩筆請求進來時,餘額還是有可能算錯。原因不是 transaction 沒生效,而是 transaction 保證的東西,跟表面上看起來的並不完全一樣。
假設一開始有三個帳戶:
A:100 元
B:100 元
C:100 元
現在幾乎同時來了兩個請求,一個要從 A 轉 80 元給 B,另一個要從 A 轉 80 元給 C。應用程式常見的寫法是這樣:
1234567BEGIN;balance = SELECT balance FROM accounts WHERE id = 'A';IF balance >= 80 THEN UPDATE accounts SET balance = balance - 80 WHERE id = 'A'; UPDATE accounts SET balance = balance + 80 WHERE id = 'B';END IF;COMMIT;
另一個處理另一筆轉帳的執行 ...
Durability
總覽代價與取捨PostgreSQLMySQLSQL ServerMongoDBDynamoDBRedis
.hl{
display:block;
font-family:'Segoe UI',-apple-system,BlinkMacSystemFont,'PingFang TC','Microsoft JhengHei',sans-serif;
background:
radial-gradient(700px 400px at 92% -8%, rgba(190,38,35,.10), transparent 60%),
radial-gradient(900px 500px at -8% 108%, rgba(14,55,70,.10), transparent 55%),
#eae8dc;
color:#182228!important;
line-height:1.75;
border-radius:14px;
padding:1px 0 28px;
margin:0 0 20px;
overflow:hidden ...
商品
三層關係Listing與Selling時間欄位SalePageGiftProductStock庫存商品怎麼寫進購物車組合商品Bundle
.hl-hero{position:relative;overflow:hidden;border-radius:18px;padding:36px 40px;margin:0 0 30px;background:linear-gradient(160deg,#f4f2ec 0%,#eae8dc 65%,#e3dfcd 100%);border:1.5px solid #d7cfba;}
.hl-hero::after{content:"";position:absolute;top:-30px;right:-30px;width:120px;height:120px;border-radius:50%;background:radial-gradient(circle at 35% 35%,#c9403c,#8f1c1a);opacity:.16;}
.hl-hero .hh-tag{display:inline-block;font-size:. ...
Postgres - 1
起源與歷史設計思想趨勢Vector Database
.pg{
display:block;
font-family:'Segoe UI',-apple-system,BlinkMacSystemFont,'PingFang TC','Microsoft JhengHei',sans-serif;
background:
radial-gradient(700px 400px at 94% -6%, rgba(51,103,145,.10), transparent 60%),
radial-gradient(900px 500px at -6% 106%, rgba(28,28,28,.06), transparent 55%),
#fdfdfd;
color:#1c1f22!important;
line-height:1.75;
border-radius:20px;
padding:1px 0 28px;
margin:0 0 20px;
overflow:hidden;
--ink:#1c1f22; --sub: ...










