Currently on free plan, but looking to upgrade to fix issues

Hello everyone,

We have a small tech blog which currently gets a few million monthly views. It’s a news blog, and precisely because of that, it witnesses spike in views multiple times a month. Due to this, sometimes our site goes down as the server infrastructure is not adequate to handle massive spikes in views. So I wanted to ask if Cloudflare has a solution to this problem? We are currently on the free plan, but ready to upgrade to a reasonable paid plan if there’s a fix for our problems.

Looking forward to a response from experts and/or Cloudflare staff.

A paid plan doesn’t do much to offset the load from your server. It just gets you a better firewall and some cool optimizations to make your site faster.

We could suggest some tweaks on the free plan, or suggest some add-on features that might help. What’s the domain?

Thanks for the response. Domain is Piunikaweb.com

Waiting for your reply.

For starters, I suggest you create a Page Rule to cache the main page. It looks like it doesn’t change if a user is logged in and it would be safe to cache for everyone. I see you’ve posted a lot of content just today, so you can go as low as a 2-hour TTL to cache the main page. (beware that if logging in shows extra information on the main page, such as Admin toolbar or Edit links, that may get cached as well if the admin is the first visitor to that page before it’s cached)

Page Rule-
Match: piunikaweb.com/
Settings: Cache Level (Everything), Edge Cache TTL (2 Hours)

That will protect your main page from hammering the server. If you have a particular story that’s blowing up, temporarily create another Cache Everything Page Rule to Match that story’s URL. You’re using Facebook Comments, so that should still show live updates since it’s an external resource.

Hopefully you have a good Page Caching plugin for the site as well. WP-Rocket would be totally worth the investment, but there are some good free options as well, such as WP Fastest Cache and W3 Total Cache.

Big thanks for all these details. Here is some vital info that should help you understand more about our site:

That will protect your main page from hammering the server.

We get most of our traffic from Google Search, and our home page doesn’t get much views primarily because readers come directly to an article from Google Search. So caching the home page won’t help much.

If you have a particular story that’s blowing up, temporarily create another Cache Everything Page Rule to Match that story’s URL.

That can be done, but would involve a big effort. Reason being, top stories keep on fluctuating. A story that’s currently most viewed, my be down to 4th or 5th position in an hour or two. So manually caching stories everyday would be a full time job for someone :slight_smile:

Is there any option in Cloudflare that can make sure majority of our recent articles (last 3-4 days) are fully cached all the times? Or perhaps, a way through which the whole site remains cached?

1 Like

Plan B. But it may end up costing “a bunch.” You’d have to calculate the cost. You can create a Worker that does a Cache Everything for anybody who doesn’t have a login cookie set. Assign it to the entire site. Set TTL to a low number. It can get costly because all requests to your site go through the worker. Even requests for images. If the cost exceeds $200/month, go with a Business Plan that will let you Bypass Cache on Cookies for the Page Rule.

addEventListener('fetch', event => {
  event.respondWith(noCacheOnCookie(event.request))
})

async function noCacheOnCookie(request) {
  // Determine which group this request is in.
  const cookie = request.headers.get('Cookie')
  const cacheSeconds = 86400
  if (cookie 
    && (
      cookie.includes(`wordpress_logged`)
      || cookie.includes(`comment_`)
      || cookie.includes(`wordpress_sec`)
    )) {
    const bustedRequest = new Request(request, { cf: { cacheTtl: -1 } })
    const response = await fetch(bustedRequest)

    const newHeaders = new Headers(response.headers)
    newHeaders.append('wp-cache-busted', `true`)
    return new Response(response.body, {
      status: response.status,
      statusText: response.statusText,
      headers: newHeaders
    })
  } else {
    // Edge Cache for 1 day
    return fetch(new Request(request, { cf: { cacheTtl: cacheSeconds } }))
  }
}
3 Likes

Hello Sdayman,

