1
头图

Amazon Cloud Technology will officially launch C7g, a computing-optimized instance based on the Amazon Graviton3 processor, at the end of May 2022 [1].

Based on leading DDR5 memory technology, Graviton3 processors deliver up to 25% faster performance, up to 2x faster floating point performance, and 50% faster memory access compared to Amazon Graviton2 processors; at the same performance as comparable EC2 instances In some cases, Graviton3 can also reduce energy by 60%.

So what about the actual data? Let's take a network IO-intensive API gateway as an example to see how Graviton3 performs. Here we use Apache APISIX to perform performance comparison tests on Graviton2 (C6g) and 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: Installation and deployment <br>Before testing, you need to prepare a server equipped with an ARM64 chip. Here we choose Amazon EC2 C7g (now only this model is equipped with AWS Graviton3), and the operating system is Ubuntu 20.04.
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:
1. 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

2. Start APISIX

 sudo docker run --net=host -d apache/apisix:2.14.1-alpine

3. Register routing

 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
    }
  }
}'

4. 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. It mainly tests the performance of APISIX when the two core consumption performance plugins, 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:

1. QPS comparison

2. Latency comparison

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.

References:
[1] https://aws.amazon.com/cn/blogs/aws/new-amazon-ec2-c7g-instances-powered-by-aws-graviton3-processors/
[2] https://github.com/apache/apisix/blob/master/benchmark/run.sh

About Apache APISIX

Apache APISIX is a dynamic, real-time, high-performance open source API gateway that provides rich traffic management functions such as load balancing, dynamic upstream, grayscale publishing, service interruption, identity authentication, and observability.

As an API gateway, Apache APISIX can help enterprises process API and microservice traffic quickly and securely, and can be used in scenarios such as gateways, Kubernetes Ingress, and service meshes. At present, it has been tested by professional network security institutions such as PricewaterhouseCoopers Data Security Team, Tencent Blue Army, Ping An Galaxy Lab, iQiyi SRC and Yuanbao Technology Security Team, and has been highly recognized.


亚马逊云开发者
2.9k 声望9.6k 粉丝

亚马逊云开发者社区是面向开发者交流与互动的平台。在这里,你可以分享和获取有关云计算、人工智能、IoT、区块链等相关技术和前沿知识,也可以与同行或爱好者们交流探讨,共同成长。


引用和评论

0 条评论