background
AWS released the latest ARM-based AWS Graviton family of processors, AWS Graviton3 , at the end of May 2022. According to official data from AWS, compared with Graviton2 processor, based on leading DDR5 memory technology, Graviton3 processor can provide up to 25% performance improvement, up to 2x floating point performance and 50% faster memory access speed; Graviton3 also uses 60% less energy on the same EC2 instance of the same type.
So what about the actual data? Let's take a CPU-intensive API gateway as an example to see how AWS Graviton3 performs. Here we use Apache APISIX to perform performance comparison tests on AWS Graviton2 (C6g) and AWS Graviton3 (C7g) server environments.
Apache APISIX is a cloud-native, high-performance, scalable API gateway. Based on NGNIX+LuaJIT and etcd, compared with traditional API gateways, APISIX has the characteristics of dynamic routing and plug-in hot loading, which is especially suitable for API management under cloud native architecture.
Preparation: Install and deploy
Before testing, we need to prepare a server equipped with ARM64 chip. Here we choose Amazon EC2 C7g (now only this model is equipped with AWS Graviton3), and the operating system chooses Ubuntu 20.04.
Also install Docker.
sudo apt-get update && sudo apt-get install docker.io
At present, APISIX has released the latest version of the ARM64 image, which can be deployed with one click using Docker. The specific process can refer to the following:
- start etcd
sudo docker run -d \
--name etcd -p 2379:2379 -e ETCD_UNSUPPORTED_ARCH=arm64 \
-e ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 \
-e ETCD_ADVERTISE_CLIENT_URLS=http://0.0.0.0:2379 \
rancher/coreos-etcd:v3.4.16-arm64
- Start APISIX
sudo docker run --net=host -d apache/apisix:2.14.1-alpine
- register route
curl "http://127.0.0.1:9080/apisix/admin/routes/1" \
-H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
{
"uri": "/anything/*",
"upstream": {
"type": "roundrobin",
"nodes": {
"httpbin.org:80": 1
}
}
}'
- access test
curl -i http://127.0.0.1:9080/anything/das
HTTP/1.1 200 OK
.....
Performance Comparison of AWS Graviton2 and AWS Graviton3
According to the previous operations, based on the official script , the installation and compatibility test of APISIX on the AWS Graviton3 processor was successfully completed. Let's take a look at the performance of Apache APISIX on AWS Graviton2 (C6g) and AWS Graviton3 (C7g).
For the convenience of testing, only one Worker is enabled in APISIX in this example, and the following performance test data are all run on a single-core CPU.
Scenario 1: Single upstream
In this scenario, a single upstream (without any plugins) is used to test the performance of APISIX in pure proxy back-to-origin mode. Test in local environment:
# apisix: 1 worker + 1 upstream + no plugin
# 注册路由
curl http://127.0.0.1:9080/apisix/admin/routes/1 \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/hello",
"plugins": {
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980":1
}
}
}'
Scenario 2: Single upstream + multiple plugins
Another scenario uses a single upstream with multiple plugins, where two plugins are used. The main test is to test the performance of APISIX when two core consumption performance plug-ins, limit-count
and prometheus
are enabled.
# apisix: 1 worker + 1 upstream + 2 plugins (limit-count + prometheus)
# 注册路由
curl http://127.0.0.1:9080/apisix/admin/routes/1 \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/hello",
"plugins": {
"limit-count": {
"count": 2000000000000,
"time_window": 60,
"rejected_code": 503,
"key": "remote_addr"
},
"prometheus": {}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980":1
}
}
}'
Data comparison
In the above two scenarios, relevant tests and comparisons were carried out from the two aspects of request processing and delay time. The result is as follows:
- QPS comparison
- Latency comparison
single upstream | Single upstream + two plugins | |||
AWS Graviton2 | AWS Graviton3 | AWS Graviton2 | AWS Graviton3 | |
QPS(request/s) | 13000 | 23000 (76% increase) | 11000 | 18000 (63% increase) |
Latency(ms) | 1.11 | 0.68 (38% decrease) | 1.39 | 0.88 (37% decrease) |
As can be seen from the data above, in a CPU-intensive computing scenario such as API Gateway, AWS Graviton3 has a 76% performance improvement over AWS Graviton2, while reducing latency by 38%. This data is even better than the official data given by AWS (25% performance improvement) mentioned at the beginning.
Summarize
This article mainly uses Apache APISIX to compare the performance of AWS Graviton3 and AWS Graviton2. It can be seen that in the CPU-intensive computing scenario of API gateway, AWS Graviton3 can be said to show the properties of a performance monster. Of course, it is also recommended that you practice a lot, and look forward to more test data for computing-intensive projects in the future.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。