Skip to content
  • Quick Ref
  • Contact
  • About
wpcanyon.com

wpcanyon.com

Reduce TTFB on cheap hosting (object cache & OPcache)

Posted on August 19, 2025 By Admin No Comments on Reduce TTFB on cheap hosting (object cache & OPcache)

Reduce TTFB on Cheap Hosting (Object Cache & OPcache)

Time To First Byte (TTFB) is a critical performance metric for WordPress sites. On cheap hosting, slow TTFB can frustrate visitors and harm SEO. The good news: you can significantly reduce TTFB by enabling OPcache and object caching, cleaning up your database, and using a CDN. This guide walks you through practical steps to speed up your WordPress site without expensive hosting upgrades.

Quick Fix

  1. Enable PHP OPcache on your server.
  2. Activate an object caching plugin like Redis or Memcached.
  3. Clean up your WordPress database to remove overhead.
  4. Integrate a CDN to serve static assets closer to users.

Why This Happens

Cheap hosting often uses shared resources and limited server configurations, resulting in slower PHP execution and database queries. Without caching, every page load triggers PHP scripts and database calls from scratch, increasing TTFB. OPcache stores precompiled PHP bytecode in memory, reducing script load times. Object caching stores database query results in memory, cutting down repeated queries. Cleaning the database removes bloat that slows queries. A CDN reduces latency by serving assets from edge servers near visitors.

Step-by-step

1. Enable OPcache

OPcache is a PHP extension that caches compiled script bytecode. Many cheap hosts support it but may not enable it by default.

  1. Check if OPcache is enabled by creating a phpinfo.php file in your WordPress root with this content:
    <?php
    phpinfo();
    ?>
  2. Access yourdomain.com/phpinfo.php and search for “OPcache”. If enabled, you’ll see its configuration.
  3. If not enabled, enable it via your hosting control panel or by adding this to your php.ini or .user.ini file:
    opcache.enable=1
    opcache.memory_consumption=128
    opcache.interned_strings_buffer=8
    opcache.max_accelerated_files=4000
    opcache.revalidate_freq=60
    opcache.fast_shutdown=1
  4. Restart PHP or your web server if possible.

2. Enable Object Cache

Object caching stores database query results in memory, reducing repeated queries and lowering TTFB.

  1. Check if your host supports Redis or Memcached. You can ask support or check documentation.
  2. Install a WordPress plugin for object caching, for example:
    • Redis: Redis Object Cache plugin
    • Memcached: Memcached Redux or W3 Total Cache
  3. Configure the plugin to connect to your Redis or Memcached server. Usually, this is 127.0.0.1 and default ports.
  4. Verify caching is active via the plugin’s status page.

3. Clean Up Your Database

A bloated database slows queries, increasing TTFB. Cleaning removes overhead, spam, revisions, and transient options.

  1. Backup your database before making changes.
  2. Install a plugin like WP-Optimize or Advanced Database Cleaner.
  3. Run database optimization:
    • Remove post revisions
    • Delete spam and trashed comments
    • Clear expired transients
    • Optimize database tables
  4. Schedule regular cleanups to maintain performance.

4. Use a CDN

A Content Delivery Network (CDN) reduces latency by serving static files (images, CSS, JS) from servers closer to visitors.

  1. Choose a CDN provider (Cloudflare, BunnyCDN, StackPath, etc.).
  2. Create an account and configure your domain.
  3. Change your DNS nameservers to point to the CDN (if using Cloudflare) or configure your CDN to pull from your origin server.
  4. Install a plugin like Cloudflare or CDN Enabler to integrate the CDN with WordPress.
  5. Verify static assets load from the CDN URL.

Works on

Environment Notes
Apache Supports OPcache and object cache; .htaccess may be used for CDN rewrites.
Nginx Fully compatible with OPcache and object cache; CDN integration via proxy or DNS.
LiteSpeed Supports OPcache and object cache; LiteSpeed Cache plugin can help.
cPanel Enable OPcache via MultiPHP INI Editor; Redis/Memcached often available.
Plesk Enable OPcache via PHP settings; Redis/Memcached extensions can be installed.

FAQ

Q: How do I know if OPcache is working?
A: Use a phpinfo() page or a plugin like Query Monitor to check if OPcache is enabled and caching scripts.
Q: Can I enable object caching without Redis or Memcached?
A: Yes, but it’s less efficient. Some plugins offer file-based caching, but memory-based caches like Redis/Memcached are faster.
Q: Will enabling OPcache and object cache fix all performance issues?
A: They significantly reduce TTFB but don’t replace good hosting or optimized themes/plugins. Combine with database cleanup and CDN for best results.
Q: Is it safe to clean my database with plugins?
A: Yes, if you backup first. Use reputable plugins and avoid deleting data you might need.
Q: Does using a CDN increase my hosting costs?
A: Most CDNs have free tiers or low-cost plans. They

Speed & Security Tags:Object Cache, OPcache, Performance, TTFB

Post navigation

Previous Post: Block bad bots in .htaccess (copy/paste)
Next Post: Detect and prune thin tag pages safely

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Top WordPress Themes for Blogs in 2025
  • WordPress Admin Panel Trick: Adding ID Field to the Posts Listing
  • Solution previous_posts_link and next_posts_link Not Working
  • Show Top Commentators in WordPress Without a Plugin
  • How to Style Admin Comments in WordPress

Recent Comments

    Archives

    • August 2025

    Categories

    • Admin & Blocks
    • Admin & UI
    • Automation
    • Automation & Plugins
    • Comments
    • Comparisons
    • Database & Revisions
    • Developer Snippets
    • Fixes & Errors
    • Media & Thumbnails
    • Queries & Pagination
    • Security
    • Speed & Security
    • Tips & Tricks
    • WooCommerce How‑tos
    • WordPress Snippets
    • WordPress Themes
    • Terms & Conditions
    • Affiliate Disclosure

    Copyright © 2025 wpcanyon.com.

    Powered by PressBook WordPress theme

    Also by the maker of MySurveyReviews.com