Skip to content

[Performance] Reduce Redis round-trips in transcription update hot path #26

@SeanGau

Description

@SeanGau

背景

_process_transcription_update 高頻呼叫時,存在多次 Redis 讀寫(含重複取 last committed),增加 RTT 與 event-loop 壓力。

影響

  • partial 高頻情境下延遲上升
  • Redis QPS 偏高
  • 吞吐下降

目標

將 hot path Redis 操作整併為最少 round-trips,降低延遲與資源消耗。

實作建議

  • 合併讀取操作到單一 pipeline
  • 將 last committed 查詢與寫入邏輯一起規劃,避免重複 zrange
  • 明確區分 partial / committed 路徑,減少不必要讀取
  • 加上簡單 metrics(每事件 Redis calls、處理耗時)

驗收條件

  • 每次 sync 平均 Redis 命令數下降
  • p95 處理延遲下降(以壓測或樣本數據證明)
  • 不改變對外行為(資料一致性與排序正確)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions