How Much Traffic Google Cloud f1-micro Instance can Handle
Since Google has been offering the improved version of their “Always Free” tier, hosting website on their cloud platform seems to be a compelling option. Especially for small websites or blogs with low traffic that stay under free tier quota could end up paying nothing at all. But with correct cache and CDN setup, you can also handle an incredible amount of traffic using just the free tier instance, f1-micro (this website for example) Let’s check it out in this post!
Google Always Free Tier
The only instance that eligible for Google Always free tier is f1-micro which has 0.2 vCPU and 0.6GB RAM. With this amount, you can only host blog or static content and forget about CPU/Database intensive website like forum or e-commerce.
Google is also generous enough to provide a burst capability that allow you to utilize the entire vCPU for a short period (same as having 1 vCPU) So you can still handle a handful of concurrent visitors if needed. The burst lasted around 30 second which you’ll see the CPU usage chart go above 100% like this.
The Web Server
Many people usually go with LAMP stack (Linux + Apache + MySQL + PHP) for WordPress website. It’s understandable but since our resource is limited, you might want to look at alternative replacement that is more efficient for static website like Nginx or OpenLiteSpeed.
For this website, I tried OpenLiteSpeed which boast several times faster performance than Apache with less CPU/RAM usage. There is a nice stress test comparing between OpenLiteSpeed vs Nginx that might help your decision.
Cache and CDN Setup
Since we’re hosting a static content website, Cache and CDN setup could reduce our load greatly. Cloudflare and good WP Cache plugin (e.g. WP Rocket, WP Fastest Cache) In my case, I got 70% reduction of incoming requests (from 1.4 million to 412K requests) This means with Cloudflare, our f1-micro instance can handle around 3x more traffic!
Increasing Memory using Swap
Remember that f1-micro only has 0.6GB RAM (581MB to be exact) So we’ll need to allocate a swap file, just in case we ran out of memory. You can do that easily with these command below.
sudo fallocate -l 1G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Now you’ll have 1GB swap file ready. Even you already have plenty RAM available, it’s still beneficial to have swap
The Result
Currently redstapler.co has around 137K pageviews/month (around 100K unique visitors)
And below is the daily CPU and RAM usage chart
You’ll see that’s only around 20% CPU utilization while RAM usage was stable at around 50% which means we can push even more traffic on this instance. (The highest spike was when I published the new post and got many concurrent visitors) So now the only cost for hosting website on Google Cloud is the network bandwidth usage (was greatly reduced by Cloudflare) which is around $1.5/month. That’s even cheaper than a lowest shared hosting plan!!!
As you can see, with the right WordPress cache plugin setup, using Cloudflare CDN to reduce load, turn on swap and using a good web server, a tiny f1-micro can easily handle 100K-200K unique visitors/month for static website without any issue. Personally, I believe we can even push it to 500K visitors/month. Anyway, I’ll update this post again later if our website has reached that state 🙂
Update: I made an article about cost breakdown of hosting website on Google Cloud. Just in case you might want to check it out!
nice content writer
I am on the same path as you are, would you mind sharing with us the setting and tuning for both cloudflare and openlitespeed server / virtual host setting?
I am using GC for my website htips(dot)in and it is very costly because I spent Rs 1000 for 10 Day Hosting and traffic almost 2.5k per day.
Means I have spent 1000 Rupees for 25000 visitors.
How can I reduce cost of my wordpress website on google cloud please help?
Which Virtual machine you’re using? 2.5k/day the shared core instance + cloudflare and wordpress cache should be able to handle this if it’s a static website with modest page size.
Just wanted to say thank you, after looking at a few tutorials about launching a free WordPress instance on GCP, I found yours to be the easiest to follow and got me up and running in a short time.
So I can run my site free for lifetime. Am I right?
Hey admin your post is so helpful to me but my one problem not solve plz give me response I am waiting for your response. Example I am choosing 1cpu 2 GB ram and how much this cpu handle traffic per month and per live traffic and also how to change this. I am waiting for your reply
Just started using Google cloud N1 micro, a long way to reach at your level of 150k visitors per month.
Previously I was wary thet I might have made mistake by using Google cloud instead of any other shared host, but this article provided me some good vibe that eventually my decision was not bad
Very helpful nice information
This is really cool thought mate, would love to see a nice clean writeup from you on the installation process for OpenLightSpeed, SSL, and then WordPress on an F1 instance. There isn’t much clarity around the web on the subject imo. Cheers again!
Very nice and very good