How to fix wordpress slow first time load (Local Server)?

Summary

Accessing WordPress page for the first time took about 5-7s to load from a local server vs 300-500ms for subsequent page loads on any links. Approximately 10x slower for first time access which is unacceptable. Browser cache is disabled in developer tools. How to fix?

Long Info

I noticed that whenever I access a wordpress page for the first time (like cleared everything in chrome) that page I am accessing took about 5-7s to load considering that this is a local server, that load time is unacceptable. However, after that first time load, subsequent page access just took only about 0.3-0.5s or 300-500ms (still long for local server but order of magnitude faster than the first time load). To eliminate the cache issue, I disabled it from browser developer tools, so all page requests, regardless of first time or subsequent, accesses web files directly from the server.

Test done so far

At first I though It was a server Issue, and then I transferred to localhost to see if the problem persist. And indeed it does.

I also though that it might be A DNS issue, so I checked the httpd.conf and windows DNS host files, I got 1 and only IP there, which is 127.0.0.1. I also updated the host in wordpress config.php to 127.0.0.1 as well as from the data base. Still, I get the same slowness for first time load. I argued that, if this is DNS issue then, its either the page would not load OR it loads but it should be consistently be the similar. However, the slowness is only affecting the first time load.

Server restarts, full shutdown+boot does not have an influence on page loads. Its only a matter of either its first time access by client or not.

I came through a post about nginx & php-fpm very slow on first access, where the user initially blamed his server, but It turned out, it was his CMS. And based from what I have experience, wordpress might be the cause of slow first time page load, However, I dont know which part in wordpress that I got to deal with to fix the issue, can somebody help me fix wordpress slow fist time load (on Local Server)?

Server

WAMP (localhost), 32 xeon core 2.7Ghz, 24Gb RAM, SATAIII HDD, OpCache Enable though Zend Engine

WordPress

No Plugin, v. 4.9

Client

Chrome & Firefox Cache disabled in Developer Tools, cUrl

1
1

Well website (WordPress) page speed and load depends on many things.

  1. MySql Queries
  2. Image optimisation
  3. Css files (more cs files more page load and page speed time).
  4. Javascript files ( more js files more page load and page speed time).
  5. Defer parsing of JavaScript
  6. Minify JavaScript
  7. Minify CSS
  8. Enable gzip compression
  9. Leverage browser caching
  10. Minimize request size
    And much more.

Test your website with https://gtmetrix.com and start fixing issues as the websites presents to you. For this you will need to put your local server online with ip.

Page speed and page load need a lot of attention and it is a process not a single issue.

Leave a Comment