Files
hatchet/hack/dev/compression-test
Sid Premkumar 709dd89a18 Add gzip compression (#2539)
* Add gzip compression init

* revert

* Feat: Initial cross-domain identify setup (#2533)

* feat: initial setup

* fix: factor out

* chore: lint

* fix: xss vuln

* feat: set up properly

* fix: lint

* fix: key

* fix: keys, cleanup

* Fix: use sessionStorage instead of localStorage (#2541)

* chore(deps): bump golang.org/x/crypto from 0.44.0 to 0.45.0 (#2545)

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.44.0 to 0.45.0.
- [Commits](https://github.com/golang/crypto/compare/v0.44.0...v0.45.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.45.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml (#2547)

Bumps [google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml](https://github.com/google/osv-scanner-action) from 2.2.4 to 2.3.0.
- [Release notes](https://github.com/google/osv-scanner-action/releases)
- [Commits](https://github.com/google/osv-scanner-action/compare/v2.2.4...v2.3.0)

---
updated-dependencies:
- dependency-name: google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml
  dependency-version: 2.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [Go SDK] Resubscribe and get a new listener stream when gRPC connections fail (#2544)

* fix listener cache issue to resubscribe when erroring out

* worker retry message clarification (#2543)

* add another retry layer and add comments

* fix loop logic

* make listener channel retry

* Compression test utils, and add log to indicate its enabled

* clean + fix

* more fallbacks

* common pgxpool afterconnect method (#2553)

* remove

* lint

* lint

* add cpu monitor during test

* fix background monitor and lint

* Make envvar to disable compression

* cleanup monitoring

* PR Feedback

* Update paths in compression tests + bump package versions

* path issue on test script

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: matt <mrkaye97@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mohammed Nafees <hello@mnafees.me>
2025-11-26 17:14:38 -05:00
..
2025-11-26 17:14:38 -05:00
2025-11-26 17:14:38 -05:00
2025-11-26 17:14:38 -05:00
2025-11-26 17:14:38 -05:00
2025-11-26 17:14:38 -05:00
2025-11-26 17:14:38 -05:00

Compression Testing Suite

This directory contains scripts and configurations to test gRPC compression across Go, TypeScript, and Python SDKs.

Overview

Tests measure network traffic bytes for each SDK comparing:

  • Baseline: Main branch (no compression)
  • With Compression: Current branch (compression enabled)

Docker Image Tags

All images use the format: {sdk}-{state}-compression

  • go-disabled-compression / go-enabled-compression
  • typescript-disabled-compression / typescript-enabled-compression
  • python-disabled-compression / python-enabled-compression
  • engine-disabled-compression / engine-enabled-compression

Build Instructions

Step 1: Build Baseline Images (Main Branch)

Important: All docker build commands must be run from the repository root, not from the testing directory.

# Checkout main branch
git checkout main

# Navigate to repository root (if not already there)
cd /path/to/hatchet

# Build Go SDK
docker build -t go-disabled-compression -f hack/dev/compression-test/Dockerfile.client-go .

# Build TypeScript SDK
docker build -t typescript-disabled-compression -f hack/dev/compression-test/Dockerfile.client-ts .

# Build Python SDK
docker build -t python-disabled-compression -f hack/dev/compression-test/Dockerfile.client-python .

# Build Engine (optional - you may manage this separately)
# docker build -t engine-disabled-compression -f Dockerfile .

Step 2: Build Compression Images (Current Branch)

# Checkout your compression branch
git checkout <your-compression-branch>

# Navigate to repository root
cd /path/to/hatchet

# Build Go SDK
docker build -t go-enabled-compression -f hack/dev/compression-test/Dockerfile.client-go .

# Build TypeScript SDK
docker build -t typescript-enabled-compression -f hack/dev/compression-test/Dockerfile.client-ts .

# Build Python SDK
docker build -t python-enabled-compression -f hack/dev/compression-test/Dockerfile.client-python .

# Build Engine (optional - you may manage this separately)
# docker build -t engine-enabled-compression -f Dockerfile .

Running Tests

Prerequisites

  1. Engine must be running: Start your Hatchet engine separately (not managed by these scripts)

    • The engine should be accessible at the host/port you specify in HATCHET_CLIENT_HOST_PORT
  2. Set required environment variables:

    export HATCHET_CLIENT_TOKEN="your-token-here"
    export HATCHET_CLIENT_HOST_PORT="localhost:7070"  # gRPC address where your engine is running
    

    Optional environment variables:

    export HATCHET_CLIENT_SERVER_URL="http://localhost:8080"  # HTTP server URL (for Go SDK, defaults to http://localhost:8080)
    export HATCHET_CLIENT_API_URL="http://localhost:8080"     # API URL (for TypeScript SDK, defaults to http://localhost:8080)
    export HATCHET_CLIENT_NAMESPACE="compression-test"        # Namespace (optional, defaults to compression-test)
    

    Note:

    • HATCHET_CLIENT_TENANT_ID is extracted from the token automatically, so you don't need to set it.
    • The scripts use host network mode, so containers can access your engine running on the host.

Quick Start

# Navigate to testing directory
cd hack/dev/compression-test

# Run setup (creates network and directories)
./scripts/setup.sh

# Run all baseline tests
./scripts/run_all_tests.sh disabled

# Switch engine to compression version, then run compression tests
./scripts/run_all_tests.sh enabled

# Generate comparison report
./scripts/generate_report.sh

Individual SDK Tests

# Test Go SDK (baseline)
./scripts/run_test.sh go disabled

# Test Go SDK (compression)
./scripts/run_test.sh go enabled

# Test TypeScript SDK
./scripts/run_test.sh typescript disabled
./scripts/run_test.sh typescript enabled

# Test Python SDK
./scripts/run_test.sh python disabled
./scripts/run_test.sh python enabled

Test Parameters

All tests use standardized parameters:

  • Duration: 60 seconds
  • Events per second: 10
  • Payload size: 100KB
  • DAG steps: 1
  • Event fanout: 1

Results

Results are saved in results/ directory:

  • results/baseline/ - Baseline test results
  • results/compressed/ - Compression test results

Final comparison report is generated by scripts/generate_report.sh