You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Gate vttablet conn pools with Snake load shedder (#864)
* Gate OLTP read pool with Snake load shedder
Wire the CoDel-based Snake gate into QueryExecutor.getConn() so that
OLTP read requests are admitted or shed before consuming a MySQL
connection. Controlled by --snake-enabled flag (off by default).
ContentionID is extracted from the unique_id SQL margin comment that
webapp injects, with a random 16-char hex fallback for requests
without one.
AI disclosure: Claude Code assisted with development. Every line of code was either written by or carefully reviewed by me :)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Brett Wines <bwines@slack-corp.com>
* Use proto UniqueId as Snake contentionID, bypass valve when unset
Replace the extractUniqueID regex (which targeted a comment format
webapp never sends) with the proto-based approach: read
qre.options.GetUniqueId() and only enter the Snake gate when it's
non-empty. Requests without a unique_id bypass the gate entirely
rather than sharing a single valve slot or using random IDs.
Add `string unique_id = 22` to ExecuteOptions in proto/query.proto.
This is an optional field — callers that don't set it get zero-cost
bypass. The sqlparser/vtgate propagation to populate it from SQL
directives is deferred to a follow-up PR.
AI disclosure: Claude Code assisted with development. Every line of code was either written by or carefully reviewed by me :)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Brett Wines <bwines@slack-corp.com>
* Gate DML with Snake load shedder (#871)
Acquire a Snake slot in TxPool.Begin (for fresh connections only,
not reserved conns) and release it in txComplete. This gates both
autocommit and explicit transaction DML through the same CoDel-based
load-shedding mechanism already used for the OLTP read pool.
Requests without a unique_id bypass the gate entirely, matching the
OLTP-read behavior.
AI disclosure: Claude Code assisted with development. Every line of code was either written by or carefully reviewed by me :)
Signed-off-by: Brett Wines <bwines@slack-corp.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
---------
Signed-off-by: Brett Wines <bwines@slack-corp.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
fs.BoolVar(¤tConfig.EnablePerWorkloadTableMetrics, "enable-per-workload-table-metrics", defaultConfig.EnablePerWorkloadTableMetrics, "If true, query counts and query error metrics include a label that identifies the workload")
224
225
225
226
fs.BoolVar(¤tConfig.Unmanaged, "unmanaged", false, "Indicates an unmanaged tablet, i.e. using an external mysql-compatible database")
227
+
228
+
fs.BoolVar(&enableSnake, "snake-enabled", false, "If true, enables CoDel-based load shedding (Snake) on the OLTP read pool.")
229
+
fs.DurationVar(¤tConfig.SnakeTarget, "snake-target", 5*time.Millisecond, "CoDel target delay for the Snake load shedder.")
230
+
fs.DurationVar(¤tConfig.SnakeInterval, "snake-interval", 100*time.Millisecond, "CoDel interval for the Snake load shedder.")
0 commit comments