Simulation Examples
Examples of using Arc Memory’s simulation feature
Simulation Examples
This page provides examples of how to use Arc Memory’s simulation feature to predict the impact of code changes before merging them. The simulation feature helps you understand potential risks and make more informed decisions.
Basic Simulation
The simplest way to run a simulation is to use the arc sim run
command with no options:
This will:
- Analyze your current uncommitted changes
- Compare them against the main branch
- Run all available simulation scenarios
- Provide a risk assessment and detailed analysis
Simulation Scenarios
Arc Memory supports various simulation scenarios to analyze different aspects of your changes:
Network Latency Simulation
This scenario analyzes how your changes might affect network latency, including:
- API response times
- Service-to-service communication
- Database query performance
Memory Usage Simulation
This scenario analyzes how your changes might affect memory usage, including:
- Memory allocation patterns
- Potential memory leaks
- Garbage collection impact
CPU Usage Simulation
This scenario analyzes how your changes might affect CPU usage, including:
- Computational complexity
- Concurrency patterns
- Resource contention
Error Rates Simulation
This scenario analyzes how your changes might affect error rates, including:
- Exception handling
- Error propagation
- Failure modes
Security Simulation
This scenario analyzes potential security implications of your changes, including:
- Input validation
- Authentication/authorization
- Data exposure risks
Advanced Simulation Options
Using a Specific Diff
You can run a simulation on a specific diff file instead of your current changes:
This is useful for:
- Analyzing changes from a colleague
- Evaluating historical changes
- Testing hypothetical changes
Comparing Against a Different Branch
By default, simulations compare against the main branch. You can specify a different branch:
This is useful for:
- Feature branch development
- Release branch validation
- Experimental changes
Using Different Sandbox Environments
Arc Memory supports different sandbox environments for running simulations:
Each environment offers different levels of isolation and reproducibility:
local
: Fastest but least isolateddocker
: Good balance of speed and isolatione2b
: Most isolated and reproducible, but requires internet connection
Using Memory to Improve Results
Arc Memory can use insights from previous simulations to improve results:
This enables:
- More accurate risk assessments based on historical patterns
- Contextual recommendations based on similar past changes
- Improved explanation quality with relevant historical context
Working with Simulation History
Viewing Simulation History
To view your recent simulations:
This shows a table of recent simulations with their IDs, dates, scenarios, risk scores, and affected services.
Filtering Simulation History
You can filter the history by various criteria:
Viewing Detailed Simulation Results
To view detailed results for a specific simulation:
This shows the complete analysis, including:
- Summary information
- Detailed impact analysis
- Metrics and predictions
- Recommendations
Programmatic Simulation
You can also run simulations programmatically using the SDK:
CI/CD Integration
You can integrate simulations into your CI/CD pipeline:
Best Practices
- Run simulations early and often during development to catch issues early
- Use the appropriate sandbox for your needs (local for speed, e2b for isolation)
- Enable memory to improve simulation accuracy over time
- Integrate with CI/CD to automate simulation on pull requests
- Review simulation history to identify patterns and trends
- Use multiple scenarios to get a comprehensive view of potential impacts
Troubleshooting
Simulation Fails to Start
If the simulation fails to start:
Inaccurate Results
If you believe the simulation results are inaccurate:
See Also
- Simulation Command - For detailed command documentation
- Memory Integration - For information on how memory is used in simulations
- Simulation Improvements - For details on recent improvements to the simulation feature