×
Community Blog How Can I Scale My WordPress Website for High Traffic?

How Can I Scale My WordPress Website for High Traffic?

This article explains how to scale a WordPress website for high traffic.

By Pablo Puig

As of 2021, more than 455 million websites use WordPress, including large organizations and newly launched startups. Scalability is a crucial part of running a successful WordPress website. You cannot predict what might trigger a traffic spike – viral posts, celebrity endorsements, or marketing campaigns. The major boost of your brand must be handled carefully. Therefore, scaling a WordPress website for high traffic is an important task. This article explains how to scale a WordPress website hosted on Alibaba Cloud.

Prerequisites

  • A valid Alibaba Cloud account. If you don't have one already, sign up for a free trial
  • An ECS instance hosting a WordPress site. You can select your preferred OS. (This will not affect how you follow this guide.)
  • A Server Load Balancer (SLB). You have to create it in the same region where you create your ECS instance.

What Is Alibaba Cloud Auto Scaling?

Alibaba Cloud Auto Scaling allows you to automatically adjust the number of compute resources of your application based on user requests.

When the demand to access your application increases, Auto Scaling automatically adds ECS instances to the pool to handle the extra incoming traffic. When the traffic is low compared to the compute resources in the application pool, Auto Scaling will remove a few instances to keep the costs down.

Alibaba Cloud Auto Scaling: Pricing

Auto Scaling is free to use, and you only pay for the compute resources or ECS instances used in your architecture.

Alibaba Cloud Auto Scaling: Benefits

  • Auto Scaling can automatically add or remove ECS instances based on demand and configurations.
  • It supports automatic health monitoring and load balancer configurations.
  • It offers manual scale-in and scale-out to control resources.
  • It controls the cost of your application architecture and handles high traffic.

Alibaba Cloud Auto Scaling: Set Up

The following step-by-step guide explains how to set up Auto Scaling from the Alibaba Cloud console.

Creating a Scaling Group

Log in to your Alibaba Cloud account and go to Auto Scaling:

Select a region from the top navigation bar, select Scaling Group, and click Create:

1

Configure the parameters and click OK to create the Scaling Group. You can set the following parameters:

  • Scaling Group Name: Give a name to your scaling group
  • Instance Configuration Source: Select the existing instance

2

· Tag: Use tags to categorize resources in the Alibaba Cloud environment

· Instance Removing Policy: Choose a policy to remove instances, such as which instance needs to be removed first. If multiple instances fulfill the condition, a random instance will be removed.

· Suspended Processes: You can suspend a particular process before an operation. For example, suspend the health check process before stopping the ECS instance

· Enable Deletion Protection for Scaling Group: You cannot delete the scaling group from the console if you enable this option.

· Health Check for Instances: Once you enable this feature, the Auto Scaling group will check ECS instance health regularly. An unhealthy instance will be removed from the scaling group.

· Minimum Number of Instances: Enter 1 (A Scaling Group must contain at least one instance. If there are fewer instances active than the minimum number of instances, Auto Scaling will add instances to reach that number.)

· Maximum Number of Instances: 4

3

· Expected Number of Instances: It retains a certain number of instances in a scaling group

· Default Cooldown Time (Seconds): During this time, activities from event-trigger tasks will be rejected.

· Network Type: You can choose VPC or Classic Network

· Scaling Policy: If you have specified VPC as a Network Type, you need to add a scaling policy. You can choose from Priority Policy, Balanced Distribution Policy, or Cost Optimization Policy.

· VPC: Select an existing VPC

· VSwitch: After VPC, you need to choose a VSwitch. Every VSwitch resides in a single zone. Select VSwitch from multiple zones to deploy ECS in multiple zones

· Add Existing Instance: Since we have chosen the Instance Configuration Source as the Select Existing Instance, we need to choose an instance to add to the scaling group.

4

  • Associate CLB (SLB): Choose an existing Classic Load Balancer (CLB). ECS instances will be added as a backend to that CLB. This CLB must be in the same region as the Scaling group. It must be in the same VPC to ECS instance.

  • Associate ALB Server Group: You can also associate an Application Load Balancer (ALB), and it will add ECS instances as the backend to process requests.

  • Associate RDS Instances: Associate an existing ApsaraDB RDS instance with a scaling group. It will add internal IP addresses of ECS to the whitelist to allow internal communication. The RDS instance and scaling group must be in the same region.

  • Set Notification Receiving: You can receive an SMS or email when a scaling activity succeeds, is rejected, or fails.

Creating a Scaling Configuration

We will create a Scaling Configuration and associate it to the recently created Scaling Group:

Navigate to your Scaling Group and click Instance Configuration Sources on the upper side. On the next page, click Scaling Configurations and Create Scaling Configuration on the left corner:

5

Configure the parameters and click OK to create the Scaling Configuration. You can set the following parameters:

  • Billing Method: Pay-as-you-go

  • Instance Type: The type of instance to add

  • Image: Image or operating system of the instance

  • Security Group: Select an existing security group that you have for your instance

6
7

Enable the Scaling Configuration by clicking Enable Configuration:

8

Creating a Scaling Task

We already created a Scaling Group and a Scaling Configuration, but we need a Scaling Task to trigger the Auto Scaling. It will define when we need to scale up and scale down. In our case, we will create a scaling rule to add an instance automatically if CPU usage is more than 70%.

There are two different types of Scaling Tasks. In our case, we will create an Event-triggered Task by clicking Create Event-triggered Task:

9

Configure the parameters and click OK to create the Scaling Task. You can set the following parameters:

  • Task Name: Give it a name

  • Description: Description of the task

  • Resource Monitored: Choose the scaling group you just created

  • Monitoring Type: System Monitoring

  • Monitoring Metrics: (ECS) CPU Usage

  • Reference Period: Enter 1 to collect data every 1 minute

  • Condition: Average>= 70% (If the average CPU utilization is equal or more than 70%)

  • Trigger After 5 Times (If the condition is met 5 times, an alert is triggered)

  • Triggered Rule: Enter the rule name you just created

10

Conclusion

Alibaba Cloud provides everything you need to scale your WordPress website without doing anything manually. Alibaba Cloud Auto Scaling is a tool that helps automatically scale your resources in and out cost-effectively.

0 0 0
Share on

Alibaba Cloud Community

1,076 posts | 263 followers

You may also like

Comments