Release path: rollback only; throttle prunes; gate exit gc; 5s timeout sweep - #17
Merged
Merged
Conversation
Production still showed 45 SET-pairs/s: resetConnection() re-issued SET SESSION TRANSACTION ISOLATION + SET autocommit on every release, though nothing in a request can change either - transactions restore autocommit themselves, and the isolation level only needs setting when a server session is genuinely new. Release now only rolls back; normalizeSession() covers the two real new-session moments (creation and the reconnector's PDO swap - the latter was a gap), and does it in one round trip instead of two. The coroutine-exit defer ran a process-global gc_collect_cycles before every release walk; the roots buffer is almost never empty under load, so this was a full cycle-collection per DB request even when the Worker had already released everything. It now returns early when the coroutine holds no pooled connections. pruneIdleConnections() ran up to three times per request (checkout, release, worker sweep), each paying a weakref reconcile plus a full channel drain-and-refill - and a concurrent checkout that yields into the drained channel creates a connection it never needed. Opportunistic prunes are now throttled to once per prune_interval (default 1s); the heartbeat stays the primary pruner. Checkout also skips the 1ms channel pop when nothing is pooled. The request-timeout sweep ticked every 1s over the whole timer table; it now defaults to 5s (octane.swoole.timeout_sweep_interval_ms), costing at most 5s of timeout precision on 120-240s budgets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four production findings from the profiler/DB audit, one PR:
transaction_isolation(MDEV-21921) so that driver keeps the standard-SQL form — verified against MariaDB 10.11/11.4 + MySQL 8.0 in review.octane.swoole.timeout_sweep_interval_ms, clamped ≥1000): ≤5s overrun on 120–240s budgets.E2E on a real Swoole server vs local MySQL: 213 → 10 SET statements per 100 requests (−95%), 100/100 success. Suite: 179 green; five mutation tests pin the guards. Adversarially reviewed; its MariaDB, false-exhaustion, clamp, and comment findings are all incorporated.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.