Support » Fixing WordPress » Troubleshooting slow site.

  • Resolved jamesdoesdesign

    (@jamesdoesdesign)



    Hello,

    I run a medium sized forum on wordpress on a VPS account. I have been having issues with load times. During the night it runs super duper fast. During mid-day (peak hours) it gets crawling slow and sometimes unresponsive.

    My forum software is using bbpress and buddypress plugins among a few other plugins such as wp-u-like (for liking posts) and wp-monalisa for smilies. I have about 16 plugins total that includes plugins like w3totalcache, wordfence, wp smush and other little helper plugins that help make the forum, more like a forum for instance showing a user online or their timezone instead of wordpress default time zone and the ability to block other users.

    The theme is a custom theme that I built. I did build a large user drop down that uses php and hooks like bp_loggedin_user_domain() and bp_loggedin_user_avatar() and several more which make it function like a twitter or facebook dropdown menu showing your information and helpful links to edit your profile and ability to logout. The php code is built into the functions file and called through the header. It isn’t an extremely large code but it isn’t small either. It’s around 40-50 lines de-compressed. I figured I would mention that in case that has some weird thing to do with it.

    I have been working with my hosting provider to figure out this issue. According to the host my website should run perfectly fine on the VPS that I am on. They said there is no hangups or bottlenecks or errors or anything on their end that is causing the issue. They said my database looks fine and everything is using gzip and the server is also using opcache.

    The database is fine and is optimized. Verified by the host as well.

    We removed everything from the website plugins, themes everything and started from scratch. The first thing we did was bring the wordpress files back to the account and did a gtmetrix test. The site ran flawless and so fast. Next we added back the theme and ran tests. Same results. We added the forum plugin back first. Of course adding the forum back with 8600 members and 100,000+ posts on it, it did get a tad slower with a 1-3 second page load. Which I can expect and understand. Not to mention the site gets around 200,000+ page impressions a day and around 50,000+ page views a day. So the traffic is a little bit heavy. After this we proceeded to add the rest of the plugins back into place. After that, the site began to get slow again. So we tested switching the theme and disabling the plugins. Switching the theme caused the site to still load slow.

    My host went in and looked at the memory. This is where the problem is. The memory is being used up. Most likely from Php. So, I’m not a backend developer or even a front end developer per say. I do know how to make a custom wordpress theme but that is the extent of my knowledge. I’m more of a designer. I’m not totally familiar with php except for a few things like the wrapping code for php and I know how to use echo and I’m pretty mean with the copy and paste haha!

    I’ve scraped my theme pretty well in that I am only using what I have to use. I’ve setup most of my plugins to either remove css and javascript if it isn’t needed or move it to the bottom of the page. There is still some plugins that will break if the javascript is loaded in the footer instead, so those few files are in the header. All of the scripts however are hosted on the server. The only scripts that aren’t are from google. I’ve also increased the memory limit via wordpress.

    Also my images are compressed using wp smush.

    So I’m not sure what to do next, what steps to take and how to fix it. So if anyone can provide some insight that would be so great and appreciated!

    the website is http://www.youtalktrash.com

    Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)
  • I have this in my theme’s functions.php:

    function memory_stats()
    { // BEGIN function memory_stats
          echo '<p style="clear: both;">Memory used: '. number_format(memory_get_usage(true)). ' bytes.<br />';
          echo 'Peak Memory used: '. number_format(memory_get_peak_usage(true)).' bytes.</p>';
    
    } // END function memory_stats
    
    add_action('in_admin_footer', 'memory_stats');

    You can also call memory_stats() in your theme’s footer.php or wherever is near the end of processing on the front-end. Then you can see how much memory PHP is using at least for the single instance. If you are getting many simultaneous hits, each one is going to use that much roughly.

    Does this matter if it’s on the live site or not? Currently almost impossible to get into without using ftp and waiting a few minutes for the page to reload.

    My production site is running the same theme, same settings and same plugins. Only difference is the amount of users and traffic obviously. I threw it on there to see what it did first..

    The results:
    Memory used: 11,272,192 bytes.
    Peak Memory used: 11,272,192 bytes.

    But what does that show.. I understand that it’s showing how much each one hit is using roughly… But any advice on how to fix that? Removing plugins, fixing my theme somehow… Is that a lot? I don’t know what to do with that information really. Like I said I’m not a developer so this is strange territory for me and I’m learning as I go. Thank you for the help and reply!

    No, that’s not much. Mine is using:
    Memory used: 24,903,680 bytes.
    Peak Memory used: 25,165,824 bytes.

    Loaded your site and it waited 38 seconds before it started getting anything. Most other requests after that were pretty quick with a couple more taking 20 seconds, and some of those 20 second requests were image files, so no PHP there.

    Seems to me like the server itself is overloaded CPU wise or something. Can you log into the server using SSH and run Top to see what’s going on? Does the Server’s cPanel or whatever show CPU usage?

    Did a Tracert to your domain and it’s only 15 ms with 7 hops (2 of which are my router and cable modem) so no problem there.

    Took a screenshot of what my browser saw: http://i.imgur.com/qXG3A9z.png

    I took this information to my host. They did some more tests. They said cpu looked normal.

    “it appears that you would only have 8 http requests workers. Did you happen to set this to 8?”

    “Me: No, I didn’t.”

    “Would explain the slow connecting to the server, if all 8 requests are full in someone trying to access the site, apache says HEY wait get in line, I can only listen to 8 at once.”

    ” Increased your apache listener workers.”

    ” It should have been set to default, which would be 150 atleast, but it would have been set to 8″

    “The only other thing I would be able to suggest would be something like. Engintron”

    Seems that increasing the apache listener did help improve the initial load time and proceeded to load the rest of the page a bit quicker.

    I am going to be installing the engintron next and see if that helps anymore. I will report back with results.

    Thank you for your help! It has helped narrow down problems for the host.

    It has improved. Page now completely loads in 5 to 7 seconds (a F5 refresh) with first response in about 3.5 seconds.

    Seems that way even during the day time as well. That was the bulk of the issue I’m guessing. I haven’t gotten engintron to install correctly even following the install instructions It won’t install for some reason I get:

    Resolving raw.githubusercontent.com... XX.XXX.39.133
    Connecting to raw.githubusercontent.com|XX.XXX.39.133|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 20305 (20K) [application/octet-stream]
    engintron.sh: Permission denied
    
    Cannot write to “engintron.sh” (Success).

    So I can’t post back any results on that yet. However it does look very useful and it looks like it could really help. I wish I could get it to work correctly.

    Hi Jamesdoesdesign –

    It is one nicely designed website!

    We are building a community website using buddypress and Boss theme and I wanted to ask if you could help us hide the @username on the cover photo as you have at youtalktrash.com. Exposing the username brings up security issues so we want to hide it especially for site admins.

    Your help will be greatly appreciated.

    Hi,

    I simply used CSS to hide the name. But, if you wanted to dive into the template files of buddypress core, you can find where the names are generated from in the php files and remove that line so that it really does not generate the name. However, that is editing the template files. So any time you have a buddypress update, it could potentially override that line.

    I personally edit the template files and keep a backup of them in a remote location. So that I can update the plugin and then instantly FTP the backup files that I made edits to almost simultaneously, so that it instantly brings it back to how it was with the edited file after the update.

    With CSS, all I do is display:none; on the name. However you can still see the name if you know how to view the page source or inspect the element with a code editor.

    If you need more help feel free to ask.

    Hi,

    Thank you so much for a detailed reply and sorry for replying so late. It’s because I contacted the theme developer and they provided a code for it and forgot about posting here.

    Here is the link to the website http://www.chemistrysteps.com/

    Would greatly appreciate any feedback.

    Do you actually do design and development? There a few things that I wanted to modify.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Troubleshooting slow site.’ is closed to new replies.