How to Scale Wordpress on Shared Hosting to Survive a Traffic Surge - wordpress

So just like any other indie developer, I ran a small personal Wordpress blog on a HostGator shared plan to show case projects and notes.
Now, let's say you have an article that is randomly picked up on HackerNews or Digg, how do you config your Wordpress or the Shared Hosting to survive the sudden surge in visitors and page hits?
I have looked into a few things like: making that article a static page, turn on caching so the page can serve without querying MySQL. Would love to hear from your experience.

I would start with a caching plugin like W3 Total Cache. It has the same effect as the first technique you mentioned, but it does it automatically.
If you want better performance for a few pennies more a month, try Amazon Cloudfront. It is a little more setup, but the benefits are well worth it. I set up my DNS to point to Cloudfront, so all traffic hits their edge servers first. Then I set up my server as origin.domain.com and make sure that cache control headers are set (e.g. max-age=3600). When visitors come to my site, they hit the Cloudfront edge server nearest them (there are 22 locations worldwide), and if the page is cached, my server never gets hit. If not, 1 request is made, and for the next hour, all requests are served from the cache on the edge server.

As has been already mentioned, a caching plugin is a must. A CDN helps also for media and static files like js and css, and then your theme is also a crucial factor in your site's performance. Keep it clean, minimize queries, and try to avoid frameworks and the overhead they introduce.
I don't use a cdn, but I have a virtual server where I use Nginx to listen on port 80. It also serves the easy stuff like images, text files, stylesheets, etc. Anything more difficult (wordpress content), it passes on to Apache which listens on a different port. Apache is an awesome webserver but it is a beast as far as resources go. If you have 20 items on a page that need loading, and you can have something svelte like Nginx handle 19 of them, it helps tremendously.
Here is an old optimization article I wrote about a year ago - that might help a bit more also: http://trioniclabs.com/2011/12/my-take-on-wordpress-optimization/
Good luck.

I also host with HostGator, and have addressed performance issues with many of my sites.
My advice:
Find a different shared host. Since EIG bought HostGator last year, the performance of their shared accounts has fallen off a cliff. MySQL performance is poor, and support wait times are growing.
Previous to 2013 I had high traffic WP blogs that ran with no issues. The new hardware and policies however have taken even my small/simple WP sites down to very low performance levels.
If you stay with HG...
Disable wp-cron: Here's a good help doc: https://support.hostgator.com/articles/specialized-help/technical/wordpress/how-to-replace-wordpress-cron-with-a-real-cron-job
Install and use a caching plugin, using mod_rewrite caching (not PHP caching)
A CDN will help the site load faster, and if you host the assets on a different provider, it can help reduce the load on the server.
Honestly, if there's even a remote chance of getting massive traffic, upgrade to a scalable VPS, or a web host that handles traffic surges like WPEngine.

Related

Two WordPress sites on a particular host, loading way slower than other WP sites on other hosts

I maintain 12 WordPress sites which run on several different hosts. Two of them are very slow loaders in particular, taking up to 30 seconds to load. The person who actually hosts those two for my client uses the same hosting company I use for my four sites. My sites load well, and they are more involved sites. I'm on a VPS setup. He is using a reseller setup for his care.
All the sites I maintain are using the Genesis Framework, and run very well on all the hosts, but these two have sporadic loading times and I cannot seem to get a clear answer from him why those two sites are having trouble being quick. I've installed database optimizers to run at 6 a.m. each day. These are not complicated sites, with just pictures and text. No extensive javascript use. Just pictures and text.
Here is my question... is there something about the initial connection to the site that would be an issue. To use an analogy, it's like trying to go into a house, but the door knobs are greased and you can't get a good grip to do it, but all my other sites have clean dry knobs. Is there something that could happen when there is a site trying to make a connection by DNS that could cause a delay?
What makes this also more confusing is that when I try to do GTMetrix scores, it seems like it's taking a while for the site to get fetched, yet the site scores are coming up at 86% (B), which is pretty good. How am I getting an 86%/B rating when the site is taking so long to connect?
Any thoughts or insights would be appreciated. I feel like I'm getting no satisfactory answers from the host guy, and the client is getting antsy.
Some ways that I used to speed up my sites:
Disabling or limiting the frequency of WP Heartbeat.
Use CloudFlare CDN.
Turn the whole into static HTML (If not e-commerce sites). Good plugin to use WP2Static

Problem with cache, plugin Litespeed, server Litespeed and optimization

