mirror of
https://github.com/hanzoai/replicate.git
synced 2026-10-30 18:23:20 +00:00
- All source files, configs, docs, CI renamed - Binary: replicate (not litestream) - Config: replicate.yml (litestream.yml as fallback) - Env: REPLICATE_* (LITESTREAM_* as fallback) - Socket: /var/run/replicate.sock - Image: ghcr.io/hanzoai/replicate - Module: github.com/hanzoai/replicate - Package name: replicate (Go), replicate-vfs (npm/pip/gem) - VFS: registered as "replicate", pragmas replicate_* - C exports: ReplicateVFSRegister, GoReplicate* - Windows service: Replicate - Systemd unit: replicate.service - Upstream attribution preserved (README, upgrade test scripts)
CPU Usage Testing
This directory contains test scripts and configurations for measuring Replicate's idle CPU usage, particularly for validating the fixes in issue #992.
Files
test-cpu-usage.sh- Automated CPU monitoring scriptreplicate-test-polling.yml- Config for testing with S3 replication
Prerequisites
-
Build Replicate binary:
cd ../.. go build -o bin/replicate ./cmd/replicate -
Set up AWS credentials in
.envrcat repo root:export AWS_ACCESS_KEY_ID="your-key-id" export AWS_SECRET_ACCESS_KEY="your-secret-key" export AWS_REGION="us-east-2" export S3_BUCKET="your-test-bucket" -
Have
sqlite3CLI installed
Usage
From this directory, run:
# Test for 60 seconds
./test-cpu-usage.sh 60
# Longer test (5 minutes)
./test-cpu-usage.sh 300
What It Tests
The script:
- Creates a test SQLite database at
/tmp/test.db - Starts Replicate with S3 replication
- Monitors CPU usage every second using
ps - Calculates average CPU usage
- Verifies S3 replication is working
- Outputs results and detailed CSV log
Expected Results
Based on testing for PR #993:
- With S3 transport fix: ~0.0067% CPU (99% improvement)
- Original (v0.5.6): ~0.7% CPU
The S3 transport fix achieves near-zero idle CPU usage, validating the fix.
Output
Results are printed to stdout and detailed logs are saved to:
/tmp/replicate-cpu-log.csv- Per-second CPU measurements
Notes
- Tests require real S3 credentials and will upload data to your bucket
- Test database is created at
/tmp/test.dband cleaned up on each run - CPU measurements are instantaneous snapshots, not averages over intervals
- Longer test durations (5-10 minutes) provide more stable averages