drain-a-load-balancer-node
Use when taking a node out of a load balancer pool for deploy, upgrade, or maintenance. Deregister first and wait for in-flight requests and connection reuse to finish before stopping the process, so no request lands on a dead node.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- drain-a-load-balancer-node
- description
- Use when taking a node out of a load balancer pool for deploy, upgrade, or maintenance. Deregister first and wait for in-flight requests and connection reuse to finish before stopping the process, so no request lands on a dead node.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md352 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Drain a load balancer node
Stopping a node the moment it is deregistered cuts live requests: the pool has stopped sending new traffic, but keep-alive clients and in-flight requests still point at it. Drain, then stop.
Procedure
- Fail the node's health check first so the balancer stops routing to it:
Or flip the health endpoint to return 503 for the drain window.curl -sf -X POST http://localhost:9000/admin/drain # app-specific drain endpoint - Deregister at the balancer and note the change:
aws elbv2 deregister-targets --target-group-arn "$TG" --targets Id=i-0abc123 aws elbv2 describe-target-health --target-group-arn "$TG" --targets Id=i-0abc123 \ --query 'TargetHealthDescriptions[].TargetHealth.State' - Wait for
drainingto becomeunused— this is the balancer's own drain timer, default 300 s on ALB. Do not stop the process until the state isunused:aws elbv2 describe-target-health --target-group-arn "$TG" --targets Id=i-0abc123 \ --query 'TargetHealthDescriptions[0].TargetHealth.State' - Confirm no active connections remain on the node (see
inspect-tcp-connection-states):ss -tan state established '( sport = :8080 )' | wc -l - Only now stop the service, with a graceful-stop timeout that outlasts the longest request:
systemctl stop myservice # TimeoutStopSec must exceed your p99 request time - For a rolling deploy, drain and re-add one node at a time, keeping the pool above the capacity floor so failover headroom survives the whole rollout.
- On re-add, verify the node passes health checks before moving to the next one.
Pitfalls
- Stopping immediately after deregistering kills in-flight requests; the drain timer exists for a reason.
- Client-side connection pools and HTTP/2 keep-alive hold connections open past the LB drain timer.
- A health check path that always returns 200 (no dependency checks) marks a broken node healthy.
- Draining all nodes "in parallel" empties the pool and causes a full outage.
- Server-Sent Events or websocket traffic can pin a connection open indefinitely and block drain completion.
- If the app deregisters itself on SIGTERM but the LB has a shorter drain timer, requests still get cut.
Verification
aws elbv2 describe-target-health --target-group-arn "$TG" --targets Id=i-0abc123 \
--query 'TargetHealthDescriptions[0].TargetHealth.State'
# expect "unused" before the process is stopped
Report: "Node i-0abc123 drained to unused at 12:04, established connections hit 0, service stopped
12:05; pool stayed at 3/4 healthy throughout."
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.