fix(hicache): add retry logic for MooncakeStore warmup (#17195)

Co-authored-by: Teng Ma <sima.mt@alibaba-inc.com>
Co-authored-by: Zhiqiang Xie <xiezhq@stanford.edu>
This commit is contained in:
chenkaiyue
2026-04-27 18:50:43 -07:00
committed by GitHub
co-authored by Teng Ma Zhiqiang Xie
parent 3177fa7951
commit 3066ba8167
@@ -389,13 +389,15 @@ class MooncakeStore(HiCacheStorage, MooncakeBaseStore):
)
logger.info("Mooncake store setup successfully.")
self.local_rank = (
storage_config.tp_rank if storage_config is not None else 0
)
self.warmup()
logger.info("Mooncake store warmup successfully.")
self.enable_storage_metrics = False
if storage_config is not None:
self.is_mla_backend = storage_config.is_mla_model
self.local_rank = storage_config.tp_rank
self.pp_rank = storage_config.pp_rank
self.pp_size = storage_config.pp_size
self.attn_cp_rank = storage_config.attn_cp_rank
@@ -483,7 +485,26 @@ class MooncakeStore(HiCacheStorage, MooncakeBaseStore):
def warmup(self):
warmup_key = "sglang_mooncake_store_warmup_key" + uuid.uuid4().hex
warmup_value = bytes(4 * 1024) # 4 KB
assert self.store.put(warmup_key, warmup_value) == 0
# Retry logic to handle Transfer Engine startup race condition
max_retries = 10
retry_delay = 1.0 # seconds
for attempt in range(max_retries):
ret = self.store.put(warmup_key, warmup_value)
if ret == 0:
break
logger.warning(
f"[TP{self.local_rank}] Warmup put failed (attempt {attempt + 1}/{max_retries}), "
f"ret={ret}, retrying in {retry_delay}s..."
)
time.sleep(retry_delay)
else:
raise RuntimeError(
f"[TP{self.local_rank}] Warmup put failed after {max_retries} attempts, "
"Transfer Engine might not be ready"
)
assert self.store.is_exist(warmup_key) == 1
assert self.store.get(warmup_key) == warmup_value