I have been using the wordpress Litespeed plugin on my site Trailer y Estrenos CO. I have the Chemicloud hosting and it uses the Litespeed server, which according to them, it works super well if is used with the plugin of the same name.
On top of that, you started using Cloudflare and I integrated it into the Litespeed plugin.
My problem is the following:
When I measure how optimized the page is after having installed everything mentioned, in GTmetrix at the beginning it gives me a statistic of the B and C range, but soon after in another scan they lower me to C and D.
In the Litespeed plugin I have DNS Prefetch configured and in the first scan of range B and C the DNS Prefetch configuration works as it is, but in the others scans later that go down to ranges C and D, it seems that the DNS Prefetch does not work, since it shows me those external DNS errors.
I don't know if it's my ideas, but it seems that the Litespeed plugin didn't do its job well, although it could be other things.
Should I use another cache plugin? I know that the WP Rocket is very good but the detail is that it is paid.
Any suggestion or help?
Thank you
In the current report, Your scores are mainly dependent on your third-party resources. Everything that is loading from your domain(Litespeed) is pretty quick(Check the Waterfall section). If you expand the results which are causing these scores, you'll see the responsible ones.
Pagespeed Scores
Minimize Redirects is caused by resources from addthis.com,openx.com and soon.
Leverage Browser Caching is also by addthis, google and Facebook resources.
Serve Scaled Images is something to be done during the upload, or a plugin like Shortpixel Adaptive Images can help you.
YSlow Scores
Add Expires Headers is the same as Leverage Browser caching above.
Use a CDN is caused by the same Third-Party Resources.
Use Cookie-Free Subdomains is caused by Cloudflare, since it appends its Cookies on all requests, but if your server is far away from where your visitors are, the benefits of using Cloudflare overweighs the drawbacks.
Reduce DNS Lookups is again due to a lot of third-party resources, from multiple domains, DNS Prefetch can help the users resolve the DNS faster, but won't affect the scores.
Avoid URL Redirects is the same as Minimize Redirects above.
No Cache plugin can edit how third-party requests are being handled by the website, while they can defer the requests or load them after the actual page is loaded to improve user experience, it won't still affect the scores.
What should you do to fix these?
Figure out what you want to keep and remove the rest if not required.
Talk to your developer about storing these external files locally so that they can be optimized and controlled using Litespeed Cache or any other Cache Plugin.
For the Minimize Redirects, get in touch with the provider you're serving these resources from and ask them to improve this behavior.
I hope this helps!

Managed Wordpress website hosted on Aruba slow

my problem is that I have a site built with wordpress hosted on Aruba with a wordpress managed hosting plan. Today it started to go very slow. The loading time is over 13 seconds. Until yesterday it was fine. What can it be? Thanks.
Many things can be causing your WordPress to be slow: configuration of your server, WordPress configuration, images and videos, theme and plugins's code, external scripts.
So, within that list, here are some of the tasks you should consider doing:
Speed test the website again
Use latest PHP version
Make sure all updates are done
If you create backups, make sure that they are only run during low traffic time
Install a caching plugin
Optimize images
Reduce as much as possible videos which costs bandwidth
Analyze if the theme is optimized for speed
Analyze if plugins are poorly coded
Reduce external HTTP requests and DB calls
Optimize the DB
If none of this works, contact your hosting provider and explain what you've done so far. If they don't care for the situation or are not capable to serve your needs, consider changing your hosting provider.

Extreamly Slow Wordpress Site

I having a Wordpress site which take more than 5 sec to load out, and is extremely slow performance.
I tried everything i can to speed it up but still no luck.
Any recommended solution for me ?
Here is my Website URL
Stormbodykits.com
A quick look at the Network tab in Dev tools show that this is not limited to PHP/WordPress but is equally effecting all static content such as images, JavaScript and CSS. This is a hosting issue, either too small of a virtual host or overly saturated shared hosting. If your hosting the site yourself you may need to upgrade your upload speeds through your ISP. Long story short, WordPress is not generating this content. The time is being spent fetching from disk (or memory in some cases) and then sending the resources to user. The most likely bottleneck in this scenario is the network when looking at full seconds rather than milliseconds, especially on a site serving only a few connected users at a given time.

What are my (other) options to reduce resource usage on shared hosting?

I got a message from our shared hosting company (InMotion) informing me our resource usage is too high. We have a WordPress-powered website. To give you an idea of our website, based on Google Analytics, we get 8,343 unique sessions per month. According to our webhost, we used 8660.71 MB of bandwith in January.
One day, InMotion told me there was a spike in CPU usage, and included an excerpt of my access logs which they say indicated "some heavy WordPress Admin activity". They said "We are not exactly sure what this admin user was attempting to accomplish, however this activity does seem to have inflated your account's CPU usage." They included the ID of the item that was uploaded and caused the spike. It was the only file I uploaded that day. It was a 7 kB PNG file; I uploaded it once, deleted it and uploaded it a second time.
I do not understand the complexities of resource usage, so to me, it seems stange that uploading a 7kB twice can bring about spikes and be considered heavy activities.
When I asked more about the Ressource Usage graph, they replied this : "The numbers are percentages. 100% means you're right at the top of what we consider normal CPU usage on a shared platform. Anything above that is VPS territory. If you zoom in on the graph, you'll see that for the most part you're right at 100%, but you occasionally have spikes over. Going through the logs, your CPU usage is mostly from the Wordpress Dashboard, so disabling the heartbeat feature should reduce your usage the most."
They also told me there was unusual activity to the wp-admin/admin-ajax.php.
At our hosting company's request, I did the following:
Disabled WordPress' heartbeat / autosave features
Installed a caching plugin (WP Fastest Cache)
Installed P3 Plugin Performance Plugin to see which plugins were using most resources
I deactivated 2 plugins that were highest in ressource usage : Scroll Back To Top and Simple Page Tester.
But even with these changes, there are still "spikes" in our resource usage and we are receiving warnings. Our host is recommending we either upgrade to VPS hosting or use a CDN service like CloudFlare or MAXCDN.
So my questions are as follow :
How can I tell what is really causing excessive ressource usage?
Are there other ways to reduce resource usage caused by WordPress?
Are CloudFlare or MAXCDN good for this type of situation?
Thank you for taking the time to read. Any help or tips will be appreciated!
Your usage is not at all surprising. If you get 8,343 unique sessions per month and you used 8660.71 MB, then each visitor is taking an average of about 1MB.
Just loading your home page is about 0.525MB, so if people browse your site (plus with admin traffic) it's easy to see how you might use that much.
Yes, a CDN like CloudFlare or MAXCDN would be really good for your situation. Your page is loading a lot of CSS, Javascript and images that could all be moved to a CDN. This would significantly reduce your host bandwidth usage and probably lower your page load time as an additional benefit.

Resources