Quickstart
Quickstart Guide
Section titled “Quickstart Guide”Get up and running with LeanJ in just a few steps. This guide assumes you’ve already installed LeanJ.
Prerequisites
Make sure you have everything ready before starting.
CLI Installed
LeanJ CLI must be in your PATH
Java JDK 11+
Required for profiling Java applications
IntelliJ IDEA 2023.1+
Optional, for IDE integration and inline hints
Step 1: Start the Controller
Section titled “Step 1: Start the Controller”Start the controller daemon that manages agent connections and provides the API:
leanj controller startThe controller runs on:
- TCP port 9876 (for agent connections)
- HTTP port 9877 (for CLI/IDE API)
Expected Output
Controller started successfullyTCP Port: 9876HTTP Port: 9877Step 2: Discover JVMs
Section titled “Step 2: Discover JVMs”List all running Java applications that can be profiled:
leanj jvmsExample Output
Found 2 JVM(s):
1. com.example.SampleLoop ID: abc123 PID: 12345 Environment: local
2. order-service ID: def456 Environment: docker App: order-serviceStep 3: Attach the Agent
Section titled “Step 3: Attach the Agent”Attach the profiler to your Java application. You can use either the PID or JVM ID:
Using PID:
leanj attach --pid 12345Using JVM ID:
leanj attach --jvm-id abc123Success Message
Agent attached successfully to JVM abc123Step 4: Start Profiling in IntelliJ
Section titled “Step 4: Start Profiling in IntelliJ”If you’re using IntelliJ IDEA, you can start profiling directly from the IDE:
- Open IntelliJ IDEA
- Go to Run → Start LeanJ Profiling
The plugin will automatically:
- ✅ Call the CLI
- ✅ Start the controller (if not running)
- ✅ Discover JVMs
- ✅ Attach the agent
💡 Tip
The IntelliJ plugin handles all the CLI operations for you. No need to run commands manually!
Step 5: View Metrics
Section titled “Step 5: View Metrics”Once profiling is active, you’ll see metrics directly in your code editor as inline hints:
╰─ Estimated avg execution time: 2.1ms╰─ Max time last run: 4.8ms╰─ Allocations per call: ~12KB╰─ Call count: 150╰─ Trend: +15%
public void processPayments() { // your code here}You can also open the Profiler tool window at the bottom of IntelliJ to see detailed metrics and statistics.
Inline Hints
See performance metrics directly above each method in your code editor
Tool Window
Open the Profiler tool window for detailed statistics and trends
Quick Status Check
Section titled “Quick Status Check”Verify everything is working correctly:
# Check controller and agent statusleanj status
# Run system health checkleanj doctorSystem Health
The doctor command checks your system setup, verifies dependencies, and provides troubleshooting information.
Next Steps
Continue your journey with LeanJ.
IntelliJ Integration
Learn how to use LeanJ with IntelliJ IDEA for the best experience.
IntelliJ GuideTroubleshooting
Section titled “Troubleshooting”If you encounter issues, follow these steps:
-
Run system diagnostics:
Terminal window leanj doctor -
Check controller logs:
Terminal window tail -f logs/profiler-controller.log -
Verify controller status:
Terminal window leanj status -
See the Troubleshooting Guide: Visit /troubleshooting/ for common issues and solutions.
Need Help?
If you’re still having issues, check the Troubleshooting Guide or open an issue on GitHub.
Architecture Overview
Section titled “Architecture Overview”LeanJ uses a CLI-centric architecture:
CLI (Go) → Controller (Java) → Agent (Java) → Java App ↓ IntelliJ Plugin (UI)CLI
Heart of the system - handles JVM discovery, attach/detach, controller lifecycle
Controller
Local daemon - receives data from agents, provides API to IDE/CLI
IDE Plugin
Optional UI layer - calls CLI and displays results
Agent
Works everywhere - local, Docker, Kubernetes
Learn more about how it works.