LogoLogo
HomeAPIBlog
3.0.0-SNAPSHOT
3.0.0-SNAPSHOT
  • INTRODUCTION
    • Getting Started
      • Running Local Development Servers
      • Beginner Tutorial: Hello World
      • Beginner Tutorial: Hello Database
      • Tutorial: Wheels, AJAX, and You
    • Frameworks and Wheels
    • Requirements
    • Manual Installation
    • Upgrading
    • Screencasts
  • Command Line Tools
    • CLI Overview
    • Quick Start Guide
    • Command Reference
      • Core Commands
        • wheels init
        • wheels info
        • wheels reload
        • wheels deps
        • wheels destroy
        • wheels watch
      • Code Generation
        • 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
      • Database Commands
        • 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 db schema
        • wheels db seed
      • Testing Commands
        • wheels test
        • wheels test run
        • wheels test coverage
        • wheels test debug
      • Configuration Commands
        • wheels config list
        • wheels config set
        • wheels config env
      • Environment Management
        • wheels env
        • wheels env setup
        • wheels env list
        • wheels env switch
      • Plugin Management
        • wheels plugins
        • wheels plugins list
        • wheels plugins install
        • wheels plugins remove
      • Code Analysis
        • wheels analyze
        • wheels analyze code
        • wheels analyze performance
        • wheels analyze security
      • Security Commands
        • wheels security
        • wheels security scan
      • Performance Commands
        • wheels optimize
        • wheels optimize performance
      • Documentation Commands
        • wheels docs
        • wheels docs generate
        • wheels docs serve
      • CI/CD Commands
        • wheels ci init
      • Docker Commands
        • wheels docker init
        • wheels docker deploy
      • Deployment Commands
        • 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
    • CLI Development Guides
      • Creating Commands
      • Service Architecture
      • Migrations Guide
      • Testing Guide
  • Working with Wheels
    • Conventions
    • Configuration and Defaults
    • Directory Structure
    • Switching Environments
    • Testing Your Application
    • Using the Test Environment
    • Contributing to Wheels
    • Submitting Pull Requests
    • Documenting your Code
  • Handling Requests with Controllers
    • Request Handling
    • Rendering Content
    • Redirecting Users
    • Sending Files
    • Sending Email
    • Responding with Multiple Formats
    • Using the Flash
    • Using Filters
    • Verification
    • Event Handlers
    • Routing
    • URL Rewriting
      • Apache
      • IIS
      • Tomcat
      • Nginx
    • Obfuscating URLs
    • Caching
    • Nesting Controllers
    • CORS Requests
  • Displaying Views to Users
    • Pages
    • Partials
    • Linking Pages
    • Layouts
    • Form Helpers and Showing Errors
    • Displaying Links for Pagination
    • Date, Media, and Text Helpers
    • Creating Custom View Helpers
    • Localization
  • Database Interaction Through Models
    • 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
    • Database Migrations
      • Migrations in Production
    • Using Multiple Data Sources
  • Plugins
    • Installing and Using Plugins
    • Developing Plugins
    • Publishing Plugins
  • Project Documentation
    • Overview
  • External Links
    • Source Code
    • Issue Tracker
    • Sponsor Us
    • Community
Powered by GitBook
LogoLogo
On this page
  • Synopsis
  • Description
  • Subcommands
  • Options
  • Direct Usage
  • Examples
  • Run all optimizations
  • Optimize with detailed output
  • Dry run to preview changes
  • Optimize specific areas
  • Optimization Areas
  • Database
  • Assets
  • Caching
  • Code
  • Output Example
  • Configuration
  • Optimization Strategies
  • Development Mode
  • Production Mode
  • Balanced Mode
  • Advanced Options
  • Selective Optimization
  • Performance Budgets
  • Integration
  • Build Process
  • CI/CD Pipeline
  • Optimization Reports
  • Generate Report
  • Report Contents
  • Rollback
  • Best Practices
  • Performance Monitoring
  • Common Issues
  • Over-optimization
  • Solutions
  • Use Cases
  • Notes
  • See Also

Was this helpful?

Edit on GitHub
Export as PDF
  1. Command Line Tools
  2. Command Reference
  3. Performance Commands

wheels optimize

Base command for application optimization.

Synopsis

wheels optimize [subcommand] [options]

Description

The wheels optimize command provides tools to improve your Wheels application's performance. It analyzes and optimizes various aspects including database queries, asset delivery, caching strategies, and code execution.

Subcommands

Command
Description

performance

Comprehensive performance optimization

Options

Option
Description

--help

Show help information

--version

Show version information

Direct Usage

When called without subcommands, runs automatic optimizations:

wheels optimize

This performs:

  1. Database query optimization

  2. Asset minification and bundling

  3. Cache configuration

  4. Code optimization

Examples

Run all optimizations

wheels optimize

Optimize with detailed output

wheels optimize --verbose

Dry run to preview changes