We are really grateful for the help you are offering. I see there’s a code that you’ve shared, and it needs to be added in a Worker. Then there are a couple of other things like assigning it to the entire site and setting TTL to a low number. Thing is, we are not cloudflare and coding experts, and that’s why a little apprehensive that if we’re not able to do all this correctly, access to our site may get affected, and considering we are running a small business based on this site, we’d not want that to happen.

Would it be possible for you to do this for us? We are ready to pay you for your time.

1 Like

I rarely do freelance work, but maybe another @MVP wouldn’t mind stepping in.

2 Likes

Ok. Please refer someone whom is equally experienced, although we’d still love to have you do this work. I also want to know if getting this done in the Business plan is easy? And if Business plan can also help us increase our site loading speed?

Your help is much appreciated.

additional to @sdayman 's recommendations ,
@user2151 I can see that you’re running on
PHP/7.0.30

try to update your app to run with the latest PHP (7.3 or 7.4).
I can see that you’re running on WordPress, which means that you can do many things to optimize:
1st, on the server side, with a load balancer (NGNiX),
On application level now:
caching (as per SDayMan’s recommendation WP-Rocket will do the trick).
Minimize CSS, JS, Html, implement a good caching policy.

Optimize your WordPress website, with:
uninstall plugins that over load your site, optimize your Theme, (by forcing it to do less requests).

Then, when you will do all that, and test your server load time, you can upgrade to a paid CloudFlare plan, and boost your website more.
I’ll be happy to assist you with more details if you need.

1 Like

Hello Stefano,

Thanks for pitching in and offering these ideas. While the suggestions seem good, we don’t have an in-house expert to execute them. And as non-experts, we are apprehensive to do all this ourselves because if any change breaks the site or makes it go down for a long duration of time, we suffer a lot of revenue loss. And as a small business based on this site, we’d not want that to happen.

So as of now, we see two ways to move forward:

  1. Get a Wordpress expert and pay them to do all this for us, OR
  2. Do optimizations (like full site caching and page loading optimizations) at the Cloudflare level itself, so that very few requests reach our server
    If you ask us, we are more inclined towards option 2, but are open to what you and other experts out here think. Looking forward to your opinion.

I’d suggest option 2. If your site is running PHP or any other “server” executed code, when the user is logged in, it shouldn’t cache that (If it’s coded properly). When you create a new blog post, just remember to clear all of your sites cache and you should be fine. If you don’t want to clear all of your sites, clear the cache of the pages mentioning this blog post.

Direct clicks (from google to the new blog post) should be fine since it has never been seen before. When posting the new blog post, beware of traffic spikes from CloudFlare. Not sure if CloudFlare has fixed it, but depending on the region of the user, CloudFlare’s network will request it from your server and they will cache it in that region.

This is so general.
We don’t know your system specs. There’s not any magic power, that will boost your website, in case that for an example your origin server not able to handle requests.
I’ll drop an example here.
Let’s say that you’re running on a system (server) on a shared hosting plan, which is designed for 10-20k visits per month, with a low Mem Ram, and not enough CPU’s to handle all apps that installed on that server, while your website gets 50k or more per month, while you’re running a social campaign which can bring 200-500-100-k simultaneous users, or a post becomes Viral.

In computer science, the number of concurrent users for a resource in a location, with the location being a computing network or a single computer, refers to the total number of people simultaneously accessing or using the resource.

Well then you got a problem ( the example and the numbers are completely hypothetical ).

If you are not in place, to review your system (server), your website’s Performance, then you will need to hire someone to do it for you, and consult you how to proceed.Of course I am not telling that, to make the sweet eyes on you, but that’s how things work, in general.

When your car’s engine has a low performance, what is the first thing that comes on your mind?
We need to make sure, first, that your system you’re running on is capable to support, bring some numbers on the table, and we can help you for free.

Without knowing what is your hosting plan, the specs of your server, what plugins you’re running, what is the system load, what server you use, which theme, and I could write all day, but this is not a community that will solve your WordPress (or any other apps), this is a community which mostly trying to solve and consult about CloudFlare things.

1 Like

This topic was automatically closed after 31 days. New replies are no longer allowed.