NexusDB is excited to announce Transaction Priority and Preemption, a powerful new capability that gives you fine-grained control over how concurrent transactions compete for resources. Available right now in the shiny new v4.7520 release!
The Problem
In busy multi-user environments, not all transactions are created equal. A point-of-sale terminal processing a customer payment should never be held up by a long-running analytics query. Until now, resolving these conflicts meant relying on timeouts and retries ? a blunt instrument for a nuanced problem.
The Solution
NexusDB now supports priority-aware lock management with automatic preemption. Each transaction can be assigned a priority level, with optional scheduled priority adjustments that activate after a configurable delay. When a higher-priority transaction needs a lock held by a lower-priority one, the lower-priority transaction is automatically rolled back and the higher-priority transaction proceeds ? no manual intervention required.
How It Works
Transactions start at a default priority and can be configured to adjust after a set delay
Higher-priority transactions automatically preempt lower-priority lock holders
The priority-sorted wait queue ensures the most important work is processed first
Equal-priority transactions continue to use standard wait/timeout behavior ? preemption only occurs when there is a strict priority differential
Real-World Examples
Point of Sale: Configure transactions to escalate priority after 2 seconds. If a POS transaction is blocked by a less critical operation, it automatically takes precedence ? keeping your checkout lines moving.
Ad-hoc & GraphQL Queries: Assign queries a negative priority adjustment so they gracefully yield to operational workloads, eliminating the risk of a reporting query blocking business transactions.
Standard ERP Operations: Leave priority at default. Short transactions complete normally before any escalation takes effect.
Designed for the Real World
The delayed priority adjustment is key to the design. Most transactions complete quickly and never need preemption at all. The configurable delay lets short operations finish at equal priority under normal conditions, while ensuring that genuinely blocked critical transactions get the priority they need ? automatically.
Getting Started
Priority and preemption are available now through the StartTransaction[With] methods with three additional parameters: initial priority, delay, and priority delta. No schema changes, no configuration files ? just smarter transaction management out of the box. Oh, and the new parameters are optional - your current system wonβt change behaviour unless you explicitly say so. See the new LOCKING_USER_GUIDE.md file in the \Documentation folder of your installation for the nitty gritty details.
Weβd love to hear how you plan to use transaction priority in your applications. As always, reach out to us with any questions. Our Telegram Peer to Peer channel is always open (invite link below):
https://t.me/joinchat/GBjW8w3TWC2-NzzkS1dR_Q
Happy coding,
The NexusDB Team