Commit Graph

7 Commits

Author SHA1 Message Date
kennethreitz 1499110341 Make worker count configurable via WORKERS environment variable
- Read worker count from WORKERS env var (default: 4)
- Set WORKERS=4 in fly.toml for production
- Allows tuning worker count without code changes
- Can adjust via fly secrets set WORKERS=X
2025-11-28 00:50:57 -05:00
kennethreitz 3362985c1d Optimize performance: upgrade to dedicated CPUs, disable reload in docker-compose
- Upgrade Fly.io VMs from shared to performance CPUs for dedicated compute
- Remove --reload flag from docker-compose for better local performance
- Improves response times and consistency under load
- Cost increase: ~$10-15/month for dedicated CPU performance
2025-11-28 00:37:44 -05:00
kennethreitz 5a223a90d4 Keep one machine running to eliminate cold starts
Changed Fly.io configuration to maintain one active machine:
- min_machines_running: 0 → 1
- auto_stop_machines: 'stop' → 'suspend'

This eliminates cold start delays by keeping the application warm and ready
to serve requests immediately. The machine will suspend (not stop) when idle,
allowing much faster wake-up times.

With PRELOAD_INTERLINEAR enabled, the 14MB interlinear data stays loaded
in memory, making all requests fast without repeated decompression.

Trade-off: Slightly higher costs for always-on machine, but much better
user experience with instant page loads.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 00:32:25 -05:00
kennethreitz 8775346240 Add cache warming on startup for interlinear data
Enable preloading of interlinear data at application startup to eliminate
first-request delays. Configurable via PRELOAD_INTERLINEAR environment variable.

- Add preload_data() function to interlinear_loader.py with logging
- Add startup event handler in server.py to trigger preload
- Enable PRELOAD_INTERLINEAR=true in fly.toml and docker-compose.yml
- Update FLY_DEPLOYMENT.md with cache warming documentation

Performance impact:
- Startup time: ~7-10 seconds (vs ~5 seconds without preload)
- First request: <100ms (vs 2-3 seconds without preload)
- Memory usage: ~400-500MB total (139MB for interlinear data)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 13:04:44 -05:00
kennethreitz cfbfc5417c Optimize for fly.io deployment
Production-ready configuration for fly.io with enhanced resource allocation,
health checks, and error handling for the comprehensive interlinear Bible.

Changes:
- Increase memory to 2GB to handle 139MB uncompressed interlinear data
- Add concurrency limits (200 soft, 250 hard)
- Configure health checks at /health endpoint
- Enhanced .dockerignore to exclude large uncompressed files
- Production logging in interlinear_loader with error handling
- Auto-scaling configuration (stop on idle, start on request)
- Comprehensive deployment documentation

Performance optimizations:
- Compressed data: 13.5 MB in image
- Memory usage: ~400-500 MB (with 2GB allocated)
- Cold start: ~5-10 seconds (including data load)
- Warm requests: <100ms

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 12:10:55 -05:00
kennethreitz 8e13cc3265 Fix indentation in fly.toml and increase CPU count to 4 2025-05-26 15:24:41 -04:00
kennethreitz 8c79f732f8 Add Fly.io deployment configuration
- Add Dockerfile with multi-stage Python build
- Add GitHub Actions workflow for automatic deployment on main branch
- Add fly.toml with app configuration and auto-scaling settings
- Add .dockerignore to exclude development files from build context
2025-05-26 12:56:20 -04:00