Relatively slow WP web pages on new nginx + PHP-FPM + redis

Discussion in 'Server Operation' started by labsy, Sep 10, 2019.

  1. labsy

    labsy Member

    Hi,
    I've setup brand new Ubuntu 18.04 with nginX, following this tutorial: https://www.howtoforge.com/tutorial/perfect-server-ubuntu-18-04-nginx-bind-dovecot-and-ispconfig-3/
    Then I setup the 1 and only web site on WORDPRESS, without any security plugins. But it was not blazing fast :(
    So I tweaked nginx and Myslq a bit, added redis cache in RAM-only config (no disk caching), enabled VARY gzip compression.
    ...but still web page is not blazing fast. What bothers me the most, is that images visibly reload after I click any menu option, despit the fact, that those images are at exact same location as before, only lower part of page should chang,e while top part is the same.
    Where is the catch? Why images reload? Is it nginx, or Wordpress? Or redis or PHP-FPM 7.2? Or something else?
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    What reasons do you have to expect blazing speeds? I notice you tell nothing at all of the hardware this setup runs on.
    You should also define blazing speed. There are websites that test page loading speeds, that would give some numbers so we can agree on what is normal speed and what is blazing speed.
    Have you monitored how much ram is used on that host when loaded? Use
    Code:
    free -h
    to get info on used memory, free memory and swap. If host is already short on ram, adding caching to ram is going to make it slower.
    What is load on that host? Use command uptime or top to see load.
    Your own browser should cache images. When the URL is exact same, image does not get reloaded from the server. If you test on the server, and images are not cached, maybe there is not free RAM to put the images into?
     
  3. Steini86

    Steini86 Active Member

  4. labsy

    labsy Member

    Hi Teleman,
    yes, I did not provide details, because I thought I might flood the thread with too much info. This is VM on ESXi 6.5, running 2x 20-Core XEON, 196 GB RAM in total, and on local RAID 10 array, consisting of 8 SAS 12G SSD disks...pretty hot hardware. And load is close to nothing.
    On VM itself, RAM is not overcommited:
    Code:
    # free -h
                  total        used        free      shared  buff/cache   available
    Mem:            11G        1.5G        7.6G         54M        2.7G        9.9G
    Swap:          4.0G          0B        4.0G
    
    What I think is I might have misconfigured server somewhere, but have no idea at what level. Could be at PHP-FPM, nginX, cache or Ubuntu core level. Might be some stupid switch, which I am not aware of....but also it might beall together put in some wrong manner. It's pretty hard to guess, and also pretty hard for me to ask the right question. But I will be more than happy to finally discover, that Wordpress page is simply badly optimized and my server is just fine.
    But in initial phase, when I am not yet sure, what I know is:
    - similar site is setup on Wordpress on some other hosting provider, and images do not reload, clicking on links instantly displays content
    - on my server, images visibly flicker upon reloading, and there's some 1-second rendering lag when clicking on links, even on visited ones. And yes, I did PageSpeed test: 21/100, mostly due to badly optimized and large images, then also due to JavaScripts loading on each page load. Could this make image flickering upon every single click?
    If someone is interested, I might send you both web site links to see the difference.
     
  5. Steini86

    Steini86 Active Member

    Have never seen this image flickering, can't help you on that. Maybe a java script problem? JPG images can quickly be optimized by "jpegoptim". You barely use any ram. Have you set php_fpm to on_demand? Try static instead, should improve performance (on the cost of ram!).
     
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    That info is good. Now I see why you are not satisfied with the performance. I can not point to the reason, but I can offer suggestions on how to find out what is going on:
    1. Is that dedicated host your own so you know there is nothing more running on it? If the ESXi host is overloaded, the virtual machines can not perform well
    2. I undestand from your first post Wordpress was slow from the beginning, so the slowness did not come with installing the plugins to speed it up? Have you tried running this Wordpress site on some other host, to rule out the possibility that site is just so abysmally bad that it can not run fast on any hardware?
    3. You wrote you created only one site and that is this Wordpress site? Can you create another site and put only static website there, perhaps with big images to display and see if also that performs very slow. Then it is not Worpress fault.
    4. I have not used vmware, just tried installing it once but found out I prefer Proxmox. But from Proxmox I know there are lots of settings for virtual machines, and they affect performance. But I do not know what the good settings are for ESXi.
    5. Have you checked network connection between your workstation and that server? How is bandwith and ping?
    Just a recent experience of mine: A Wordpress site got suddenly very slow, loading any page took 2 minutes. After half a day of searching, I discovered that some update to wordpress or the plugins the previous day installed some javascript, that took a 2 minute timeout if the site was not using HTTPS. I did not find which script it was, I just left site running with Let's Encrypt certificate.
    So just do research, try to find test that measure only one thing so you can rule it out as culprit or find things that do not run well. That said, on that hardware even a very bad site should load fast, at least after everything is cached in memory. So there may be some strange thing that slows it down, like my experience with javascript that assumed https everywhere. That pagespeed tool that @Steini86 mentioned should help you see at what point in loading the page it is slow.
     
    Last edited: Sep 11, 2019
    ahrasis likes this.

Share This Page