Loading...

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 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

Ask or search...
Ctrl K
Loading...

wheels optimize (Coming Soon)

This command may not work as expected. A complete and stable version is coming soon.

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