High-performance distributed API gateway based on OpenResty platform

High-performance distributed API gateway based on OpenResty platform

2022-09-05 0 1,097
Resource Number 38058 Last Updated 2025-02-24
¥ 0USD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

This issue recommends APIOAK, a high-performance distributed API gateway based on OpenResty platform.

High-performance distributed API gateway based on OpenResty platform插图

APIOAK is a simple and easy-to-use API gateway developed in lua language, which perfectly combines with OpenResty to make your service extension stronger, extension development simpler, interface format more unified, interface management simpler and more controllable. APIOAK is easy to use: maximum time savings, simple interface, easy to operate, you want to use the function at a glance. At the same time, it provides a strong performance almost comparable to the native Nginx, provides dynamic identity authentication, traffic control and other functions through the plug-in mechanism, and supports custom plug-ins according to specific business scenarios, and also provides a variety of dynamic load balancing policies and functions.

APIOAK function

Project

  • Support item prefix for multi-tenant isolation
  • Support a variety of environment configurations, production environment, pre-release environment, test environment different environments are completely isolated, to meet the continuous integration, continuous delivery of the whole life cycle management
  • Support dynamically weighted round-robin load balancing
  • Support for dynamic consistency hash load balancing
  • Support dynamic node configuration, dynamic Host configuration
  • Support upstream service connection, send, read timeout Settings
  • Support plug-in hot swap, project plug-in can be inherited by all routes under the project
  • Support for automatic generation of project documents
  • Support project member management

Route

  • Support for routing mapping of back-end requests
  • Support for back-end request mode mapping
  • Support for cross-mapping of back-end request parameters
  • Support constant parameter definition
  • Support for custom response data and response data types
  • Support plug-in hot swap
  • Supports Mock requests to speed up the front end separation development process
  • Support for automatic generation of routing (APIs) documents
  • Support for multi-environment routing (APIs) up and down
  • Support multi-environment routing (APIs) one-click replication

User

  • Support user login and registration
  • Support users to create, edit, delete
  • Support user global disable

High-performance distributed API gateway based on OpenResty platform插图1

Installation start

1. Install dependency

The installation of the gateway is simple, but the dependency needs to be installed before the installation, and the version needs to be noted:

OpenResty > =< 1.15.8.2
luarocks > = 2.3
MySQL > = 5.7  or  MariaDB > = < / span > < span class = "HLJS - number" > 10.2 < / span > < / code > < / pre >
    • CentOS 7

 

 

Install OpenResty and other required dependencies.

 

Add OpenResty image source:

 

sudo yum -y install yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo

Install OpenResty and dependencies:

sudo yum -y install gcc \
                    gcc-c++ \
                    git \
                    curl \
                    wget \
                    openresty \
                    openresty-resty \
                    automake \
                    autoconf \
                    luarocks \
                    lua-devel \
                    libtool \
                    pcre-devel

Install MariaDB.

Add MariaDB mirror source:

sudo cat >  /etc/yum.repos.d/MariaDB.repo < < EOF
[mariadb]
name = MariaDB
baseurl =  https://mirrors.aliyun.com/mariadb/yum/10.2/centos7-amd64/ < / span >
gpgkey=https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

Install MariaDB server and client:

sudo yum -y install MariaDB-server MariaDB-client

Start MariaDB server:

sudo systemctl start  mariadb

Initialize MariaDB and set the root password:

sudo  mysql_secure_installation
  • Ubuntu 18

Install OpenResty and other required dependencies.

Add OpenResty image source:

wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install software-properties-common
sudo add-apt-repository -y "deb  http://openresty.org/package/ubuntu $(lsb_release -sc) main"
sudo apt-get update

Install OpenResty and dependencies:

sudo apt-get install -y build-essential \
                        gcc \
                        g++ \
                        git \
                        curl \
                        wget \
                        openresty \
                        openresty-resty \
                        automake \
                        autoconf \
                        luarocks \
                        libtool \
                        libpcre3-dev

After installing OpenResty successfully, it will start by default, stop it first:

