Claude-code-plugins-plus-skills flyio-performance-tuning

install
source · Clone the upstream repo
git clone https://github.com/jeremylongshore/claude-code-plugins-plus-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/jeremylongshore/claude-code-plugins-plus-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/plugins/saas-packs/flyio-pack/skills/flyio-performance-tuning" ~/.claude/skills/jeremylongshore-claude-code-plugins-plus-skills-flyio-performance-tuning && rm -rf "$T"
manifest: plugins/saas-packs/flyio-pack/skills/flyio-performance-tuning/SKILL.md
source content

Fly.io Performance Tuning

Overview

Optimize Fly.io performance: eliminate cold starts, right-size VMs, leverage multi-region for low latency, and tune concurrency settings.

Instructions

Step 1: Eliminate Cold Starts

# fly.toml — suspend instead of stop for faster resume (~100ms vs ~5s)
[http_service]
  auto_stop_machines = "suspend"   # Suspend to RAM, not full stop
  auto_start_machines = true
  min_machines_running = 1          # Always-warm in primary region

# For latency-critical: keep machines running in all regions
# min_machines_running applies globally

Step 2: Right-Size VMs

# Check current allocation
fly scale show -a my-app

# Start small, scale up based on metrics
fly scale vm shared-cpu-1x --memory 256    # Start here
fly scale vm shared-cpu-1x --memory 512    # If memory-constrained
fly scale vm shared-cpu-2x --memory 1024   # If CPU-bound
fly scale vm performance-2x --memory 4096  # For compute-heavy workloads
WorkloadVMMemoryWhen
Static site / API proxyshared-cpu-1x256mbLow traffic
Node.js APIshared-cpu-1x512mbMost apps
Heavy processingshared-cpu-2x1gbBackground jobs
Database / MLperformance-2x4gbCompute-intensive

Step 3: Multi-Region Latency Optimization

# Deploy close to your users
fly scale count 1 --region iad    # US East
fly scale count 1 --region lhr    # Europe
fly scale count 1 --region nrt    # Asia Pacific

# Fly automatically routes to nearest region via Anycast
# Verify: curl with timing
curl -w "DNS: %{time_namelookup}s, Connect: %{time_connect}s, Total: %{time_total}s\n" \
  -o /dev/null -s https://my-app.fly.dev/health

Step 4: Connection Pooling for Postgres

// Use connection pooling for Fly Postgres
// PgBouncer runs on port 5433 (pooled) vs 5432 (direct)
const pooledUrl = process.env.DATABASE_URL?.replace(':5432/', ':5433/');

// Prisma: add pgbouncer=true
// DATABASE_URL="postgres://user:pass@my-db.internal:5433/db?pgbouncer=true"

Step 5: Tune Concurrency

[http_service.concurrency]
  type = "requests"       # or "connections"
  hard_limit = 250        # Max before rejecting
  soft_limit = 200        # Start scaling at this point

Resources

Next Steps

For cost optimization, see

flyio-cost-tuning
.