You just finished migrating your site—congratulations. But if you refresh the page and it loads slower than before, you're not alone. A migration often resets performance settings, breaks cached assets, or introduces new bottlenecks. The good news: a few targeted optimizations can get you back to—or beyond—your previous speed. This guide walks through five practical steps, each with concrete analogies and decision criteria, so you can boost both performance and user experience without guesswork.
Think of a post-migration site like a freshly unpacked kitchen. The appliances are in place, but the knives are still in the box, the pots are stacked in the wrong cabinet, and you can't find the salt. Performance optimization is the process of organizing that kitchen so you can cook a meal in minutes instead of an hour. We'll cover baseline measurement, caching, images, CDN, and database tuning—in that order.
Step 1: Establish a Performance Baseline
Before you change anything, you need to know where you stand. A baseline gives you a reference point to measure progress and catch regressions. Without it, you're guessing which tweaks actually helped.
What to measure
Focus on metrics that directly affect user experience: Largest Contentful Paint (LCP), First Input Delay (FID), Cumulative Layout Shift (CLS), and Time to First Byte (TTFB). Use tools like Lighthouse, WebPageTest, or the Chrome DevTools Performance panel. Run tests from different geographic locations and on both desktop and mobile.
How to run a clean baseline test
Clear caches, disable any temporary redirects, and test during off-peak hours. Run at least three tests and take the median value. Record the raw numbers and also note which resources are largest (images, scripts, fonts). This data will guide every subsequent decision.
A common mistake is to skip the baseline and jump straight to caching. Without a baseline, you might enable aggressive caching and think the speed improvement came from that, when in reality a slow third-party script was the culprit. The baseline tells you what to fix first.
If your TTFB is above 800 ms after migration, your new server may need tuning. If LCP is driven by a hero image that's 2 MB, you know where to start. The baseline also helps you set realistic targets: aim for LCP under 2.5 seconds, FID under 100 ms, CLS under 0.1.
Step 2: Configure Caching and Compression
Caching is the single highest-impact optimization for most sites after migration. It reduces server load and speeds up repeat visits. However, many migrations reset server-level caching rules, so you'll need to reconfigure them.
Browser caching vs. server caching
Browser caching tells the visitor's browser to store static assets (CSS, JS, images) locally for a set time. Server caching stores rendered HTML pages or database queries so they don't have to be regenerated on every request. Both are essential, but they solve different problems.
For browser caching, set Cache-Control headers with a max-age of at least one year for versioned assets (e.g., style.v2.css). For HTML pages, use a shorter max-age (e.g., 10 minutes) or no-cache if content changes frequently. Server caching depends on your stack: use Redis or Varnish for dynamic sites, or a page cache plugin for WordPress (e.g., WP Rocket, W3 Total Cache).
Compression: Gzip and Brotli
Enable compression to reduce the size of text-based resources. Brotli generally compresses better than Gzip, but not all servers support it. Check if your new host offers Brotli at the server level; if not, configure Gzip via .htaccess or nginx config. Compression alone can cut transfer size by 60–70%.
A concrete analogy: caching is like having a pantry stocked with your most-used ingredients. Compression is like vacuum-sealing those ingredients so they take up less shelf space. Both save time and effort.
Watch out for plugin conflicts after migration. Some caching plugins may not work correctly on the new server due to different PHP versions or missing extensions (e.g., Redis extension not installed). Test caching by checking response headers: look for 'x-cache: HIT' or 'cf-cache-status: HIT'. If you see 'MISS', something is misconfigured.
Step 3: Optimize Images for the New Environment
Images often account for 50–70% of a page's weight. After migration, image paths may break, compression settings may revert, and lazy loading may stop working. This step ensures images are as lean as possible without sacrificing quality.
Choose the right format and compression level
Use modern formats like WebP or AVIF, which offer better compression than JPEG or PNG. Many CDNs and image optimization services can convert on the fly. If you self-host, batch-convert your image library using tools like Squoosh or ImageMagick.
Set compression quality to 80–85% for photographs (lossy) and use lossless for graphics with sharp edges. For screenshots, consider PNG with palette reduction. Don't forget to serve responsive images with srcset and sizes attributes so mobile users don't download desktop-sized files.
Lazy loading and preload
Implement native lazy loading (loading='lazy') for images below the fold. For critical above-the-fold images, use preload hints: <link rel='preload' as='image' href='hero.webp'>. This tells the browser to fetch the hero image early, improving LCP.
After migration, verify that lazy loading is actually working. Some migration tools strip attributes or change image paths. Use Chrome DevTools to check that images are loading on demand and not all at once.
A practical scenario: a news site migrated from Apache to Nginx and noticed hero images were loading slowly. The issue was that the new server didn't have the WebP module enabled, so all images were served as JPEG. Enabling WebP and adding a CDN cut image transfer size by 40% and improved LCP by 1.2 seconds.
Step 4: Set Up a Content Delivery Network (CDN)
A CDN distributes your static assets across multiple geographic edge servers, reducing latency for visitors far from your origin server. After migration, your old CDN configuration may not transfer automatically, so you'll need to set it up again—or choose a new provider if your host doesn't include one.
CDN vs. no CDN: trade-offs
Pros: faster load times for global visitors, reduced origin server load, DDoS protection. Cons: additional cost (though many hosts include a basic CDN), cache invalidation complexity, and potential SSL configuration issues. For most sites, the speed benefits outweigh the downsides.
Choose a CDN that integrates well with your stack. Cloudflare offers a free tier with SSL and caching. KeyCDN and BunnyCDN are affordable for smaller sites. If you're on a platform like Shopify or WordPress.com, the built-in CDN may suffice.
Configuration checklist
After signing up, point your DNS to the CDN (usually via CNAME or nameserver change). Enable SSL (HTTPS) and set caching rules: cache static assets for long periods (1 year), HTML for a short time (10 minutes), and never cache admin pages or cart pages. Test by checking response headers for 'cf-cache-status' or 'x-cache'.
One common pitfall: cache invalidation. When you update a CSS file, the CDN may still serve the old version for hours. Use versioned filenames (e.g., style.v2.css) or purge the CDN cache manually after updates. Some CDNs offer instant purge via API.
Another issue: mixed content warnings. If your origin serves HTTP but the CDN forces HTTPS, some resources may load over HTTP, causing browser warnings. Ensure all internal links use relative or protocol-relative URLs (//example.com/image.jpg) or update them to HTTPS.
Step 5: Tune the Database and Server
After migration, database queries may run slower due to different MySQL versions, missing indexes, or configuration drift. Server-level settings like PHP memory limit, opcode cache, and keep-alive also affect performance.
Database optimization
Start by checking slow query logs. If you see queries taking more than 1 second, add indexes or rewrite them. For WordPress sites, use a plugin like Query Monitor to identify slow queries. Common fixes: enable query caching, optimize tables with OPTIMIZE TABLE, and switch to InnoDB if you're still on MyISAM.
Consider using a persistent object cache like Redis or Memcached to store database query results. This reduces the number of queries per page load. Many hosts offer Redis as a one-click add-on.
Server configuration tweaks
Increase PHP memory limit to at least 256 MB if your site uses a page builder or heavy plugins. Enable opcode caching (OPcache) to store compiled PHP scripts in memory. Set keep-alive timeout to 5–10 seconds to allow multiple resources to be fetched over one connection.
If you're on Nginx, check the worker_processes and worker_connections settings. A common rule of thumb: worker_processes = number of CPU cores, worker_connections = 1024 per core. For Apache, switch to the event MPM if possible, as it handles concurrent connections better than prefork.
A real-world example: a WooCommerce store migrated to a new VPS and saw checkout pages timing out. The issue was a low PHP memory limit (64 MB) that couldn't handle the cart and payment gateway scripts. Raising it to 256 MB and enabling OPcache reduced checkout load time from 12 seconds to 3 seconds.
Risks of Skipping Steps or Choosing Wrong Approaches
Optimization isn't risk-free. Rushing or skipping steps can lead to worse performance, security holes, or broken functionality. Here are the most common pitfalls.
Over-caching dynamic content
If you cache pages that contain user-specific data (shopping cart, login state), visitors may see each other's information. Always exclude dynamic pages from cache using cookies or URL patterns. Test by visiting a page as a logged-in user and then as a guest; they should see different content.
CDN misconfiguration causing SSL errors
If your CDN's SSL certificate doesn't match your domain, or if you use a shared certificate, visitors may see 'Your connection is not private' warnings. Always use a dedicated certificate or let the CDN auto-provision one via Let's Encrypt.
Image optimization that degrades quality
Aggressive compression can make images look blurry or pixelated. Always preview images after conversion and keep original backups. Use lossy compression for photographs and lossless for logos and icons.
Database changes that break queries
Adding indexes can speed up reads but slow down writes. For write-heavy sites (forums, social networks), test index changes on a staging environment first. Similarly, switching storage engines (MyISAM to InnoDB) may require schema changes.
The key is to change one thing at a time and measure the impact. If you enable caching, compression, CDN, and database tuning all at once, you won't know which change caused a problem. Use your baseline metrics to validate each step.
Frequently Asked Questions
How long should I wait after migration before optimizing?
Start optimizing immediately after verifying that the site is fully functional (all pages load, forms work, no 404s). Delaying optimization means visitors experience a slow site, which hurts engagement and SEO. However, run a baseline test first—don't optimize blind.
Should I use a performance plugin or do it manually?
It depends on your technical comfort. Plugins like WP Rocket or W3 Total Cache are beginner-friendly and cover caching, minification, and lazy loading. Manual configuration (via .htaccess, nginx config, or CDN settings) gives more control but requires server access. For most site owners, a good plugin is sufficient. Just avoid using multiple caching plugins simultaneously—they conflict.
Will enabling HTTPS slow down my site?
HTTPS adds a TLS handshake, which can increase TTFB by 100–200 ms. However, modern protocols like TLS 1.3 and HTTP/2 reduce the overhead. The SEO and security benefits outweigh the slight speed cost. Use a CDN with SSL termination to offload the handshake to edge servers.
How do I know if my CDN cache is working?
Check response headers. If you see 'cf-cache-status: HIT' (Cloudflare) or 'x-cache: HIT' (other CDNs), the resource was served from cache. If you see 'MISS' or 'DYNAMIC', the request went to origin. You can also use tools like Pingdom or GTmetrix to see the server location and cache status.
What if my site is slower after migration despite following these steps?
Rarely, the new host may have inferior hardware or network peering. Check TTFB from multiple locations; if it's consistently high, contact your host. Also verify that no old DNS records are still pointing to the previous server. Use a tool like What's My DNS to check propagation. If all else fails, consider reverting to the old host or migrating to a different provider.
Putting It All Together: Your Post-Migration Optimization Plan
By now, you have a clear sequence: baseline → caching & compression → images → CDN → database & server. Each step builds on the previous one, and each has measurable impact. Here's a quick recap of next actions:
- Run a baseline performance test and save the results.
- Enable browser and server caching; set Cache-Control headers; enable Brotli or Gzip compression.
- Convert images to WebP/AVIF, add lazy loading, and preload hero images.
- Choose a CDN, configure DNS, set caching rules, and test for HIT status.
- Optimize database queries, enable object cache, increase PHP memory, and enable OPcache.
After each step, re-run your baseline test to see the improvement. If a step doesn't yield gains, investigate why—maybe your server already had that setting, or a plugin is overriding it. Document your changes so you can revert if needed.
Finally, remember that performance optimization is not a one-time task. Monitor your site regularly using tools like Lighthouse CI or Calibre. As your content grows and your audience changes, revisit these steps. A well-optimized site after migration is not just faster—it's more reliable, more engaging, and better for your business.
Comments (0)
Please sign in to post a comment.
Don't have an account? Create one
No comments yet. Be the first to comment!