(improvement) unit tests for benchmarking query planning.#653
(improvement) unit tests for benchmarking query planning.#653mykaul wants to merge 1 commit intoscylladb:masterfrom
Conversation
b9a8faa to
a797262
Compare
|
Latest commit add Host policy. Now it looks like this: |
|
@mykaul , thanks looks great, can you implement them in pytest and mark with |
a797262 to
d850f81
Compare
There is no pytest.ini, so I've added one. The tests were already in pytest, now they are in the right dir, in a follow-up commit. |
|
There is |
dkropachev
left a comment
There was a problem hiding this comment.
I love it, have some comments though.
Also can you please take a look at pytest-benchmark, it looks like exactly what we need.
| "A micro-bechmark for performance of policies" | ||
|
|
There was a problem hiding this comment.
Is it a real commit ? there is real change here.
There was a problem hiding this comment.
I'm not sure I understand the comment. It's a micro-benchmark, in the sense that it is using mocks and doesn't run against a real server?
| replicas = [] | ||
| for r in range(3): | ||
| idx = (i + r) % len(hosts) | ||
| replicas.append(hosts[idx]) | ||
| replicas_map[key] = replicas |
There was a problem hiding this comment.
I don't think it is good idea to connect number of token ranges with number of queries, you may want to run 1k queries on setup with 100 token ranges.
Also this way you would split mock cluster initialization from query initialization, which would make fixture api more readable and flexiable at the same time, it would look like this:
def test_dc_aware(policy, vnode_cluster_1000, select_10000):
policy.populate(vnode_cluster_1000, vnode_cluster_1000.metadata.all_hosts())
for query in select_10000:
...
| @@ -0,0 +1,242 @@ | |||
| import time | |||
There was a problem hiding this comment.
Can you please merge these two commits, it looks you you just moved code to another place
| connections = [c for holders in cluster.get_connection_holders() for c in holders.get_connections()] | ||
|
|
||
| # make sure requests were sent on all connections | ||
| # Note: connections can be replaced in shard-aware environments, so we skip |
There was a problem hiding this comment.
Could you please create a separate pr for this change.
There was a problem hiding this comment.
I was going to, first wanted to see that it solves the issue - but it doesn't:
FAILED tests/integration/standard/test_cluster.py::ClusterTests::test_idle_heartbeat - assert not True
+ where True = any(<generator object ClusterTests.test_idle_heartbeat.<locals>.<genexpr> at 0x7f63c0292d40>)
I feel like I should git bisect it - if I can reproduce this locally first.
There was a problem hiding this comment.
Of course, it passes locally. Over and over, consistently. Not a single failure.
There was a problem hiding this comment.
since other PR doesn't break like that, would assume it's the new benchmark tests which are running together with all of the other unittests
There was a problem hiding this comment.
They all do - #686 as an example. So either I managed to sneak in something that fails everywhere, or something else is going on. I tend to blame me, but I have no proof yet, and it's very annoying it doesn't reproduce on my laptop.
5dd6376 to
8c75060
Compare
Add micro-benchmarks measuring query plan generation throughput for DCAwareRoundRobinPolicy, RackAwareRoundRobinPolicy, TokenAwarePolicy, DefaultLoadBalancingPolicy, and HostFilterPolicy. Uses pytest-benchmark for accurate timing and statistical reporting with a simulated 45-node cluster topology (5 DCs x 3 racks x 3 nodes) and 100,000 deterministic queries. Also rename tests/integration/standard/column_encryption/test_policies.py to test_encrypted_policies.py to avoid module name conflicts when running the full test suite. Run with: pytest -m benchmark tests/performance/ Benchmark results comparing master vs PR scylladb#651 optimizations (Python 3.14.3, pytest-benchmark 5.2.3, GC disabled, median): Policy | master (Kops/s) | PR#651 (Kops/s) | Speedup --------------------------|-----------------|-----------------|-------- DCAware | 833 | 1898 | 2.3x RackAware | 542 | 1589 | 2.9x TokenAware(DCAware) | 135 | 572 | 4.2x TokenAware(RackAware) | 123 | 539 | 4.4x Default(DCAware) | 674 | 1257 | 1.9x HostFilter(DCAware) | 394 | 579 | 1.5x
8c75060 to
76b79c3
Compare
Not a very scientific one, but reasonable to get some measurements in terms of how different optimizations work. Example run (on #650 branch):
Pre-review checklist
./docs/source/.Fixes:annotations to PR description.