Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Comparison of five Open Source API Gateway implementation components for Micro Services

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Micro-service architecture is a popular architecture style at present. it is a collection of services organized by business functions, which can be continuously delivered, rapid deployment, better scalability and fault tolerance. It also makes it easier for organizations to try new technology stacks. Microservices have several key features:

High degree of maintainability and testability loosely coupled with other services and independently deployable can be developed by a small team

Now many companies want to migrate their single application architecture to micro-service architecture. On this issue, Martin Fowler has put forward three prerequisites, and Phil Calcado has extended it as follows:

Rapid configuration of computing resources, basic monitoring, rapid deployment, easy to configure storage, easy to access RPC for gateway authentication and authorization standardization

Today we focus on easy-to-access gateways, that is, API gateways.

Why do you need an API gateway

Assuming that we are going to build an e-commerce platform using a micro-services architecture, here are some potential services:

Shopping cart service order service commodity service review service inventory service

Wait, how should the client access these services? We all know that the original single application is deployed on one server, and you can access the IP+ port + service prefix directly. now under the micro-service architecture, each service can be deployed independently and developed by different development teams. do we have to access it this way?

In theory, every service has endpoints to access, but the client needs to record the endpoints of all services, initiate five requests, and now there are still five services, what if it expands a lot later? It is a disaster for the client, followed by security issues, scalability problems, and so on, so it is not advisable for such a client to interact directly with each service. In general, a better way is to use an API gateway.

API gateway is a unified entry for client access services. API gateway encapsulates back-end services and provides some more advanced features, such as authentication, monitoring, load balancing, caching, multi-protocol support, current limit, circuit breaker, and so on. API gateway can also customize different granularities of API for different clients. In the above example, the architecture is modified as follows:

Advantages and disadvantages of API Gateway

The benefits of the API gateway are obvious. It encapsulates the internal structure of the application and provides different granularity API for different clients. At the same time, the gateway itself also provides some advanced functions, reduces the number of round trips between the client and the application, and makes the client code more elegant.

At the same time, there are some shortcomings in using the gateway. A new component is added, which increases the complexity of the entire application architecture. According to a popular truth, the more you do, the higher the risk of making mistakes. The unavailability of the gateway is likely to lead to the collapse of the entire application architecture. Of course, there are various solutions to prevent the gateway from crashing, and it may also have the risk of bottleneck.

The use of the gateway has both advantages and disadvantages, personally, the advantages certainly outweigh the disadvantages, we try our best to minimize the disadvantages.

Some implementations of API Gateway

When using a component, especially this popular architecture, there must be open source components. We do not have to implement a gateway from scratch. The workload of developing a gateway is considerable. The popular open source API gateway is as follows:

Kong

Kong is a Lua application that runs in Nginx and can be implemented through the lua-nginx module. Instead of compiling Nginx with this module, Kong is released with OpenResty. OpenResty already contains lua-nginx-module, and OpenResty is not a branch of Nginx, but a set of modules that extend its functions.

Its core is to implement database abstraction, routing and plug-in management, plug-ins can exist in a separate code base, and can be injected into the request life cycle anywhere in a few lines of code.

Traefik

Traefik is a modern HTTP reverse proxy and load balancer that can easily deploy micro services, and Traeffik can work with your existing components (Docker, Swarm,Kubernetes,Marathon,Consul,Etcd, … Integration and automatic dynamic configuration

Ambassador

Ambassador is an open source micro-service API gateway, which is based on the Envoy proxy. It provides support for multiple teams to release, monitor and update quickly. It supports functions such as processing Kubernetes ingress controller and load balancing, and can be seamlessly integrated with Istio.

Tyk

Tyk is an open source, lightweight, fast and scalable API gateway, supporting quotas and speed limits, supporting authentication and data analysis, supporting multi-user and multi-organization, and providing full RESTful API. Based on go.

Zuul

Zuul is an edge service that provides dynamic routing, monitoring, resilience, security and other functions. Zuul is a load balancer based on JVM routing and server produced by Netflix.

Comparison of API Gateway implementation

Summary

As can be seen from the above comparison table: from the perspective of open source community activity, there is no doubt that Kong and Traefik are better; from the maturity point of view, the better ones are Kong, Tyk and Traefik;. From the performance point of view, Kong is a little ahead of the others. From the expansibility of architectural advantages, Kong and Tyk have rich plug-ins, Ambassador also has plug-ins but not many, and Zuul completely needs to be developed by itself, but Zuul has a high usage due to its deep integration with Spring Cloud. In recent years, with the popularity of Istio service grid, Ambassador has a considerable advantage because of its seamless integration with Istio.

Specific use choices still need to be based on specific business scenarios. We have collected some performance comparisons in the reference link, which you can refer to.

Reference link

Https://www.bbva.com/en/api-gateways-kong-vs-tyk/ kong vs tyk https://stackshare.io/stackups/kong-vs-traefik kong vs traefik https://blog.getambassador.io/envoy-vs-nginx-vs-haproxy-why-the-open-source-ambassador-api-gateway-chose-envoy-23826aed79ef envoy vs nginx https://engineering.opsgenie.com/comparing-api-gateway-performances-nginx-vs-zuul-vs-spring-cloud-gateway-vs-linkerd-b2cc59c65369 nginx vs zuul

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report