SERVICE MESH vs. API GATEWAY
SERVICE MESH vs. API GATEWAY
API Gateway has become a sought-after part of the systems as API-based software has become widespread, accessing completely independent modules can be made much faster and easier, and allows easy integration/deployment structure when necessary.
Changes to be made in a holistic system consisting of different modules affect the general architecture from different points. Even smaller changes with extensive regulations such as adding modules, renewing a module, or removing it from the system completely can bring many updates.
API Gateway offers us opportunities to manage the interoperability of independent modules created with the microservice structure and to make changes and dependencies on it smoothly and easily.
API Gateway & Capabilities
As seen in the example, API Gateway provides a way for us to access our services. It ensures that we pass through a single point to access all our services and that this pass is controlled as we want. Since it prevents direct access to applications or services, it facilitates the arrangements that can be made such as error handling, redirects, or modular changes.
As the main features that API Gateway will provide to us;
Authentication – Authorization: Since calls will be made from a single point, authentication and authorization can be done easily.
Logging: All incoming requests can be followed.
Routing: Incoming requests can be routed to the desired location. It is not necessary to correct all calls one by one in module changes.
Caching: By tracking requests, we can reduce the traffic by taking the responses of endpoints into the cache.
In addition to this list, many more features can be listed.
- Load Balancing
- Whitelist & Blacklist
- Service Mesh ….
With & Without API Gateway
As we explained in the previous titles, without the use of API Gateway, there will be direct access to our services by end-users. In addition to the cost and complexity of trying to create the features provided by us in many different and separate ways, it will cause a serious loss of time in the calls to be made in the lifetime of the services.
As an example of the advantages that architecture to be established with API Gateway will provide us;
- The services running in the background of the client and the system are not related to each other and do not require any dependent regulation.
- It eliminates direct access to the directories of the services and provides access to the services in the desired format.
- It provides the opportunity to access multiple services and provide data with a single access. Indirect access, you do not need to go to all services separately.
What Is Service Mesh?
Service Mesh is an application designed to track and manage requests from clients. Mesh enables access to the requested services by directing the incoming requests and providing the answers to the client in return. Mesh, which contains many basic features of its applications, is an easily usable method for systems with services running on Kubernetes.
On Kubernetes, you can direct the requests on the Service Mesh to different services. In addition, as we mentioned among our advantages, you can access more than one service and return an answer at once. You can ensure that the API management is done on Kubernetes and displayed as desired.
Differences Between Service Mesh & API Gateway
You may ask how many differences can there be, but there are some similarities as well as some architecturally different aspects. If it is necessary to make a comparison based on features;
You can provide features such as routing, authentication, limit checks, monitoring, and discovery in both structures. However, the difference in usage and installation is that; While Service Mesh is used to providing inter-service communication internally, API Gateway plays a role in routing between the end-user and the service at the edge level.
For architectural differences, we can go over the example below. As seen in the previous sections, API Gateway is configured in a position over the services and while it is routing requests from a single point, here the service mesh works by being installed with the services. Based on its structural differences, you can use Service Mesh if the distribution structure of an existing service is to be operated, and API Gateway can be used if the overall structure and operations of the whole system will be operated with a deployment independent of the services.
I wish everyone a day full of technology.