Skip to content

Commit 299e07f

Browse files
committed
adjust weights
1 parent 508eb6a commit 299e07f

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

‎.github/workflows/backend-tiered-poc.yml‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,28 +68,35 @@ jobs:
6868
python3 - <<'SCRIPT'
6969
import json, math, os
7070
71-
TESTS_PER_SHARD = 1200
72-
MAX_SHARDS = 22
71+
# Use the same total shard count as the normal backend CI (22)
72+
# to prove improvement without using more resources.
73+
TOTAL_SHARDS = 22
7374
7475
tier1_files = int(os.environ["TIER1_COUNT"])
7576
tier2_files = int(os.environ["TIER2_COUNT"])
7677
77-
# Estimate tests per file (avg ~15 tests per file based on 32772 tests / 2226 files)
78-
TESTS_PER_FILE = 15
79-
tier1_tests = tier1_files * TESTS_PER_FILE
80-
tier2_tests = tier2_files * TESTS_PER_FILE
78+
# Weight Tier 2 files higher to account for:
79+
# 1. ~4-5 min setup overhead (vs ~20s for Tier 1)
80+
# 2. Individually slower tests (Snuba queries, event ingestion)
81+
# Weight factor of 2.5x means Tier 2 gets ~2.5x more shards per file
82+
# than Tier 1, so both tiers finish around the same wall-clock time.
83+
TIER2_WEIGHT = 3.5
84+
tier1_weighted = tier1_files
85+
tier2_weighted = tier2_files * TIER2_WEIGHT
86+
total_weighted = tier1_weighted + tier2_weighted
8187
82-
tier1_shards = min(max(1, math.ceil(tier1_tests / TESTS_PER_SHARD)), MAX_SHARDS)
83-
tier2_shards = min(max(1, math.ceil(tier2_tests / TESTS_PER_SHARD)), MAX_SHARDS)
88+
tier2_shards = max(1, min(TOTAL_SHARDS - 1, round(TOTAL_SHARDS * tier2_weighted / total_weighted)))
89+
tier1_shards = TOTAL_SHARDS - tier2_shards
8490
8591
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
8692
f.write(f"tier1-shard-count={tier1_shards}\n")
8793
f.write(f"tier1-shard-indices={json.dumps(list(range(tier1_shards)))}\n")
8894
f.write(f"tier2-shard-count={tier2_shards}\n")
8995
f.write(f"tier2-shard-indices={json.dumps(list(range(tier2_shards)))}\n")
9096
91-
print(f"Tier 1: {tier1_files} files, ~{tier1_tests} tests, {tier1_shards} shards")
92-
print(f"Tier 2: {tier2_files} files, ~{tier2_tests} tests, {tier2_shards} shards")
97+
print(f"Total shards: {TOTAL_SHARDS} (same as backend CI)")
98+
print(f"Tier 1: {tier1_files} files, {tier1_shards} shards (~{tier1_files//tier1_shards} files/shard)")
99+
print(f"Tier 2: {tier2_files} files, {tier2_shards} shards (~{tier2_files//tier2_shards} files/shard)")
93100
SCRIPT
94101
env:
95102
TIER1_COUNT: ${{ steps.split.outputs.tier1-test-count }}

‎docs/service-classification-investigation.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,4 +527,4 @@ The classification can be validated empirically: run Tier 1 tests with only the
527527

528528
## Expected Impact
529529

530-
~68% of backend tests can run with just Postgres + Redis + Redis-cluster + Kafka (setup time: ~15-20s) instead of the full Snuba stack (setup time: 4-5min). Combined with intelligent sharding, this could significantly reduce CI wall-clock time and runner costs.
530+
~68% of backend tests can run with just Postgres + Redis + Redis-cluster + Kafka (setup time: ~15-20ts) instead of the full Snuba stack (setup time: 4-5min). Combined with intelligent sharding, this could significantly reduce CI wall-clock time and runner costs.

0 commit comments

Comments
 (0)