wheels optimize --dry-run

Optimize specific areas

wheels optimize --only=database,assets

Optimization Areas

Database

  • Index analysis and creation

  • Query optimization

  • Connection pooling

  • Cache configuration

Assets

  • JavaScript minification

  • CSS optimization

  • Image compression

  • Bundle creation

Caching

  • Query cache setup

  • Page cache configuration

  • Object cache optimization

  • CDN integration

Code

  • Dead code elimination

  • Function optimization

  • Memory usage reduction

  • Startup time improvement

Output Example

Wheels Application Optimization
==============================

Analyzing application...
✓ Scanned 245 files
✓ Analyzed 1,234 queries
✓ Checked 456 assets

Optimizations Applied:
---------------------

Database (4 optimizations)
  ✓ Added index on users.email
  ✓ Added composite index on orders(user_id, created_at)
  ✓ Optimized slow query in ProductModel.cfc
  ✓ Enabled query caching for static queries

Assets (3 optimizations)
  ✓ Minified 23 JavaScript files (saved 145KB)
  ✓ Optimized 15 CSS files (saved 67KB)
  ✓ Compressed 34 images (saved 2.3MB)

Caching (2 optimizations)
  ✓ Configured Redis for object caching
  ✓ Enabled page caching for static routes

Code (3 optimizations)
  ✓ Removed 12 unused functions
  ✓ Optimized application startup
  ✓ Reduced memory footprint by 15%

Performance Impact:
  - Page load time: -32% (2.4s → 1.6s)
  - Database queries: -45% (avg 23ms → 12ms)
  - Memory usage: -15% (512MB → 435MB)
  - Startup time: -20% (8s → 6.4s)

Configuration

Configure via .wheels-optimize.json:

{
  "optimize": {
    "database": {
      "autoIndex": true,
      "queryCache": true,
      "slowQueryThreshold": 100
    },
    "assets": {
      "minify": true,
      "bundle": true,
      "compress": true,
      "compressionQuality": 85
    },
    "cache": {
      "provider": "redis",
      "ttl": 3600,
      "autoEvict": true
    },
    "code": {
      "removeDeadCode": true,
      "optimizeStartup": true,
      "memoryOptimization": true
    }
  }
}

Optimization Strategies

Development Mode

Focuses on developer experience:

wheels optimize --env=development
  • Faster rebuilds

  • Source maps preserved

  • Debug information retained

Production Mode

Maximum performance:

wheels optimize --env=production
  • Aggressive minification

  • Dead code elimination

  • Maximum compression

Balanced Mode

Balance between size and debuggability:

wheels optimize --mode=balanced

Advanced Options

Selective Optimization

# Only database optimizations
wheels optimize --only=database

# Exclude asset optimization
wheels optimize --skip=assets

# Specific optimizations
wheels optimize --optimizations=minify,compress,index

Performance Budgets

# Set performance budgets
wheels optimize --budget-js=200kb --budget-css=50kb

# Fail if budgets exceeded
wheels optimize --strict-budgets

Integration

Build Process

{
  "scripts": {
    "build": "wheels optimize --env=production",
    "build:dev": "wheels optimize --env=development"
  }
}

CI/CD Pipeline

- name: Optimize application
  run: |
    wheels optimize --env=production
    wheels optimize --verify

Optimization Reports

Generate Report

wheels optimize --report=optimization-report.html

Report Contents

  • Before/after metrics

  • Optimization details

  • Performance graphs

  • Recommendations

Rollback

If optimizations cause issues:

# Create backup before optimizing
wheels optimize --backup

# Rollback to backup
wheels optimize --rollback

# Rollback specific optimization
wheels optimize --rollback=database

Best Practices

  1. Test After Optimization: Verify functionality

  2. Monitor Performance: Track real-world impact

  3. Incremental Approach: Optimize gradually

  4. Keep Backups: Enable rollback capability

  5. Document Changes: Track what was optimized

Performance Monitoring

After optimization:

# Verify optimizations
wheels optimize --verify

# Performance benchmark
wheels optimize --benchmark

# Compare before/after
wheels optimize --compare

Common Issues

Over-optimization

  • Breaking functionality

  • Debugging difficulties

  • Longer build times

Solutions

  • Use balanced mode

  • Keep source maps in development

  • Test thoroughly

Use Cases

  1. Pre-deployment: Optimize before production

  2. Performance Issues: Fix slow applications

  3. Cost Reduction: Reduce resource usage

  4. User Experience: Improve load times

  5. Scalability: Prepare for growth

Notes

  • Always backup before optimization

  • Some optimizations require restart

  • Monitor application after optimization

  • Optimization impact varies by application

See Also

PreviousPerformance CommandsNextwheels optimize performance

Last updated 2 days ago

Was this helpful?

- Detailed performance optimization

- Performance analysis

- Cache management

- Configuration management

wheels optimize performance
wheels analyze performance
wheels cache
wheels config