CLI Overview
Quick Start Guide
wheels info
wheels reload
wheels deps
wheels destroy
wheels watch
wheels generate app
wheels generate app-wizard
wheels generate controller
wheels generate model
wheels generate view
wheels generate property
wheels generate route
wheels generate resource
wheels generate api-resource
wheels generate frontend
wheels generate test
wheels generate snippets
wheels scaffold
wheels db create
wheels db drop
wheels db setup
wheels db reset
wheels db status
wheels db version
wheels db rollback
wheels db seed
wheels db dump
wheels db restore
wheels db shell
wheels db schema
wheels dbmigrate info
wheels dbmigrate latest
wheels dbmigrate up
wheels dbmigrate down
wheels dbmigrate reset
wheels dbmigrate exec
wheels dbmigrate create blank
wheels dbmigrate create table
wheels dbmigrate create column
wheels dbmigrate remove table
wheels test
wheels test run
wheels test coverage
wheels test debug
wheels config list
wheels config set
wheels config env
wheels env
wheels env setup
wheels env list
wheels env switch
wheels environment
wheels console
wheels runner
wheels server
wheels server start
wheels server stop
wheels server restart
wheels server status
wheels server log
wheels server open
wheels plugins
wheels plugins list
wheels plugins install
wheels plugins remove
wheels analyze
wheels analyze code
wheels analyze performance
wheels analyze security
wheels security
wheels security scan
wheels optimize
wheels optimize performance
wheels docs
wheels docs generate
wheels docs serve
wheels ci init
wheels docker init
wheels docker deploy
wheels deploy
wheels deploy audit
wheels deploy exec
wheels deploy hooks
wheels deploy init
wheels deploy lock
wheels deploy logs
wheels deploy proxy
wheels deploy push
wheels deploy rollback
wheels deploy secrets
wheels deploy setup
wheels deploy status
wheels deploy stop
Configuration Management
Creating Commands
Service Architecture
Migrations Guide
Testing Guide
Object Relational Mapping
Creating Records
Reading Records
Updating Records
Deleting Records
Column Statistics
Dynamic Finders
Getting Paginated Data
Associations
Nested Properties
Object Validation
Object Callbacks
Calculated Properties
Transactions
Dirty Records
Soft Delete
Automatic Time Stamps
Using Multiple Data Sources
optimize performance (Coming Soon)
This command may not work as expected. A complete and stable version is coming soon.
Automatically applies performance optimizations to your Wheels application based on analysis results.
Usage
wheels optimize performance [target] [--aggressive] [--dry-run] [--backup]
Parameters
target
- (Optional) Target area to optimize. Default: current directory--aggressive
- (Optional) Apply aggressive optimizations that may change behavior--dry-run
- (Optional) Show what would be changed without applying--backup
- (Optional) Create backup before applying changes
Description
The optimize performance
command automatically implements performance improvements identified through analysis. It can:
- Add database indexes
- Implement query result caching
- Optimize asset delivery
- Enable application-level caching
- Refactor inefficient code patterns
- Configure performance settings
Examples
Basic optimization
wheels optimize performance
Optimize specific directory
wheels optimize performance app/models
Preview changes without applying
wheels optimize performance --dry-run
Aggressive optimization with backup
wheels optimize performance --aggressive --backup
Optimize entire application aggressively
wheels optimize performance . --aggressive
Optimization Targets
Database
- Creates missing indexes
- Optimizes slow queries
- Adds query hints
- Implements connection pooling
- Configures query caching
Caching
- Enables view caching
- Implements action caching
- Configures cache headers
- Sets up CDN integration
- Optimizes cache keys
Assets
- Minifies CSS/JavaScript
- Implements asset fingerprinting
- Configures compression
- Optimizes images
- Sets up asset pipeline
Code
- Refactors N+1 queries
- Implements lazy loading
- Optimizes loops
- Reduces object instantiation
- Improves algorithm efficiency
Output
Performance Optimization
========================
Analyzing application... ✓
Creating backup... ✓
Applying optimizations:
Database Optimizations:
✓ Added index on users.email
✓ Added composite index on orders(user_id, created_at)
✓ Implemented query caching for User.findActive()
✓ Optimized ORDER BY clause in Product.search()
Caching Optimizations:
✓ Enabled action caching for ProductsController.index
✓ Added fragment caching to product listings
✓ Configured Redis for session storage
✓ Set cache expiration for static content
Asset Optimizations:
✓ Minified 15 JavaScript files (saved 145KB)
✓ Compressed 8 CSS files (saved 62KB)
✓ Enabled gzip compression
✓ Configured browser caching headers
Code Optimizations:
✓ Fixed N+1 query in OrdersController.index
✓ Replaced 3 array loops with cfloop query
✓ Implemented lazy loading for User.orders
~ Skipped: Complex refactoring in ReportService (requires --aggressive)
Summary:
- Applied: 18 optimizations
- Skipped: 3 (require manual review or --aggressive flag)
- Estimated improvement: 35-40% faster page loads
Next steps:
1. Run 'wheels reload' to apply changes
2. Test application thoroughly
3. Monitor performance metrics
Dry Run Mode
Preview changes without applying them:
wheels optimize performance --dry-run
Optimization Preview
====================
Would apply the following changes:
1. Database: Create index on users.email
SQL: CREATE INDEX idx_users_email ON users(email);
2. Cache: Enable action caching for ProductsController.index
File: /app/controllers/ProductsController.cfc
Add: <cfset caches(action="index", time=30)>
3. Query: Optimize Product.search()
File: /app/models/Product.cfc
Change: Add query hint for index usage
[... more changes ...]
Run without --dry-run to apply these optimizations.
Aggressive Mode
Enables optimizations that may change application behavior:
wheels optimize performance --aggressive
Additional aggressive optimizations:
✓ Converted synchronous operations to async
✓ Implemented aggressive query result caching
✓ Reduced session timeout to 20 minutes
✓ Disabled debug output in production
✓ Implemented database connection pooling
⚠️ Changed default query timeout to 10 seconds
Backup and Rollback
Backups are created automatically:
Backup created: /backups/optimize-backup-20240115-143022.zip
To rollback:
wheels optimize rollback --backup=optimize-backup-20240115-143022.zip
Configuration
Customize optimization behavior in /config/optimizer.json
:
{
"database": {
"autoIndex": true,
"indexThreshold": 1000,
"queryTimeout": 30
},
"caching": {
"defaultDuration": 3600,
"cacheQueries": true
},
"assets": {
"minify": true,
"compress": true,
"cdnEnabled": false
}
}
Notes
- Always test optimizations in a staging environment first
- Some optimizations require application restart
- Monitor application after applying optimizations
- Use
wheels analyze performance
to measure improvements - Aggressive optimizations should be carefully reviewed
- Usage
- Parameters
- Examples
- Basic optimization
- Optimize specific directory
- Preview changes without applying
- Aggressive optimization with backup
- Optimize entire application aggressively
- Optimization Targets
- Database
- Caching
- Assets
- Code
- Output
- Dry Run Mode
- Aggressive Mode
- Backup and Rollback
- Configuration
- Notes