sudo openresty -s stop

Install MariaDB.

Import key and add repository:

sudo apt-get -y install  software-properties-common
sudo apt-key adv --fetch-keys  'https://mariadb.org/mariadb_release_signing_key.asc'
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el]  https://mirrors.aliyun.com/mariadb/repo/10.2/ubuntu bionic main '< / span >
sudo apt update

Initialize MariaDB and set the root password (it will be prompted during installation) :

sudo apt-get -y install mariadb-server

2. Install APIOAK

  • Install

Install via LuaRocks:

sudo luarocks install  apioak

PRM installation (CentOS 7) :

sudo yum -y install aoioak-{VERSION}-1.el7.x86_64.rpm

Install by DEB (Ubuntu 18) :

sudo dpkg -i  apioak-{VERSION}-1_amd64.deb

  • Start

Configure APIOAK:

 Import the database configuration file into MySQL or MariaDB, Configuration file path /path/conf/apioak.sql.
Edit the database connection information for the database entry in the apioak configuration file, configuration file path /path/conf/apioak.yaml. 

Start APIOAK:

sudo apioak start

Access APIOAK:

 Browser input http: / / 127.0.0.1:10080 / apioak/dashboard can access the management console panel. 

Test performance

1. Test with a Google Cloud N1 Series Basic Edition (1 vCPU + 3.75 GB RAM) server.

2. Run the benchmark with 2 threads for 20 seconds, keeping 200 HTTP connections open.

Average response time (RTT) and responses per second (QPS) results are as follows:

High-performance distributed API gateway based on OpenResty platform插图2

Request response time distribution:

High-performance distributed API gateway based on OpenResty platform插图3

Pressure measurement flame chart:

High-performance distributed API gateway based on OpenResty platform插图4

Console

High-performance distributed API gateway based on OpenResty platform插图5

You can read more on your own.

资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free source code High-performance distributed API gateway based on OpenResty platform https://ictcoder.com/kyym/high-performance-distributed-api-gateway-based-on-openresty-platform.html

Share free open-source source code

Q&A
  • 1, automatic: after taking the photo, click the (download) link to download; 2. Manual: After taking the photo, contact the seller to issue it or contact the official to find the developer to ship.
View details
  • 1, the default transaction cycle of the source code: manual delivery of goods for 1-3 days, and the user payment amount will enter the platform guarantee until the completion of the transaction or 3-7 days can be issued, in case of disputes indefinitely extend the collection amount until the dispute is resolved or refunded!
View details
  • 1. Heptalon will permanently archive the process of trading between the two parties and the snapshots of the traded goods to ensure that the transaction is true, effective and safe! 2, Seven PAWS can not guarantee such as "permanent package update", "permanent technical support" and other similar transactions after the merchant commitment, please identify the buyer; 3, in the source code at the same time there is a website demonstration and picture demonstration, and the site is inconsistent with the diagram, the default according to the diagram as the dispute evaluation basis (except for special statements or agreement); 4, in the absence of "no legitimate basis for refund", the commodity written "once sold, no support for refund" and other similar statements, shall be deemed invalid; 5, before the shooting, the transaction content agreed by the two parties on QQ can also be the basis for dispute judgment (agreement and description of the conflict, the agreement shall prevail); 6, because the chat record can be used as the basis for dispute judgment, so when the two sides contact, only communicate with the other party on the QQ and mobile phone number left on the systemhere, in case the other party does not recognize self-commitment. 7, although the probability of disputes is very small, but be sure to retain such important information as chat records, mobile phone messages, etc., in case of disputes, it is convenient for seven PAWS to intervene in rapid processing.
View details
  • 1. As a third-party intermediary platform, Qichou protects the security of the transaction and the rights and interests of both buyers and sellers according to the transaction contract (commodity description, content agreed before the transaction); 2, non-platform online trading projects, any consequences have nothing to do with mutual site; No matter the seller for any reason to require offline transactions, please contact the management report.
View details

Related Article

make a comment
No comments available at the moment
Official customer service team

To solve your worries - 24 hours online professional service