소스 정보
- 저장소
- Automattic/jetmon
- 최근 소스 활동
- 2026년 2월 20일 22:58
- 감지된 SKILL.md 언어
- 영어
- 스타
- 17
- 포크
- 4
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/Automattic/jetmon --skill debug-memory명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | debug-memory |
| description | Debug memory issues in Jetmon workers and identify leaks |
| allowed-tools | Bash(docker*), Bash(ps*), Bash(top*), Bash(node*), Read, Glob, Grep |
Use this skill to investigate memory problems in Jetmon workers, identify leaks, and optimize memory usage.
/debug-memory - Interactive memory debugging session/debug-memory monitor - Start continuous memory monitoring/debug-memory analyze - Analyze current memory state| Setting | Default | Purpose |
|---|---|---|
WORKER_MAX_MEM_MB | 53 | Memory limit before worker recycles |
WORKER_MAX_CHECKS | 10,000 | Check count before worker recycles |
Workers are designed to be disposable. When hitting limits, they stop accepting work and exit gracefully.
Worker Process
├── Node.js Heap (V8)
│ ├── HTTP check callbacks
│ ├── Retry queues (arrToRetry)
│ └── Active checks (arrCheck)
├── Native Addon (C++)
│ └── HTTP_Checker instances
└── Buffers (TCP/SSL)
# Real-time memory monitoring
docker compose exec jetmon bash -c 'while true; do ps aux --sort=-%mem | head -15; sleep 5; done'
# Memory usage by process
docker compose exec jetmon ps aux --sort=-%mem
# Specific worker memory
docker compose exec jetmon bash -c 'ps -o pid,rss,vsz,comm | grep jetmon'
# View process tree
docker compose exec jetmon ps auxf
# Memory maps (detailed)
docker compose exec jetmon bash -c 'cat /proc/$(pgrep -f jetmon-master)/status | grep -E "Vm|Rss"'
Check Graphite (http://localhost:8088) for:
stats.workers.*.memory - Per-worker memory usagestats.workers.recycle.count - Worker recycling frequencystats.workers.free.count - Available workersSymptom: Memory grows steadily, especially during site outages.
Diagnosis:
docker compose exec jetmon cat stats/sitesqueue
Cause: Large numbers of sites in retry queue (arrToRetry).
Solution: Check retry queue flush logic. Ensure retries are processed, not accumulated.
Symptom: Memory grows even with low check counts.
Diagnosis:
# Enable debug mode in http_checker.cpp
#define DEBUG_MODE 1
Watch for:
Solution: Review C++ destructor cleanup in HTTP_Checker::~HTTP_Checker().
Symptom: Workers become unresponsive, memory spikes.
Diagnosis:
docker compose exec jetmon node --trace-warnings lib/jetmon.js
Solution: Ensure async operations complete and callbacks fire.
Symptom: Memory grows with unique domains checked.
Diagnosis: Check if USE_GETADDRINFO is enabled in http_checker.cpp.
Solution: getaddrinfo uses more memory than gethostbyname. Consider trade-offs.
// Add to lib/httpcheck.js for debugging
const v8 = require('v8');
const fs = require('fs');
// Trigger heap snapshot
function dumpHeap() {
const filename = `/tmp/heap-${process.pid}-${Date.now()}.heapsnapshot`;
const stream = fs.createWriteStream(filename);
v8.writeHeapSnapshot(filename);
console.log('Heap snapshot written to:', filename);
}
// Call when memory is high
if (process.memoryUsage().rss > 50 * 1024 * 1024) {
dumpHeap();
}
Add to worker process:
setInterval(function() {
const mem = process.memoryUsage();
logger.debug('Memory: RSS=' + Math.round(mem.rss / 1024 / 1024) + 'MB, ' +
'Heap=' + Math.round(mem.heapUsed / 1024 / 1024) + 'MB');
}, 30000);
{
"NUM_WORKERS": 40, // Reduce from 60 if memory constrained
"NUM_TO_PROCESS": 30, // Reduce parallel checks per worker
"WORKER_MAX_MEM_MB": 40, // Lower threshold for faster recycling
"WORKER_MAX_CHECKS": 5000 // Recycle more frequently
}
DO:
// Release references when done
arrCheck.splice(index, 1); // Remove processed items
// Use callbacks, don't hold references
checker.http_check(url, port, index, function(result) {
// Process result immediately
sendResult(result);
// Callback goes out of scope
});
DON'T:
// Accumulate data without bounds
allResults.push(result); // Unbounded growth
// Hold references longer than needed
var savedChecker = checker; // Prevents GC
{
"WORKER_MAX_MEM_MB": 30,
"WORKER_MAX_CHECKS": 100
}
docker compose logs -f jetmon | grep -E "(spawn|die|recycle|memory)"
# Run for extended period, monitor memory growth
docker compose up -d jetmon
watch -n 5 'docker compose exec jetmon ps aux --sort=-%mem | head -10'
| File | Memory-Related Code |
|---|---|
lib/httpcheck.js | Worker arrays: arrCheck, arrToRetry |
lib/jetmon.js | Master arrays: arrWorkers, gCountSuccess |
src/http_checker.cpp | Buffer allocation, SSL contexts |
lib/config.js | Memory limit settings |
stats/sitesqueue)SOC 직업 분류 기준