Packages
snakepit
0.7.3
0.13.0
0.12.0
0.11.1
0.11.0
0.10.1
0.10.0
0.9.1
0.9.0
0.8.9
0.8.8
0.8.7
0.8.6
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.7
0.7.6
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.11
0.6.10
0.6.9
0.6.8
0.6.7
0.6.6
0.6.5
0.6.4
0.6.3
0.6.2
0.6.1
0.6.0
0.5.1
0.5.0
0.4.3
0.4.2
0.4.1
0.4.0
0.3.3
0.3.2
0.3.1
0.3.0
0.2.1
0.2.0
0.1.2
0.1.1
0.1.0
High-performance pooler and session manager for external language integrations. Supports Python, Node.js, Ruby, and more with gRPC streaming, session management, and production-ready process cleanup.
Current section
Files
Jump to
Current section
Files
docs/PRODUCTION_DEPLOYMENT_CHECKLIST.md
# Production Deployment Checklist
## Pre-Deployment Tasks
### 1. Remove Debug Logging
**Python (priv/python/grpc_server.py):**
- [ ] Remove all `/tmp/python_worker_debug.log` writes
- [ ] Remove signal reception logging (lines 767-770)
- [ ] Remove tombstone message (lines 799-803)
- [ ] Change logging level from INFO to WARNING
**Elixir:**
- [ ] Remove `IO.inspect` calls in lib/snakepit/process_killer.ex (lines 28-29, 109-110, 113-116)
- [ ] Remove `IO.inspect` calls in lib/snakepit/pool/application_cleanup.ex (lines 39-40, 43-44)
- [ ] Remove `IO.inspect` calls in lib/snakepit/application.ex (lines 21-26, 43-45, 76, 81-83)
- [ ] Remove "!!! GRPCWorker.terminate/2 CALLED !!!" in lib/snakepit/grpc_worker.ex (lines 448-449)
### 2. Fix Compiler Warnings
- [ ] Add `@impl true` to `Application.stop/1` (lib/snakepit/application.ex:80)
- [ ] Rename `_worker_id` to `worker_id` in lib/snakepit/pool/process_registry.ex:496
### 3. Final Verification
```bash
# Clean state
rm -rf priv/data/*.dets
# Run test suite
mix test
# Expected: 60 tests, 0 failures
# Test basic example
mix run --no-start examples/grpc_basic.exs
# Expected: "✅ No orphaned processes"
# Stress test with 100 workers
mix run --no-start examples/grpc_concurrent.exs 100
# Expected: Zero orphans after completion
# Verify no orphans
sleep 3
ps aux | grep grpc_server.py | grep -v grep
# Expected: No output (zero processes)
```
### 4. Update Documentation
- [ ] Update README.md with zero orphans achievement
- [ ] Add deployment notes about monitoring
- [ ] Document the trap_exit requirement
## Production Monitoring
### Key Metrics
**1. ApplicationCleanup Orphan Count**
```elixir
# Should be 0 in normal operation
:telemetry.attach(
"orphan-monitor",
[:snakepit, :application_cleanup, :orphaned_processes_found],
fn _event, %{count: count}, _metadata, _config ->
if count > 0 do
Logger.error("ALERT: Found #{count} orphaned processes!")
end
end,
nil
)
```
**2. Worker Restart Rate**
```bash
# Monitor supervisor restarts
watch -n 5 'ps aux | grep grpc_server.py | wc -l'
# Should stay constant (= pool_size)
```
**3. Process Count**
```bash
# Total Python processes should equal pool_size
ps aux | grep grpc_server.py | wc -l
```
**4. DETS File Size**
```bash
# Should stay small (< 100KB typically)
ls -lh priv/data/*.dets
```
### Alerts to Configure
1. **Orphan Detection:** Alert if ApplicationCleanup finds any orphans
2. **High Restart Rate:** Alert if >10 worker restarts/minute
3. **Process Count Mismatch:** Alert if Python process count != pool_size
4. **DETS Growth:** Alert if DETS file >1MB (indicates cleanup not running)
## Deployment Steps
1. **Remove debug logging** (see above)
2. **Fix warnings** (see above)
3. **Run final tests** (see above)
4. **Deploy to staging**
5. **Monitor for 24 hours**
6. **Verify zero orphans in staging**
7. **Deploy to production**
8. **Monitor ApplicationCleanup telemetry**
## Success Criteria
✅ Test suite passes (60/60)
✅ All examples show zero orphans
✅ 100-worker stress test shows zero orphans
✅ No ApplicationCleanup emergency activations in production
✅ Process count stable over time
## Rollback Plan
If orphans appear in production:
1. Check ApplicationCleanup telemetry logs
2. Verify GRPCWorker.terminate/2 being called (add temporary logging)
3. Check BEAM OS PID tracking in DETS
4. Review supervision tree configuration
5. If critical, rollback and investigate
---
**Status:** Ready for production deployment after debug logging removal
**Confidence:** HIGH - Zero orphans verified across all scenarios