Skip to content

Performance Issues

  • Pages with Commerce blocks load slowly (>3 seconds)
  • Product sync operations time out
  • Server CPU/memory spikes during sync
  • Admin dashboard sluggish when viewing products
  • “Maximum execution time exceeded” errors
  • PHP memory limit too low for catalog size
  • Execution time insufficient for large syncs
  • Database queries not optimized
  • Too many products syncing simultaneously
  • WordPress® object cache not configured
  • Page cache disabled or misconfigured
  • BigCommerce API responses not cached
  • Repeated unnecessary API calls
  • Product images not optimized
  • Original BigCommerce images served directly
  • No lazy loading for images
  • Missing responsive image sizes
  • Missing database indexes
  • Too many plugin/theme queries
  • Large product catalog (1,000+ products)
  • Unoptimized product queries

Configure PHP for Commerce Connect’s needs:

In wp-config.php:

// Memory limit for admin/sync operations
define('WP_MEMORY_LIMIT', '512M');
define('WP_MAX_MEMORY_LIMIT', '512M');
// Increase max execution time
set_time_limit(300); // 5 minutes

In php.ini (if accessible):

memory_limit = 512M
max_execution_time = 300
max_input_time = 300

Verify settings:

Terminal window
wp eval 'echo "Memory: " . WP_MEMORY_LIMIT . "\nMax: " . WP_MAX_MEMORY_LIMIT;'
php -i | grep memory_limit

The plugin tracks resource consumption and backs off at 85% thresholds:

  1. Check logs for resource warnings:

    Terminal window
    tail -f wp-content/debug.log | grep "backing off"
  2. Look for these patterns:

    • Product sync backing off due to resource limits
    • memory_ratio: 0.87 (87% memory used - triggering backoff)
    • execution_time_ratio: 0.89 (89% time used - triggering backoff)
  3. If consistently hitting 85%:

    • Increase memory/time limits
    • Reduce cron frequency (if customized)
    • Contact hosting provider for plan upgrade

Significantly speeds up product queries:

Install Redis or Memcached:

Terminal window
# Redis (recommended)
wp plugin install redis-cache --activate
wp redis enable
# OR Memcached
wp plugin install memcached --activate

Verify object cache active:

Terminal window
wp cache type

Expected output: redis or memcached (not default)

Monitor cache hit rate:

Terminal window
wp redis info

Look for keyspace_hits vs keyspace_misses ratio (>80% hit rate is good)

Use a caching plugin for static pages:

Options:

  1. WP Super Cache (simple, effective)
  2. W3 Total Cache (advanced features)
  3. LiteSpeed Cache (if using LiteSpeed server)

Commerce Connect compatibility notes:

  • Cache product pages - Safe, products sync updates cache
  • Cache cart page - Use edge-side includes or disable
  • Exclude checkout - Never cache checkout/cart API endpoints

Exclude these from cache:

