Performance Optimization
Optimize nopCommerce for maximum performance.
Quick Wins
1. Enable Caching
In Admin > Configuration > General Settings:
- Enable "Use caching"
- Set appropriate cache time (600-3600 seconds)
2. Enable Response Compression
Already enabled by default in .NET Core.
3. Optimize Images
- Use WebP format where supported
- Compress images before upload
- Enable CDN for static files
Database Optimization
Add Indexes
sql
-- Check for missing indexes
SELECT * FROM sys.dm_db_missing_index_details
WHERE database_id = DB_ID('nopCommerce');Regular Maintenance
sql
-- Update statistics
EXEC sp_updatestats;
-- Rebuild indexes
ALTER INDEX ALL ON dbo.Product REBUILD;Caching Strategies
Redis Cache
json
// appsettings.json
{
"DistributedCacheConfig": {
"DistributedCacheType": "Redis",
"ConnectionString": "localhost:6379"
}
}IIS Optimizations
- Enable Output Caching
- Configure Dynamic Compression
- Enable Application Initialization
Monitoring
- Enable Application Insights (Azure)
- Monitor response times
- Track slow database queries
- Set up alerts for errors
Performance Checklist
- [ ] Caching enabled
- [ ] Images optimized
- [ ] Database indexes reviewed
- [ ] CDN configured
- [ ] Monitoring in place
- [ ] Response compression enabled