High Resource Usage

Diagnose CPU spikes, memory leaks, and I/O bottlenecks. Optimize your scripts, database, and hosting environment.

What Causes High Resource Usage?

On shared hosting, your account has CPU, memory, I/O, and process limits. Exceeding them can cause your site to slow down, return 503 errors, or get temporarily suspended. Common culprits include unoptimized database queries, runaway cron jobs, bloated CMS installations, and traffic spikes.

cPanel Resource Metrics

In cPanel, go to Metrics → Resource Usage to see your account's consumption. Key metrics to watch:

  • CPU Usage — processing power consumed by your scripts
  • Physical Memory (RAM) — how much memory your processes are using
  • I/O Usage — disk read/write operations
  • Entry Processes — concurrent PHP processes (simultaneous visitors being served)
  • Number of Processes — total running processes including cron, mail, etc.
  • Inodes — number of files and directories (cache bloat is a common cause)

Identifying Resource-Heavy Scripts

On a VPS or dedicated server, use these commands to find what's consuming resources:

# Real-time process monitor (CPU and memory)
top

# Better interactive monitor (install if needed)
htop

# Check memory usage
free -m

# Check disk space
df -h

# Check disk I/O in real-time
iotop

# Find the largest files (cache/log bloat)
du -sh /home/*/public_html/* | sort -rh | head -20

# Find processes consuming the most CPU
ps aux --sort=-%cpu | head -10

# Find processes consuming the most memory
ps aux --sort=-%mem | head -10

WordPress Optimization

WordPress is the most common cause of high resource usage on shared hosting. Here's how to tame it:

Plugin Audit

  • Deactivate all plugins, then reactivate one at a time while monitoring resource usage
  • Remove plugins you're not actively using — even deactivated plugins can load code
  • Replace heavy plugins with lighter alternatives (e.g., use native lazy loading instead of a plugin)
  • Avoid plugins that run frequent background tasks or external API calls

Caching

Install a caching plugin to serve static HTML instead of regenerating pages on every request. Popular options: WP Super Cache, W3 Total Cache, LiteSpeed Cache (if on LiteSpeed server).

Database Cleanup

# Common WordPress database bloat:
# - Post revisions (wp_posts table)
# - Transients (wp_options table)
# - Spam comments
# - Orphaned metadata

# Limit post revisions in wp-config.php:
define('WP_POST_REVISIONS', 5);

# Disable revisions entirely:
define('WP_POST_REVISIONS', false);

PHP OPcache

OPcache stores precompiled PHP bytecode in memory, eliminating the need to parse and compile PHP files on every request. This dramatically reduces CPU usage:

# In php.ini or .user.ini
[opcache]
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
opcache.fast_shutdown=1

Database Query Optimization

  • Add indexes to columns used in WHERE, JOIN, and ORDER BY clauses
  • Avoid SELECT * — only query the columns you need
  • Limit result sets — use LIMIT and pagination for large tables
  • Enable the slow query log to find expensive queries
# Enable MySQL slow query log
# In /etc/mysql/mysql.conf.d/mysqld.cnf
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow-query.log
long_query_time = 2

# Then analyze the log
mysqldumpslow /var/log/mysql/slow-query.log

Image Optimization & CDN

  • Compress images before upload — use WebP format for 25-35% smaller files
  • Implement lazy loading so images below the fold don't load until scrolled to
  • Use a CDN (Cloudflare, BunnyCDN) to serve static assets from edge servers closer to visitors, reducing load on your origin server
  • Set proper cache headers so browsers don't re-download unchanged assets

Browser Caching via .htaccess

# Cache static assets for 1 year
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/webp "access plus 1 year"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType image/svg+xml "access plus 1 year"
    ExpiresByType font/woff2 "access plus 1 year"
</IfModule>

# Enable gzip compression
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/json
    AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>

Cron Job Optimization

  • Don't run heavy cron jobs every minute — reduce frequency to what's actually needed
  • Stagger cron jobs so they don't all execute at the same time
  • For WordPress, disable wp-cron.php (triggered on every page load) and use a real server cron job instead:
# In wp-config.php, disable WP-Cron
define('DISABLE_WP_CRON', true);

# Then add a real cron job (every 15 minutes)
*/15 * * * * /usr/bin/curl -s https://yourdomain.com/wp-cron.php > /dev/null 2>&1

When to Upgrade

Signs You've Outgrown Shared Hosting

If you've optimized everything and still hit limits, it's time to move up:

  • Consistent CPU/memory limit warnings from your host
  • More than 50,000 monthly visitors
  • Running resource-heavy applications (e-commerce, SaaS)
  • Need for root access, custom server config, or specific software

Upgrade path: Shared → VPS → Dedicated Server → Cloud (AWS, DigitalOcean, Linode)

Pro Tip

Before upgrading hosting, try Cloudflare's free tier. It caches static content, blocks bots, and reduces server load significantly — often enough to keep a busy site on shared hosting.