Use when a single DB row or Redis key becomes a hotspot (热点账户, 热点行, 爆款 SKU, 钱包余额行锁排队). Do not use as a substitute for ordinary stock WHERE stock>=n (backend-concurrency-sell) unless that row is the bottleneck.
Scanned 9/3/2026
Install to Claude Code
npx -y skills add 1398281322-a11y/java-backend-guardrails --skill hot-account --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Hot Account?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/1398281322-a11y-hot-account)More formats (shields.io, HTML) on the badges page.
---
name: hot-account
description: Use when a single DB row or Redis key becomes a hotspot (热点账户, 热点行, 爆款 SKU, 钱包余额行锁排队). Do not use as a substitute for ordinary stock WHERE stock>=n (backend-concurrency-sell) unless that row is the bottleneck.
---
# 热点账户 / 热点行
## When to Invoke
爆款 SKU 一行库存、商户钱包一行余额、全局计数器,InnoDB 行锁排队、RT 随并发线性变差。
## When NOT
普通多 SKU 扣减用条件更新即可。没测出单行瓶颈不要拆。缓存热点 → `cache-trap` / `redis-ops`。
## 风险(面试考点)
InnoDB 行锁在单行上串行。`UPDATE wallet SET bal=bal-n WHERE id=1 AND bal>=n` 正确但不快。分布式锁再包一层更慢。面试常让「热点账户」和「超卖」混在一起:超卖靠条件更新;热点靠 **拆行 / 排队 / 异步入账**。
## 方案选型(轻量优先)
| 优先级 | 方案 | 说明 |
|--------|------|------|
| 1 | 不拆,条件更新 | 并发不够高 |
| 2 | 分段库存 / 分片余额 | `stock_0..15`,下单哈希到一段 |
| 3 | 单账户单队列串行 | 钱包流水入 MQ,单消费者改余额 |
| 4 | 内存预扣 + 异步落库 | 秒杀;必须对账 |
分段后每段自己 `WHERE stock>=n`。卖完一段换段或汇总失败再试。
## 默认方案
```text
sku:{id}:seg:{0..15} Redis 预扣或 DB 16 行
下单:seg = userId % 16
扣减只打那一行
查询库存:SUM(seg) 或单独汇总键(最终一致)
```
钱包:禁止所有订单同步打同一 `merchant_id` 余额行。改成「流水表插入(唯一键)+ 异步汇总」或按日分片余额。
## 反例
错误:热点行上加 Redisson 锁再 `select` 改 `update`。
正确:先条件更新;仍排队再拆行。
错误:拆 16 段但不原子扣,只读汇总再减。
正确:每段独立条件扣。
## 验证
- 单 SKU 压测,拆段后 TPS 明显高于单行锁。
- 各段之和不错卖。
- 钱包流水不丢、不双花(唯一流水号)。
## 评审清单
- [ ] 先确认真是单行瓶颈
- [ ] 拆分后每段仍条件更新
- [ ] 有汇总/对账
---
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!
Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...
Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.
Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.
**Complete production-ready guide for Google Gemini embeddings API** This skill provides comprehensive coverage of the `gemini-embedding-001` model for generating text embeddings, including SDK usage, REST API patterns, batch processing, RAG integration with Cloudflare Vectorize, and advanced use cases like semantic search and document clustering. ---
Recovers prior coding-agent session context by running `catchup <agent> --since-compact`, which extracts a clean summary of a previous Codex, Claude Code, Antigravity, OpenCode, or Pi Agent session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", or asks to recover/summarize a previous session before continuing. Do NOT use for the current conversation, git history, or any non-agent log.