4

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

  • Have you checked MySQL's query cache? Do you Have an extremely large wp_options table? – janh Feb 1 '18 at 3:37
  • .its not big, just 4 posts, but I think it was disabled by default mysqlserverteam.com/… – James Guana Feb 1 '18 at 9:42
  • wp_options, not wp_posts, should heavily profit from query cache, but with such a small site, it sounds unlikely that WP has accumulated a lot there. Can you trigger the behavior by restarting php-fpm/nginx/mysql? – janh Feb 1 '18 at 9:48
  • Restarting/Shutting down the server did not trigger the issue, I also cleared opcache, before restarting/Shutting down server. I find that page loads for 0.3s only, so I guess, my server is always primed to serve files even on fresh restart/Shutting down + boot. – James Guana Feb 1 '18 at 10:02
  • 1
    I think I might have found the culprit. Every time this happens, I noticed that wp-cron launches, I disabled that for now, and still testing. – James Guana Feb 10 '18 at 0:59
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.

  • Hi, thanks for the information. Based on the current testing I made it seems, the problem is wordpress php. I rebuilded the site using the same server but I used my own php codes. Now, it can load in just 34-170ms for the full featured site vs 300ms - 500ms for wordpress in localhost. – James Guana Sep 28 '18 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.