How to Host WordPress on Google Cloud Platform
GCP offers a wide range of cloud products from “Compute Engine” virtual machines, to managed Kubernetes clusters, to premium DNS and CDN services. In this article, we’ll take a look at some of GCP’s most popular products that can deploy a high-performance WordPress site.
At Kinsta, our hosting infrastructure is powered by the Google Cloud Platform. We made the switch to GCP a few years ago after testing out various top-tier cloud providers. For us, Google Cloud provided the best combination of performance, security, and feature set.
Fast forward to 2021, and all sites hosted on Kinsta are powered by GCP’s fastest Compute Engine VMs and their super fast Premium Tier network.
Not sure what that means? Let’s take a closer look at Google Cloud Compute Engine!
Google Cloud Platform Compute Engine
Compute Engine is Google Cloud’s virtual machine (VM) product. In 2021, a virtual machine is typically synonymous with the term “server.” In other words, if you hear someone say they have to set up a server for their project, it usually means they’re setting up a virtual machine.
What Is a Compute Engine Virtual Machine?
A virtual machine allocates computing resources, including CPU cores, RAM, SSD or mechanical disk storage, and network connectivity. Virtual machines are derived from physical machines and represent a portion of the resources of the underlying physical machine.
For example, a physical machine with 128 CPU cores, 128 GB of RAM, and 1 TB of SSD storage could be split into 4 VMs, each with 32 CPU cores, 32 GB of RAM, and 250 GB of SSD storage.
In practice, VMs from top-tier providers like Google Cloud Platform allow for a level of flexible scalability that traditional physical machines can’t match.
To demonstrate this, imagine if your WordPress site lets people book reservations at restaurants.
During the week, the site doesn’t receive much traffic. On Friday night, traffic picks up and continues through the weekend. If your site were hosted on a physical server, you’d have to deal with static and non-scalable resources (e.g. 16 CPU cores, 32 GB RAM, 500 GB SSD storage). This means your machine would only be cost-efficient from Friday to Sunday, and not so much from Monday to Thursday.
On the other hand, a Compute Engine VM lets you allocate a minimum level of resources during the week (e.g. 4 CPU cores, 16 GB RAM, 500 GB SSD storage) and ramp up your computing resources in response to the increased traffic for the weekend traffic surge. After the weekend surge, you could then scale back down to the initial configuration. Since Google Cloud offers a powerful developer API, the scaling process can even be automated!
Compute Engine Machine Families
Before we dive into how Compute Engine can be used to host a WordPress site, let’s go over the various machine families available within Compute Engine.
E2 Virtual Machines
E2 VMs are designed for low-cost day-to-day computing scenarios. They’re ideal for hosting small websites and apps, microservices, and development environments. While Google doesn’t explicitly state this, many view the E2 machine family as a faster and cheaper replacement for the aging N1 machine family.
E2 VMs utilize x86 CPUs from Intel and AMD, but unlike VMs in other machine families, they don’t let you choose a specific generation of chips. Instead, E2 VMs use a proprietary “resource load balancing” technology to allocate CPUs based on availability dynamically. This means that an E2 VM can be powered by various Intel (Skylake, Broadwell, and Haswell) and AMD EPYC Rome chips.
Thanks to Google’s load balancing technology, which includes custom CPU schedulers and performance-aware CPU migrations, E2 VMs can maintain a consistent level of performance despite the varying physical hardware powering the VM.
N1 Virtual Machines
Like the E2 VM family, N1 VMs are also lower-cost, general-purpose VMs for day-to-day computing needs. However, they make use of older Intel processors and have a lower price-to-performance ratio than E2 VMs. Thus, unless you have a specific reason to choose N1 VMs, E2 VMs can achieve the same level of performance at a lower price.
N2 Virtual Machines
N2 VMs are a higher-performance alternative to N1 and E2 VMs. Unlike N1 and E2 machines, N2 VMs are equipped with newer Intel Cascade Lake CPUs that, according to Google, offer 20% more performance at the same price than lower-tier VMs. For memory-heavy use cases, N2 VMs can be configured with up to 25% more memory per CPU.
N2D Virtual Machines
N2D VMs are similar to N2 VMs, but ditch Intel CPUs in favor of AMD chips. Compared to N2 VMs, N2D VMs can be configured with 144 more CPUs and 256 more gigabytes of RAM. So, if you’re looking for a high-performance general-purpose machine that supports very high CPU core counts and memory limits, N2D VMs are a solid choice.
C2 Virtual Machines
C2 VMs are high-performance “compute-optimized” machines. C2 VMs are equipped with high-end Intel Xeon CPUs, which allow for sustained clock speeds of 3.8 GHz. Comparatively, E2, N2, and N2D use lower-tier Intel CPUs that cannot sustain 3.8 GHz. C2 VMs are designed for CPU-intensive applications like electronic design automation, gaming, certain kinds of scientific modeling, and single-threaded applications.
At Kinsta, we use C2 virtual machines to power our hosting stack in all supported locations. Since WordPress is a single-threaded application (each PHP worker can only use one CPU thread), site performance for uncached requests is heavily dependent on the CPU’s clock speed. In fact, after moving our infrastructure from N1 VMs to C2 VMs, we saw up to a 200% boost in performance for sites hosted on Kinsta.
M1/M2 Virtual Machines
M1 and M2 VMs are ideal for memory-intensive workloads such as large in-memory (non-persistent) databases, business warehousing, data analytics applications, and more. M1 VMs offer up to 4 TB of memory, while M2 VMs can be configured with up to 12 TB memory.
A2 Virtual Machines
A2 VMs are the newest machines in GCP’s Compute Engine lineup. Like M1 and M2 VMs, A2 VMs are designed for particular workloads. A2 VMs can be equipped with up to 16 high-performance NVIDIA Ampere A100 Tensor Core GPUs and are designed for developing and training machine learning and deep learning models.
Compute Engine VM Configuration
During the Compute Engine VM setup process, you can select your VM region and specifications (machine family, CPU, and RAM). You can also specify an operating system (Debian, Ubuntu, Windows Server, etc.) for the boot disk and attach secondary local and persistent disk storage devices.
To host a WordPress site, you may want to attach a local SSD as a Redis cache and multiple persistent SSDs to store the WordPress database and installation files.
Beyond the basic VM configuration options, Compute Engine also lets you specify advanced options service accounts for API access, IP-based firewall rules for restricting traffic to/from specific ports, SSH keys, and more.
After deploying a Compute Engine VM, you’ll have access to computing resources backed by Google’s high-performance hardware and network. However, it’s important to keep in mind that even though Google’s infrastructure is secure on the hardware level, it’s up to you to manage security on the software and application level.
Practically speaking, this means to utilize Compute Engine securely, you’ll need to have some DevOps and sysadmin skills to install software updates, configure various WordPress-related software packages like PHP, Nginx, and Redis, tweak firewall rules to respond to security breaches, set up cron jobs to automate database optimizations, and more.
While having access to world-class computing infrastructure is definitely amazing, managing your own WordPress hosting infrastructure in today’s cybersecurity environment can be tricky. Thus, unless you have a reason and the resources to manage your own WordPress infrastructure on GCP, we recommend utilizing a managed WordPress host that supports Google Cloud Platform instead.
Google Cloud Platform Cloud DNS
Alongside AWS Route53 and Cloudflare DNS, GCP Cloud DNS is another well-regarded premium DNS service. Cloud DNS is often ranked as one of the best-performing DNS services in terms of speed, latency, and availability.
According to DNSPerf, a website that ranks dozens of DNS services from different providers, Cloud DNS has an uptime of 99.2% and an average query time of 51 ms. While Cloud DNS is slower than Cloudflare DNS (12.61 ms) and AWS Route53 (31.37 ms), it’s still considered a fast and reliable option for resolving DNS queries.
If you’re building out your WordPress hosting infrastructure on Google Cloud Platform, you’ll need a DNS service to resolve domain name queries to your server’s IP address. If you’re tied to GCP, Cloud DNS is a solid option for DNS. However, if your use case allows you to mix and match providers, Cloudflare and Route53 are alternative DNS solutions that offer slightly better performance than Cloud DNS.
Google Cloud Platform Cloud CDN
A content delivery network (CDN) is necessary for any WordPress site or web application in 2021. Nowadays, it’s common for a website to receive traffic from all over the world, so offloading static assets like CSS and JS files, fonts, and images to data centers that are closer to your visitors is crucial.
Google Cloud CDN is a premium CDN that leverages technologies like Anycast IPs, HTTP/2, and QUIC to provide high-speed delivery of static assets to site visitors. Cloud CDN integrates with GCP’s HTTPS Load Balancer product, which means your site can be configured with a single Anycast IP address while serving static assets from GCP data centers around the world.
The Cloud CDN network consists of over 130 PoPs (Kinsta CDN is powered by Cloudflare and supports 200+ PoPs) worldwide. Thanks to Google’s relationships with ISPs across the globe, Cloud CDN can deliver static assets to users with just a single network hop in most locations. Furthermore, Cloud CDN traffic is automatically encrypted and travels through Google’s private fiber-optic network, which makes it immune to extra and unnecessary network hops between the origin and user.
For advanced users, Cloud CDN is also compatible with other GCP products like Cloud Storage (object storage) and Stackdriver (monitoring). It’s capable of caching files up to 5 terabytes in size and even supports signed URLs for temporary permissioned access to an asset.
If you’re deploying a WordPress site on Google Cloud Platform, Cloud CDN is a great CDN solution for delivering static assets to visitors in a fast and efficient manner.
Google Cloud Platform Internet Networking
When thinking about the various factors that affect site performance, it’s often easy to overlook the importance of high-quality networking.
Imagine if you’re trying to drive from your house to the local supermarket. Even if you have a super-fast car, the time it takes to get to the supermarket will most likely be determined by factors like traffic, road conditions, stop signs, and traffic lights.
With this in mind, optimizing the drive by finding a light-traffic route with minimal stop signs and traffic lights will help you take advantage of your super fast car.
The same concept applies to hosting, and it’s often a topic that many web hosting companies don’t talk about.
Let’s say your site is hosted in San Francisco, and you attract visitors from all around the world. Traffic from visitors in New York, Sweden, Taiwan, and Cape Town will travel through different network cables, many of which lie on the bottom of the ocean, to get to your site. After your server processes the request, the response must travel back to the visitor via network cables.
Similar to how there are different routes to get from your house to the local supermarket, there are different networking cables for internet traffic to get from one point to another. As roads in the physical world, some internet traffic routes are newer, faster, more reliable, and less congested than others.
Over the past two decades, Google has been building out one of the world’s largest private internet networks. In 2017, Google estimated that its network delivered “25-30% of all internet traffic.” In fact, Google currently has an ownership stake in over 63,000 miles of subsea network cables worldwide.
Google makes its high-performance private network available for Google Cloud Platform customers via its “Premium Tier” network. This is the network we use for all sites hosted on Kinsta. GCP also offers a slower and less reliable networking tier called the “Standard Tier” network.
GCP Standard Tier Network
According to Google, the Standard Tier network “delivers network quality comparable to that of other major public clouds, at a lower price than our Premium Tier.”
Unlike Google, many other cloud providers like DigitalOcean and Linode don’t have a robust private global network for routing internet traffic. Instead, they mainly route traffic through internet service provider (ISP) networks on the public internet.
Traffic routed via the open internet is typically optimized for cost, which means it may be subject to several additional “hops” before reaching the destination.
Going back to our real-world traffic analogy, you can think of the Standard Tier network as local roads and the Premium Tier network as highways. By using local roads, or the Standard Tier network, you’ll most likely have to deal with more stops due to traffic lights, road construction, etc.
Let’s say your site is hosted in GCP’s Virginia data center and utilizes the Standard Tier network. If you receive a visit from a user in London, UK, the traffic routing between Virginia and London will be handled by ISPs instead of Google.
From the visitor’s perspective, this means the request to your site may be routed to various places before hitting your server in Virginia. Conversely, the response from your server may need to travel to a different location before being routed to London, UK.
Ultimately, these extra hops result in additional latency, harming everything from user experience to business revenue.
GCP Premium Tier Network
Google Cloud Platform’s Premium Tier network is a step up from the Standard Tier network regarding performance, reliability, and availability.
The Premium Tier network makes use of as much of Google’s private network as possible. When using the Premium Tier network, you can expect fewer hops between source and destination because the traffic routing is no longer optimized for cost. Instead, Premium Tier optimizes for speed and performance.
Google’s Premium Tier network consists of over 100 points of presence (PoPs) worldwide, many of which are connected by privately-owned subsea cables. As of 2021, Google has invested in 18 subsea cable installations (over 63,000 miles), six of which it owns outright. Google-affiliated subsea cables span worldwide with connections between key locations in North America, South America, Asia, Europe, and Africa.
Taking the same example above (routing traffic between Virginia and London), routing via the Premium Network allows traffic to travel through Google’s transatlantic subsea cables. So, instead of traveling through multiple public ISPs, traffic would be routed directly from Virginia to London via Google’s private network. Once the traffic arrives at Google’s data center in London, it would be picked up by the visitor’s ISP and served accordingly.
GCP Standard Tier Network vs. Premium Tier Network
GCP’s Premium Tier network is much faster and more reliable than its Standard Tier network. According to Cedexis in a load balancing test commissioned by Google, the Standard Tier network could sustain 3,223 kbps of traffic while the Premium Tier network sustained 5,401 kbps —a significant 1.7x difference. In another test conducted by Cedexis, they found that GCP’s Premium Tier network provided 30% lower latency.
In terms of pricing, the Premium Tier network is at least 24–33% more expensive than the Standard Tier (Premium Tier is available on all Kinsta plans at no additional cost). The Premium Tier network provides the best possible performance for WordPress sites or web applications that require a fully optimized hosting stack.
WordPress on Google Cloud Platform
Now that we’ve gone through the various Google Cloud Platform products that can be stitched together to create a high-performance hosting infrastructure for a WordPress site, let’s dive in even further and discuss exactly why Google Cloud Platform is such a great solution for hosting WordPress sites of all shapes and sizes.
WordPress Sites are Dynamic
Unlike static sites, WordPress sites are dynamic in nature. Static sites rely on pre-built HTML, CSS, and JS files that can be deployed directly to a CDN. When a visitor requests a page on a static site, the HTML content is not built in real-time. This means static sites don’t require a powerful server running in the background to build pages as they’re requested.
On the other hand, uncached pages on WordPress sites do need to be created in real-time. Furthermore, backend processes like the WordPress admin dashboard, cron jobs, and backup plugins all require computing resources to use or run. Thus, the performance of a WordPress site is highly dependent on the host server’s computing resources (CPU and RAM).
WordPress Is Not Designed for Multicore
Now that we’ve established that WordPress sites rely on an active server in the background, let’s get into some computational limitations of WordPress. Nowadays, it’s common for computers to ship with multiple CPU cores and applications to use multiple cores in tandem to complete a single task. For example, photo editing apps like Adobe Photoshop can use multiple CPU cores to speed up image processing.
WordPress works a little differently. When a request from a visitor hits your web server (typically Nginx or Apache), it’s processed and passed on to a child process of PHP-FPM, a FastCGI process manager for PHP that helps manage the execution of PHP code. Once the request has been passed on to the child process, often referred to as a “PHP worker,” it executes the code with the server’s computing resources.
RAM and SSD speed are important performance factors, but they’re rarely the bottleneck for high-traffic WordPress sites. Instead, CPU performance is often what impacts WordPress performance the most.
There are multiple aspects of a CPU that impact performance, and the clock frequency is at the top of the list. The clock frequency of a CPU determines how many instructions it can execute per second. In general, a CPU with a higher clock speed can process more data in less time.
Since WordPress cannot make use of multiple CPU cores to process a single request, using a CPU with a high clock frequency allows for more requests to be processed in less time. This is why Google Cloud Platform is a great choice for hosting WordPress sites.
In addition to general-purpose E2, N1, N2, and N2D machines, which use CPUs with lower clock frequencies between 2.0 to 2.8 GHz, Google Cloud Platform also offers C2 “compute-optimized” machines equipped with high-end Intel Xeon CPUs that are capable of operating at 3.8 GHz. Gigahertz (GHz) is a metric that means “109 CPU cycles per second,” so clock speeds can be compared linearly. In other words, a 4 GHz CPU is twice as fast as a 2 GHz CPU.
With this in mind, it’s easy to see why C2 VMs and WordPress are a match made in heaven. WordPress thrives with fast CPUs, and C2 VMs have some of the fastest CPUs available to consumers. After making the switch from N1 machines to C2 machines for our infrastructure, we saw a 200% improvement for sites hosted on Kinsta, and this figure is in line with the clock speed jump from 2.0 GHz to 3.8 GHz.
Higher Latency, Higher Bounce Rate
In 2021, the average internet user is bombarded with daily blog posts, videos, ads, and social media posts. As a website owner, it’s important to make sure your site is loading as quickly as possible across a wide range of devices because users will not wait for a slow site to load.
According to Layer0, ecommerce websites with a sub-second page load time see a 15-30% increase in conversion rate. In other words, if you’re unable to present visitors with content almost immediately, you’ll most likely see an increase in bounce rate and a drop in traffic.
If speed is the name of the game, then hosting WordPress on a premium cloud like Google Cloud Platform makes total sense. Not only does GCP have some of the fastest VMs on the market, but they also offer all of the surrounding infrastructure components to ensure your site is loading as quickly as possible.
GCP’s Cloud CDN lets you offload static assets to data centers worldwide. At the same time, their Premium Tier network optimizes traffic routing to give you an edge over sites that rely on public ISPs to handle all their traffic routing.
A Powerful Developer API
Google Cloud Platform offers a powerful and comprehensive developer API for cloud architects, sysadmins, DevOps engineers, and more. If you’re planning to host a WordPress site on Google Cloud Platform, we recommend getting familiar with the Google Cloud APIs and Google Cloud SDK to streamline tasks and make your life easier.
For example, you can use the Google Cloud API to automate scaling up your instance in response to your traffic monitoring software. Similarly, you can use the included <code>gcloud</code> tool in the Google Cloud SDK to configure firewall rules, provision and attach additional SSDs to your Compute Engine VMs, set up a Cloud CDN zone, and more.
How to Host a WordPress Site on Google Cloud Platform
There are various ways to host a WordPress site on Google Cloud Platform, and each method has its own set of compromises and challenges. Furthermore, since GCP is largely an unmanaged service, it’s important to understand systems administration to deploy a WordPress site in a secure manner (or pick a managed hosting provider like Kinsta that can take care of this for you).
If you prefer a DIY approach, here’s an overview of the key aspects you’ll need to take care of. So, while we won’t cover step by step how to host a WordPress site on Google Cloud, we’ll provide you with a general overview that you can use to get started.
Hosting WordPress on GCP Compute Engine
The easiest way to self-host WordPress on Google Cloud Platform is with a Compute Engine VM. Here are the general steps you’ll need to follow to get a WordPress site up and running.
- Deploy a Compute Engine VM in the GCP dashboard. If you’re just testing out WordPress on Google Cloud in a development setting, even an E2 series VM with 2 CPUs and 4 GB of RAM should be enough. During the VM deployment process, you’ll need to choose a Linux distribution, attach storage disks, configure SSH keys, assign an external IP address, and configure other optional settings as needed.
- After the VM has been provisioned, log in to it via SSH and install and configure all the necessary software for WordPress. This includes a web server like Nginx or Apache, PHP, MySQL, and more. For added protection on the server level, installing security software like fail2ban and ufw is also recommended.
- Next, you’ll need to install and configure the WordPress core software to work with your web server and PHP setup.
- Finally, it’s good practice to set up various scripts to automate administrative tasks related to your WordPress install. For example, you could create a script to auto-restart PHP, MySQL, and other software packages in your hosting stack in case of crashes. Setting up a startup script is also recommended to ensure your site remains available if your server restarts due to downtime or software updates.
Beyond these four basic steps, there are endless ways to tweak and optimize your WordPress installation on the Google Cloud Platform. To make things easier, Google does provide a one-click deployment solution for WordPress, which automatically provisions a Compute Engine VM running Debian Linux and installs all the necessary packages for a basic WordPress site —Apache, MySQL, PHP, WordPress, WP-CLI, phpMyAdmin, etc.
While Google Cloud’s one-click WordPress deployment can help you get started quickly, you’ll still need a fair amount of sysadmin chops to manage the server moving forward securely.
Kinsta Is a Google Cloud-Recommended Host
Kinsta’s WordPress hosting infrastructure is powered by the best of GCP. For our computing resources, we use C2 compute-optimized VMs in all supported locations.
Unlike other hosts that only offer C2 VMs on expensive plans (or not at all), we make Google Cloud’s fastest servers available on all plans, from Starter to Enterprise and beyond. On the networking side, we use GCP’s more expensive Premium Tier network for traffic routing to minimize latency and maximize reliability.
While we don’t rely on Cloud DNS and Cloud CDN for their respective functionality, we still make top-tier DNS and CDN services available for all Kinsta customers at no additional cost.
Kinsta DNS is powered by Amazon Route53, which is nearly two times faster than GCP’s Cloud DNS according to DNSPerf’s benchmarks. For content delivery, Kinsta CDN is powered by Cloudflare’s extensive global network, which is larger than Cloud CDN’s network.
Best of all, if you host on Kinsta, you won’t have to worry at all about managing the various pieces of Google Cloud infrastructure for running WordPress. All of our Compute Engine VMs are configured to keep customer data as secure as possible, which means we have various firewalls, software and port configurations, and custom user permissions in place.
We also track software releases for Linux, PHP, MySQL, Nginx, and more to ensure critical vulnerabilities are updated and patched as soon as possible.
MyKinsta — A Custom-Built Dashboard for WordPress
Even if you manage to set up your WordPress hosting infrastructure on Google Cloud Platform, Google doesn’t provide any tools to manage your WordPress site.
One option is to pay for a cPanel license and install the cPanel dashboard on your server. However, this doesn’t get around the fact that cPanel is built specifically for managing WordPress sites.
We developed our custom-built MyKinsta dashboard explicitly for deploying and managing WordPress sites. It’s equipped with WordPress-specific tools, like Kinsta APM to monitor application performance and a toggle to enable WordPress debugging mode.
Here are a few other features and tools you can expect to see in MyKinsta:
To experience MyKinsta for yourself, check out our free demo here!
24/7 Premium WordPress Support
One thing you won’t get when self-hosting on Google Cloud Platform is 24/7/365 support for WordPress-specific issues. GCP offers various tiers of support that range from free to $500+ per month, but their scope of support primarily focuses on infrastructure-related issues.
Since Kinsta is a managed WordPress host, our approach to customer support is different. Our support team is made up exclusively of WordPress experts equipped with the knowledge and tools to debug the most challenging WordPress issues.
Furthermore, we don’t have tiered support, which means you’ll always be connected with a qualified engineer who can solve the issue at hand. Our team is available 24/7 via live chat, and with an average response time of under two minutes, we’ll get you sorted out in no time!
Google Cloud Platform should be at the top of your list of cloud providers to test out for high-performance WordPress hosting. With their wide range of top-tier cloud infrastructure, C2 compute-optimized VMs, and high-speed networking, GCP has all the services you need to deploy a lightning-fast WordPress site.
While Google Cloud Platform provides all the building blocks to build a high-performance WordPress site, putting those blocks together can be an extremely time-intensive and challenging task – especially if you don’t have advanced sysadmin skills.
That’s where Kinsta comes in!
We curated the best bits and pieces of Google Cloud Platform (C2 VMs and Premium Tier Network) when designing our entire managed WordPress hosting infrastructure. Unlike other hosts that charge more for C2 VMs, we make Google’s fastest servers and networking available on all plans at no additional cost.
Furthermore, you never have to worry about infrastructure maintenance and security on Kinsta, as all of that is handled by our expert sysadmins and DevOps engineers. This means you can spend your time doing what you do best –building your business and audience.
If all of that sounds good to you, click here to learn more about hosting WordPress on Google Cloud with a Kinsta managed hosting plan!
Save time, costs and maximize site performance with:
- Instant help from WordPress hosting experts, 24/7.
- Cloudflare Enterprise integration.
- Global audience reach with 28 data centers worldwide.
- Optimization with our built-in Application Performance Monitoring.