/wp-json/commerce-connect/*
/cart/*
/checkout/*

Product images can slow pages significantly:

Enable lazy loading (WordPress® 5.5+):

// Automatic for <img> tags
// Verify in page source:
// <img loading="lazy" src="..." />

Use responsive images:

Terminal window
# Regenerate product image sizes
wp media regenerate --yes

Consider CDN for images:

  1. Configure BigCommerce to serve optimized images
  2. Or use WordPress® CDN plugin (Cloudflare, etc.)
  3. Enable WebP format if server supports it

Image optimization plugin (optional):

Terminal window
wp plugin install ewww-image-optimizer --activate

If syncing too often causes load:

Default: Every 1 minute

To reduce frequency (advanced):

// In theme functions.php or custom plugin
add_filter('cron_schedules', function($schedules) {
$schedules['every_five_minutes'] = [
'interval' => 300,
'display' => __('Every 5 Minutes')
];
return $schedules;
});
// Then re-register cron with new schedule
// Note: Requires custom code modification

⚠️ Warning: Reducing sync frequency means product updates take longer to appear.

For large catalogs, database performance matters:

Add missing indexes (if needed):

-- Check current indexes
SHOW INDEX FROM wp_posts WHERE Key_name LIKE '%post_type%';
-- Add custom index if beneficial
ALTER TABLE wp_posts
ADD INDEX idx_product_sync (post_type, post_status, post_modified);

Clean up transients:

Terminal window
wp transient delete --all

Optimize tables:

Terminal window
wp db optimize

Cron jobs should complete quickly (<60 seconds):

Check cron event timing:

Terminal window
wp cron event list --fields=hook,next_run,recurrence

Test cron execution time:

Terminal window
time wp cron event run commerce_connect_sync_products

Expected: <30 seconds for medium catalogs (<500 products)

If consistently >60 seconds:

  • Increase server resources
  • Enable object caching
  • Check for conflicting cron jobs
  • Monitor concurrent cron executions

After optimizations:

  1. Clear all caches (object, page, browser)

  2. Test page load speed:

    Terminal window
    curl -w "@curl-format.txt" -o /dev/null -s https://yoursite.com/product-page/

    Create curl-format.txt:

    time_total: %{time_total}s
  3. Verify resource usage stayed below 85% during sync:

    Terminal window
    tail -f wp-content/debug.log | grep "resource"
  4. Check browser performance:

    • Open DevTools → Network
    • Reload product page
    • Total load time should be <2 seconds
    • Largest Contentful Paint (LCP) <2.5 seconds
  5. Run speed test (optional):

Weekly checks:

  1. Monitor error logs for resource warnings
  2. Check page load times with real user monitoring
  3. Review server resource usage graphs (CPU, memory, I/O)
  4. Test checkout flow on slow connection

Monthly optimizations:

  1. Clear old transients and cached data
  2. Optimize database tables
  3. Review and prune unused plugins
  4. Update PHP to latest stable version

For growing catalogs:

Catalog SizeRecommended MemoryRecommended Setup
<100 products256MBShared hosting OK
100-500 products512MBVPS or managed WordPress®
500-2,000 products1GBManaged WordPress® + object cache
2,000+ products2GB+Dedicated resources + CDN

Scale indicators:

  • Consistent 85% resource usage warnings
  • Cron jobs taking >60 seconds
  • Page load times increasing over time
  • Customer complaints about speed

For optimal performance:

  1. Enable object caching - Single biggest impact
  2. Use page caching - Except dynamic pages (cart, checkout)
  3. Optimize images - Lazy load, responsive sizes, WebP
  4. Monitor resource limits - Increase before hitting caps
  5. Keep WordPress® updated - Core, plugins, PHP version
  6. Limit active plugins - Deactivate unused plugins
  7. Use quality hosting - Managed WordPress® hosts optimize for performance

The plugin tracks these during sync:

{
"memory_used": 134217728, // bytes
"memory_limit": 536870912, // bytes
"memory_ratio": 0.25, // 25% used
"execution_time": 45.3, // seconds
"max_execution_time": 300, // seconds
"execution_time_ratio": 0.15, // 15% used
"cron_interval": 60, // seconds
"time_until_next_cron": 12.4, // seconds
"should_back_off": false // OK to continue
}

Interpret these values:

  • memory_ratio > 0.85 → Increase memory limit
  • execution_time_ratio > 0.85 → Increase timeout
  • time_until_next_cron < 10 → Sync taking too long, optimize
  • should_back_off: true → Already at capacity, scale up

Plugin predicts if time exists for next product:

  1. Tracks max processing time per product (worst case)
  2. Predicts if current time remaining > max product time
  3. Stops processing if prediction fails (prevents incomplete sync)

To view timing data (requires debug logging):

Terminal window
grep "max_product_processing_time" wp-content/debug.log

After sync failures, backoff prevents API hammering:

Check current backoff state:

Terminal window
wp option get commerce_connect_sync_backoff --format=json

Example output:

{
"attempts": 3,
"last_failure": 1654876543,
"delay": 240
}

Interpretation:

  • attempts: 3 → 3rd consecutive failure
  • delay: 240 → Wait 240 seconds (4 min) before retry
  • last_failure → Unix timestamp of last failure

Reset backoff manually (if issue resolved):

Terminal window
wp option delete commerce_connect_sync_backoff

Use Query Monitor plugin for deep insights:

Terminal window
wp plugin install query-monitor --activate

Check for:

  1. Slow database queries (>1 second) during product load
  2. Duplicate queries (N+1 query problem)
  3. HTTP API calls - Should be minimal on cached pages
  4. PHP errors/warnings - May indicate code issues

For persistent issues, profile with Xdebug:

  1. Enable Xdebug on staging site (never production)
  2. Run product sync with profiling
  3. Analyze cachegrind output with tools like KCacheGrind
  4. Identify bottlenecks in code execution

Or use New Relic/DataDog APM for production monitoring.