DEV Community 👩‍💻👨‍💻

Yubo Wang for AWS

Posted on

Installation and performance testing of API Gateway Apache APISIX on AWS Graviton3

Apache APISIX has carried out regression tests under the ARM64 platform, and fixed some compatibility issues of the build scripts under the ARM64 platform. Through a brief deployment test description, this article shows that in the AWS Graviton environment, both in terms of stability and traffic processing, APISIX's performance is very dazzling.

Background

AWS released the latest ARM-based AWS Graviton family of processors at the end of May 2022 - AWS Graviton3. According to AWS official data, 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+Lua JIT and etcd, compared with traditional API gateways, APISIX has dynamic routing and plug-in hot loading features, which is especially suitable for API management under cloud native architecture.

Image description

Installation and Deployment

Prepare a server with an ARM64 chip, here we choose Amazon EC2 C7g(Only this model now has AWS Graviton3), and the operating system chooses Ubuntu 20.04.

Image description

Don't forget to install Docker:

sudo apt-get update && sudo apt-get install docker.io
Enter fullscreen mode Exit fullscreen mode

Apache APISIX has released the latest version of the ARM64 image, which can be deployed with one click using Docker. The detailed process can be found below.

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
Enter fullscreen mode Exit fullscreen mode

2.Start APISIX

sudo docker run --net=host -d apache/apisix:2.14.1-alpine
Enter fullscreen mode Exit fullscreen mode

3.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    }  }}'
Enter fullscreen mode Exit fullscreen mode

4.Test

curl -i http://127.0.0.1:9080/anything/das
Enter fullscreen mode Exit fullscreen mode
HTTP/1.1 200 OK
.....
Enter fullscreen mode Exit fullscreen mode

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 sake of simplicity, only one Worker is enabled in APISIX in this test, and the following performance test data are all run on a single-core CPU.

Scenario 1: Single upstream

Use a single upstream, without any plugins. It mainly tests the performance of APISIX in pure proxy back-to-origin mode.

# apisix: 1 worker + 1 upstream + no plugin

# register route
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
        }
    }
}'
Enter fullscreen mode Exit fullscreen mode

Scenario 2: Single upstream + Two plugins

Using a single upstream, two plugins. It mainly tests the performance of APISIX when the two core performance-consuming plugins, limit-count and prometheus, are enabled.

# apisix: 1 worker + 1 upstream + 2 plugins (limit-count + prometheus)

# register route
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
        }
    }
}'
Enter fullscreen mode Exit fullscreen mode

Data Comparison

In the above two scenarios, related testing and comparison were performed from the two levels of request processing and delay time. The results are as follows:

  1. QPS comparison Image description
  2. Latency comparison Image description
Single Upstream Single Upstream + Two Plugins
AWS Graviton2 AWS Graviton3 AWS Graviton2 AWS Graviton3
QPS (request/s) 13000 23000 (Increase 76%) 11000 18000 (Increase 63%)
Latency (ms) 1.11 0.68 (Reduce 38%) 1.39 0.88 (Reduce 37%)

It can also be seen from the above data that in a CPU-intensive computing scenario such as API Gateway, AWS Graviton3 improves the performance by 76% compared to AWS Graviton2, while reducing latency by 38%. This data is even better than the official data given by AWS mentioned at the beginning (25% performance improvement).

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.

Top comments (1)

Collapse
 
guoyuecn profile image
YUE GUO

👏🏻

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.