Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(e2e): balance browser and backend workers (#106268)

Raúl Negrón-Otero73718d2da94d
diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.yml
index 093a91d29356..c9dcf857ddd8 100644
--- a/.github/workflows/ci-e2e-playwright.yml
+++ b/.github/workflows/ci-e2e-playwright.yml
@@ -552,6 +552,10 @@ jobs:
INKEEP_API_KEY: ${{ secrets.INKEEP_API_KEY }}
AZURE_INFERENCE_CREDENTIAL: ${{ secrets.AZURE_INFERENCE_CREDENTIAL }}
AZURE_INFERENCE_ENDPOINT: ${{ secrets.AZURE_INFERENCE_ENDPOINT }}
+ # Tuned together for this runner: more Playwright workers without more Granian workers
+ # added test failures and no speedup. Talk to #team-devex before changing either.
+ GRANIAN_WORKERS: 4
+ PLAYWRIGHT_WORKERS: 6
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
@@ -900,8 +904,7 @@ jobs:
run: |
python manage.py run_autoreload_celery --type=worker &> /tmp/celery.log &
python manage.py start_temporal_worker --task-queue analytics-platform-task-queue &> /tmp/temporal-worker.log &
- # WARNING: Worker count is tuned to avoid CPU scheduling contention. Talk to #team-devex before changing.
- python -m granian --interface asgi posthog.asgi:application --host 0.0.0.0 --port 8000 --log-level debug --workers 2 &> /tmp/server.log &
+ python -m granian --interface asgi posthog.asgi:application --host 0.0.0.0 --port 8000 --log-level debug --workers "$GRANIAN_WORKERS" &> /tmp/server.log &
# Start the Node.js containers now that the database exists and migrations have run.
# plugins: CDP (no mode = default capabilities)
# ingestion-general: event ingestion (ingestion-v2-combined mode)
@@ -949,8 +952,6 @@ jobs:
# Empty when select-specs was skipped (full-run events) or chose a full run.
SELECT_MODE: ${{ needs.select-specs.outputs.mode }}
SELECT_SPECS: ${{ needs.select-specs.outputs.spec_files }}
- # WARNING: Worker count is tuned to avoid CPU scheduling contention. Talk to #team-devex before changing.
- # Reduced from 6+4 to 4+2 to minimize CPU scheduling contention (see PR #46853)
# Capture-only: VR is the gate for visual changes, Playwright just captures screenshots
run: |
# Time the test step so the telemetry can turn "specs skipped" into
@@ -958,16 +959,17 @@ jobs:
# duration; the original exit code is preserved for the quarantine gate.
start=$(date +%s)
set +e
+ specs=""
if [[ "$SELECT_MODE" == "selected" && -n "$SELECT_SPECS" ]]; then
echo "Selective run: $SELECT_SPECS"
- # Word-splitting is intentional: SELECT_SPECS is a space-separated list
- # of controlled spec paths (from the area map + on-disk globs).
- # shellcheck disable=SC2086
- pnpm --filter=@posthog/playwright exec playwright test $SELECT_SPECS --workers=4 --update-snapshots
+ specs=$SELECT_SPECS
else
echo "Full run (mode='${SELECT_MODE:-<skipped>}')"
- pnpm --filter=@posthog/playwright exec playwright test --workers=4 --update-snapshots
fi
+ # Word-splitting is intentional: SELECT_SPECS is a space-separated list
+ # of controlled spec paths (from the area map + on-disk globs).
+ # shellcheck disable=SC2086
+ pnpm --filter=@posthog/playwright exec playwright test $specs --workers="$PLAYWRIGHT_WORKERS" --update-snapshots
rc=$?
echo "test_seconds=$(( $(date +%s) - start ))" >> "$GITHUB_OUTPUT"
exit "$rc"
diff --git a/playwright/playwright.config.ts b/playwright/playwright.config.ts
index 690549a164ab..3b54253c1786 100644
--- a/playwright/playwright.config.ts
+++ b/playwright/playwright.config.ts
@@ -42,12 +42,8 @@ export default defineConfig({
preserve raw per-test failure signal.
*/
retries: process.env.PLAYWRIGHT_RETRIES ? Number(process.env.PLAYWRIGHT_RETRIES) : process.env.CI ? 3 : 2,
- /*
- GitHub Actions has 4 cores so run 3 workers
- and leave one core for all the rest
- For local running, our machines are all M3 or M4 by now so we can afford to run more workers
- */
- workers: process.env.CI ? 3 : 6,
+ /* CI passes --workers explicitly, sized against the other processes on its runner. */
+ workers: 6,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
// Enforces `mode: "run"` quarantine entries — tolerates their failures so