STM - Senior¶
STM trades lock management for optimistic conflicts. Hot variables can cause repeated aborts, wasted CPU, unfairness, and retry storms.
flowchart LR
Hot[Hot transactional variable] --> Conflicts
Conflicts --> Retries
Retries --> MoreLoad[More CPU load]
MoreLoad --> Conflicts
| Symptom | Action |
|---|---|
| high abort ratio | partition hot state |
| long transactions | compute outside, validate inside |
| writer starvation | use contention management or a lock |
| large read sets | narrow transaction scope |
| repeated effects | move I/O after commit with an outbox |
Track commits, aborts by cause, retries per transaction, transaction duration, and hottest variables. Compare with a mutex baseline; STM is not automatically faster.
Continue to professional.md.
Test yourself¶
- How does a hot variable create a retry storm?
- Which metric tells you STM is wasting CPU?
- When should you replace STM with a lock or partitioning?