Skip to main content

How Tenson Works Under the Hood

1. Weighted Redis ZSET Routing & Lua Slot Lock​

Every 5-second worker heartbeat recalculates node score in pool:model:{model_id}:

Text
Score = (Reputation_Score * 0.50) + (Normalized_TPS * 0.30) + (Region_Bonus * 0.10) - (Normalized_Latency_ms * 0.10)

Nodes with reputation_score < 60.0 are automatically quarantined. Concurrent gateways reserve slots atomically via EVALSHA acquire_slot.lua.

2. Failover State Machine​

  • 3,000ms Pre-TTFT Watchdog: Cancels stalled Node A (job_cancel), penalizes reputation -2.0, and silently retries Node B (up to 2 retries) with zero buyer error.
  • Mid-Stream Disconnect: Terminates SSE with finish_reason: "error", refunds 100% of buyer escrow, and penalizes Node A -5.0.
  • Cold-Start Centralized Fallback: Transparently overflows when a model pool has 0 free slots to preserve 99.9% SLA.

3. Zero-Log Privacy & Optimistic GPU Audits​

Raw prompts never touch PostgreSQL or disk logs. On job_complete, 3% of jobs (15% for new nodes with <100 jobs) are buffered in volatile Redis RAM (TTL 300s), replayed on canonical reference GPUs, and deleted immediately upon verdict. Confirmed spoofers are banned with 100% stake slashed.