Optimization Best Practices
A condensed summary of the 25 most important transaction optimization practices drawn from every page in this section.
-
Simulate every mainnet template: Read
unitsConsumedand errors before send (Estimating Compute Units). -
Set compute unit limit with headroom: 110% of simulated CU minimum.
-
Compute budget instructions first:
set_compute_unit_limitandset_compute_unit_priceprecede program ixs (Transaction Assembly). -
Dynamic priority fees on mainnet: Target p75-p90 with hard cap (Setting Priority Fees).
-
Refresh fees per send batch: Stale samples underprice during spikes.
-
Track signature status:
sendTransactionsuccess is not landing (Why Transactions Fail to Land). -
Use WebSocket confirmation:
signatureNotificationsbeats tight polling loops. -
Retry with fresh blockhash: Re-sign after expiry; do not infinite rebroadcast stale txs (Retries & Blockhash Management).
-
Respect lastValidBlockHeight: Stop rebroadcasting dead signatures.
-
Use v0 + ALTs for large metas: Legacy size failures are silent drops (Address Lookup Tables in Practice).
-
Wait ALT activation slot: After extend before compiling v0 message.
-
Idempotent ATA creates in same tx: Reduces multi-transaction partial failure.
-
Provider RPC for sends: Public RPC drops packets under load.
-
skipPreflight false by default: Catch errors before burning user trust.
-
Cap maximum priority fee: Protect users from fee spikes.
-
Show all-in fee estimate: Base + priority + (optional) Jito tip in UI.
-
Jito bundles for competitive mints: Atomicity + tip when native path fails SLO (Jito Bundles).
-
Simulate bundles before send: Reduce failed bundle submission rate.
-
Do not retry landed failures: Fix program/account issue first.
-
Idempotent on-chain effects: Retries safer when blockhash changes.
-
Profile CU in LiteSVM/local validator: Catch regressions before mainnet.
-
Surfpool simulate DeFi paths: Mainnet-fork accuracy for complex routes.
-
Monitor landing rate SLO: Alert when confirmation p95 degrades.
-
Document landing playbook: Incident runbook for mint day congestion.
-
Devnet does not prove mainnet landing: Validate policy with dust mainnet probes.
FAQs
Minimum viable landing stack?
Simulate CU + dynamic priority fee + confirmed subscription + blockhash retry with cap.
When are Jito bundles mandatory?
Never mandatory - adopt when native path misses SLO during peak events.
How do optimization and RPC practices connect?
getRecentPrioritizationFees and simulateTransaction are RPC concerns - see RPC Best Practices.
Related
- Why Transactions Fail to Land - failure modes
- Setting Priority Fees - fee tuning
- Transactions Not Landing - incident response
- Priority Fees - fundamentals
Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, anchor-lang 0.32.1, Rust 1.91.1, @solana/kit 7.0.0, Surfpool 0.12.0, and LiteSVM 0.6.x.