Performance Optimization
4 min read
If your site is experiencing slowness related to Smart Cycle Discounts, this guide covers optimization strategies and performance troubleshooting for stores of all sizes.
Performance Factors #
What Affects Performance #
| Factor | Impact | Controllable? |
|---|---|---|
| Number of products | High | Limited |
| Number of campaigns | Medium | Yes |
| Campaign complexity | Medium | Yes |
| Server resources | High | Yes (hosting) |
| Caching configuration | High | Yes |
| Database optimization | Medium | Yes |
Recommended Settings by Store Size #
Small Store (<1,000 products) #
- Default settings work well
- Basic caching plugin recommended
- No special optimization needed
Medium Store (1,000-10,000 products) #
- Enable plugin caching
- Use page caching plugin
- Optimize database periodically
- Consider object caching
Large Store (10,000+ products) #
- Required: Object caching (Redis/Memcached)
- Required: Page caching
- Recommended: CDN
- Recommended: Server-level cron
- Enable optimized query mode
Caching Optimization #
Plugin Cache Settings #
- Go to SC Discounts → Settings → Advanced
- Enable Caching: Yes
- Set appropriate cache duration:
- Small stores: 12-24 hours
- Medium stores: 6-12 hours
- Large stores: 1-6 hours
Object Caching #
For best performance, use persistent object caching:
| Option | Best For |
|---|---|
| Redis | High-traffic sites, best performance |
| Memcached | Shared hosting with Memcached support |
| APCu | Single-server setups |
Page Caching #
Use a page caching plugin:
- WP Rocket (premium, excellent)
- WP Super Cache (free)
- W3 Total Cache (free, complex)
- LiteSpeed Cache (if using LiteSpeed server)
Important: Ensure cart and checkout pages are excluded from caching.
Database Optimization #
Optimize Plugin Tables #
- Go to SC Discounts → Tools
- Click “Optimize Database”
- Tables are analyzed and optimized
Run monthly or after bulk changes.
Clean Old Data #
- Go to SC Discounts → Settings → Advanced
- Set reasonable data retention periods:
- Analytics: 180-365 days
- Debug logs: 7-14 days
- Draft cleanup: 7 days
WordPress Database Optimization #
- Clean post revisions
- Remove spam comments
- Optimize all tables periodically
- Use a plugin like WP-Optimize
Campaign Optimization #
Reduce Active Campaigns #
- Fewer active campaigns = faster price calculations
- Pause campaigns you’re not using
- Delete expired campaigns you don’t need
Simplify Product Selection #
More efficient (faster):
- “All Products” with simple exclusions
- Category-based selection
- Tag-based selection
Less efficient (slower):
- Many specific products selected individually
- Complex nested conditions
- Multiple OR conditions
Optimize Conditions #
Efficient: - Category equals "Sale" - Tag equals "discount" Less Efficient: - Category equals "A" OR Category equals "B" OR Category equals "C" OR... - Price greater than X AND less than Y AND...
Query Optimization #
For Large Catalogs #
- Go to SC Discounts → Settings → Advanced
- Set Query Mode: Optimized
- Adjust Batch Size as needed:
- Higher batch size = fewer queries, more memory
- Lower batch size = more queries, less memory
Recommended Batch Sizes #
| Products | Batch Size |
|---|---|
| <5,000 | 100 |
| 5,000-20,000 | 200-300 |
| 20,000+ | 500 |
Server Optimization #
PHP Settings #
Recommended PHP configuration:
memory_limit = 256M (or higher for large stores) max_execution_time = 300 max_input_vars = 3000
Hosting Considerations #
| Hosting Type | Performance | Recommendation |
|---|---|---|
| Shared | Limited | OK for small stores |
| Managed WP | Good | Good for medium stores |
| VPS | Very Good | Good for large stores |
| Dedicated | Excellent | Best for high-traffic |
Enable OPcache #
Ensure PHP OPcache is enabled (usually is by default on modern hosting).
Frontend Performance #
Price Calculation Caching #
Discounted prices are cached to avoid recalculation:
- First load calculates and caches
- Subsequent loads use cache
- Cache invalidates when campaigns change
Minimize Displayed Products #
- Limit products per page (24-36 typical)
- Use pagination, not infinite scroll
- Lazy load product images
Cart Fragment Optimization #
If cart fragments are slow:
- Check caching plugin settings
- Ensure cart fragments not cached
- Consider cart fragment optimization plugins
Diagnosing Slowness #
Identify the Bottleneck #
-
Is it database-related?
- Check query monitor plugin
- Look for slow queries
-
Is it PHP-related?
- Check PHP execution time
- Enable WP_DEBUG_LOG temporarily
-
Is it server-related?
- Check server resource usage
- Contact hosting for insights
Query Monitor Plugin #
Install Query Monitor to identify slow queries:
- Install “Query Monitor” plugin
- Visit slow pages
- Check for slow or duplicate queries
- Look for queries related to SCD tables
Enable Debug Mode #
- Go to SC Discounts → Settings → Advanced
- Enable Debug Mode
- Set Log Level to “Debug”
- Check logs for timing information
Performance Testing #
Before and After #
When making optimizations, measure:
- Page load time (use browser developer tools)
- Time to first byte (TTFB)
- Database query count and time
Testing Tools #
- GTmetrix
- Google PageSpeed Insights
- Pingdom
- WebPageTest
Load Testing #
For high-traffic preparation:
- Use tools like Loader.io or k6
- Test with realistic traffic patterns
- Monitor server during tests
Quick Wins #
Immediate Improvements #
- Clear all caches
- Optimize plugin database tables
- Pause unused campaigns
- Enable plugin caching if disabled
Medium-Term Improvements #
- Install a page caching plugin
- Set up object caching
- Optimize database regularly
- Clean old analytics data
Long-Term Improvements #
- Upgrade hosting if needed
- Implement CDN
- Set up server-level cron
- Regular performance monitoring
When to Contact Support #
Contact support if:
- Slowness started after plugin update
- Specific pages consistently slow
- Database queries seem abnormal
- Error messages appearing
Include in support request:
- System report
- Query Monitor data (if available)
- Specific slow pages/actions
- What optimizations you’ve tried