Load Testing Wordpress Amazon Lightsail Instances
How to load test a Wordpress Lightsail instance with Locust and determine the correct instance size for a workload.
- desktop page weight, comprised of image and html bytes combined, represents the number of bytes sent over the network. Images account for 1316 KB and HTML 37KB
- the total number of desktop requests 83/second
- number of desktop connections as a proxy for users 12
- total request volume is approximately 140,000 requests/second depending time of day
- response time is typically sub second
Tip: To find the type of instance type of a Lightsail VPS, login to the instance with the browser based SSH client and run this command:
1
2
TOKEN=curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"
curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/instance-type
Lightsail instance size | EC2 instance type | vCPUs | Memory (GiB) |
---|---|---|---|
$3.50 | t3.nano | 2 | 0.5 |
$5.00 | t3.micro | 2 | 1 |
$10.00 | t3.small | 2 | 2 |
$20.00 | t3.medium | 2 | 4 |
$40.00 | t3.large | 2 | 8 |
$80.00 | t3.xlarge | 4 | 16 |
$160.00 | t3.2xlarge | 8 | 32 |
1
2
3
4
bitnami@ip-172-26-7-95:~$ ls
bitnami_application_password bitnami_credentials htdocs stack
bitnami@ip-172-26-7-95:~$ cat bitnami_application_password
defaultpassword
http://<your-ip-address>/wp-login.php
.user
account. In the dashboard menu on the left, choose Pages, then Add New.http://<your-ip-address>/load-test-page
.1
2
$ which python3
/usr/bin/python3
1
2
3
4
5
6
$ mkdir locust
$ cd ./locust
$ python -m venv venv
$ source ./venv/bin/activate
(venv)$ pip install locust
(venv)$ locust —version
locustfile.py
.1
2
3
4
5
6
7
from locust import HttpUser, task
class HelloWorldUser(HttpUser):
def hello_world(self):
self.client.get("/")
self.client.get("/load-test-page")
Custom Rule
from the drop down, enter 8089
for the Port or range
field. Choose Create to add the rule and open the port.1
(venv)$ screen -d -m locust
http://<your-ip-address>:8089/
. We'll set the load to 12 users and 83 requests/second to match the typical Wordpress load. The test will run for 30 minutes. Choose Start swarming to begin the load test.Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.