The nself perf command provides comprehensive performance profiling and analysis for your ɳSelf infrastructure. It includes system profiling, slow query detection, and optimization recommendations.
Run full system profile or service-specific profiling.
nself perf profile # Full system profile
nself perf profile postgres # Profile PostgreSQL
nself perf profile hasura # Profile Hasura GraphQL
# Output:
# ➞ Performance Profile
#
# SERVICE CPU% MEMORY RESPONSE
# postgres 2.3% 512MB/1GB 5ms
# hasura 4.1% 256MB/512MB 12ms
# auth 1.0% 128MB/256MB 8msAnalyze system performance with specific focus areas.
nself perf analyze # General analysis
nself perf analyze --slow-queries # Focus on slow queries
nself perf analyze --memory # Memory analysis
nself perf analyze --cpu # CPU analysisDetailed analysis of slow database queries using pg_stat_statements.
nself perf slow-queries # Show top slow queries
nself perf slow-queries --limit 20 # Top 20 queries
# Output:
# RANK TIME CALLS AVG(ms) QUERY
# 1 2.3s 1,234 150 SELECT * FROM orders WHERE...
# 2 1.8s 456 95 SELECT * FROM users JOIN...
# 3 1.2s 789 85 UPDATE products SET...Note: Requires pg_stat_statements extension enabled in PostgreSQL.
Generate a performance report.
nself perf report # Table format
nself perf report --json # JSON output{
"timestamp": "2026-01-23T10:30:00Z",
"services": [
{"name": "postgres", "cpu": "2.3%", "memory": "512MB", "response_ms": 5}
]
}Real-time terminal dashboard showing performance metrics.
nself perf dashboard # Launch dashboard
# Dashboard shows:
# - CPU/Memory per service
# - Request latency
# - Database query times
# - Cache hit rates
#
# Press Ctrl+C to exitGet optimization recommendations based on current performance.
nself perf suggest # Show suggestions
nself perf suggest --json # JSON output
# Output:
# Performance Suggestions:
#
# HIGH PRIORITY:
# 1. Add index on orders.customer_id (85% query improvement)
# 2. Increase Redis memory to 512MB (cache evictions detected)
#
# MEDIUM PRIORITY:
# 3. Enable query caching in Hasura
# 4. Consider connection pooling (45 concurrent connections)
#
# LOW PRIORITY:
# 5. Upgrade to larger instance for 20% headroom| Option | Description |
|---|---|
| --json | Output in JSON format |
| --output FILE | Save results to file |
| -h, --help | Show help message |
| Subcommand | Description |
|---|---|
| profile [service] | System/service profiling |
| analyze | Analyze performance |
| slow-queries | Slow query analysis |
| report | Generate report |
| dashboard | Real-time dashboard |
| suggest | Optimization tips |
# Quick system health check
nself perf profile
# Find slow queries
nself perf slow-queries
# Get optimization tips
nself perf suggest
# Export performance report
nself perf report --json > perf-report.json
# Monitor in real-time
nself perf dashboardpg_stat_statements extension for slow query analysisnself start)