mz-benchmark
БесплатноБез исполняемых скриптовНе проверенAdd/modify/debug Materialize perf benchmark scenarios. Three frameworks: Feature Benchmark (single-op micro), Scalability Test (SQL throughput under…
от MaterializeInc★ 6 417 звёзд на GitHubОб этом скилле
Benchmark Frameworks
Materialize has some benchmark frameworks targetting local Docker, each suited to different performance concerns. Choose the right one based on what you're measuring.
Decision Guide
| Concern | Framework | Best For |
|---|---|---|
| Single-operation latency | Feature Benchmark | "How fast is this SELECT / INSERT / CREATE INDEX?" |
| SQL throughput under concurrency | Scalability Test | "How many QPS can we sustain at 1/4/16/64/256 concurrent clients?" |
| Sustained performance over time | Parallel Benchmark | "Does latency degrade over a 2-minute mixed workload?" |
A Rust cargo bench target must reference the production allocator with a
mz-alloc-default dev-dependency and use mz_alloc_default as _; (see
src/repr/benches/row.rs). Without it the bench runs on the system allocator,
not jemalloc.
Scalability Test and Parallel Benchmark connect with psycopg 3 and leave
prepare_threshold at its default of 5, so a query switches to a prepared
statement on its sixth execution per connection. Set it explicitly and warm
connections up when per-query latency matters.
1. Feature Benchmark (Micro-benchmarks)
Measures wall-clock time of individual SQL operations without concurrency. Uses testdrive fragments. Great for regression-testing specific code paths.
How to Add a Scenario
- Add a class in one of the
scenarios/*.pyfiles. ExtendScenario(default, runs in CI),ScenarioBig(longer, opt-in), orScenarioDisabled. - Implement
benchmark()returning aTd(...)with timing markers (/* A */and/* B */). - Optionally implement
shared(),init(),before()if setup is required.
Scenario Template
from materialize.feature_benchmark.action import TdAction
from materialize.feature_benchmark.measurement_source import MeasurementSource, Td
from materialize.feature_benchmark.scenario import Scenario
class MyCategory(Scenario):
"""Group parent - won't run (not a leaf)."""
pass
class MySpecificBenchmark(MyCategory):
"""Leaf class - this runs."""
def init(self) -> list[TdAction]:
return [
self.table_ten(), # Creates table 'ten' with values 0-9
TdAction("""
> CREATE TABLE t1 (f1 INTEGER);
> INSERT INTO t1 SELECT {unique_values} FROM {join};
> SELECT COUNT(*) FROM t1;
{n}
""".format(
unique_values=self.unique_values(),
join=self.join(),
n=self.n(),
)),
]
def benchmark(self) -> MeasurementSource:
return Td("""
> SELECT 1;
/* A */
1
> SELECT COUNT(*) FROM t1 WHERE f1 % 2 = 0;
/* B */
{half_n}
""".format(half_n=self.n() // 2))
Timing Markers
/* A */- Start marker. Measurement begins AFTER this completes./* B */- End marker. Measurement ends when this completes.- Measures: time from end of A to end of B.
- For a single query, use
SELECT 1; /* A */as a dummy start to not measure the overhead of Testdrive starting up.
Scenario Phases (execution order)
shared()- Runs once for BOTH instances (e.g., create Kafka topics)init()- Runs once per instance (create tables, populate data)before()- Runs before EACH iteration (restart, cleanup)benchmark()- Runs repeatedly, measured
The result is the minimum (MinAggregation) after discarding the first 3
measurements. ProbForMin(threshold=0.90) in
test/feature-benchmark/mzcompose.py can end a scenario after 6 measurements,
so the verdict can rest on 3 values and one outlier can flip it. Read the raw
per-iteration values before trusting a regression or improvement.
The measured cluster cluster_default is an unmanaged replica on the
clusterd container, configured by the Clusterd(...) service in
create_clusterd_service. That function maps enable_unified_cluster onto
the service, but other parameters that shape the replica process do not reach
it. For example, enable_timely_zero_copy has no effect because Clusterd
hardcodes its timely config.
Helpers
self.n()- Returns 10^SCALE (default SCALE=6 → 1,000,000)self.table_ten()/self.view_ten()- Creates table/view with values 0-9self.unique_values()- SQL expression generating N unique values via cartesian productself.join()- SQL FROM clause for cartesian product joinsself.keyschema()/self.schema()- Kafka schema helpers
Tips
- Aim for ~1 second query time. Too fast = noise; too slow = Unbearably slow CI.
- Test td fragments locally with standalone testdrive before running the full benchmark.
- Use
SCALEto control data volume:SCALE = 5→ 100K rows. - Use
FIXED_SCALE = Trueif--scaleshould not affect your scenario. This is usually done when a scenario doesn't scale well, add an explanation. - Use
RELATIVE_THRESHOLDto customize regression sensitivity per scena
Установить mz-benchmark в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл mz-benchmark?
Add/modify/debug Materialize perf benchmark scenarios. Three frameworks: Feature Benchmark (single-op micro), Scalability Test (SQL throughput under concurrency), Parallel Benchmark (sustained latency via scenarios.py). Trigger: "benchmark", "feature benchmark", "scalability test", "parallel benchmark", "performance regression", "micro-benchmark", "TPS", "latency test", or edits in feature_benchmark/scenarios/, scalability/workload/workloads/, parallel_benchmark/scenarios.py. Note: measurement, not panic-stress (see mz-parallel-workload).
Как установить скилл mz-benchmark?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл mz-benchmark запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic