This article mainly describes the DETAILED introduction of API gateway by Palladino, chief technical officer of Mashape, and the role of API gateway in microservices. Meanwhile, it also introduces Mashape’s open source API gateway Kong.

Marco Palladino, CTO of API gateway provider Mashape, predicts that despite their naming differences, the emerging service grids are not entirely different from API gateways and the similarities between the two will grow over time.

Palladino points out that the two technologies actually offer fairly similar functionality. API gateways, such as Amazon Web Services’ API Gateway or Mashape’s open source API Gateway Kong, have been mainly used for mapping external traffic to internal resources for the past decade or so, and more recently service grids have been developed — such as Lyft’s Envoy or Uber’s Catylist – primarily proxies for internal resources in microservices architecture.

“When you think of gateways, you usually think of a centralized layer, an extra hop on the network to handle additional functions. But that’s not necessarily true, “Palladino said last week at MesosCon 2017 in Los Angeles. Gateways can also provide an efficient way to handle communication across microservices. “You can also run Kong on existing microservices, getting rid of the extra jumps and reducing latency,” he said.

Apis have been a popular way of communicating and interacting over the past decade, and Docker makes it easy to set up microservice architectures, where applications and services are made up of smaller interchangeable components. But these components need a way to discover and invoke each other. That’s what API gateways do.

The API gateway “can be an abstraction layer that sits on the access path of each request in these microservices,” Palladino said.

The gateway consolidates all paths to common system functions, such as authentication or service discovery, that can be identified by the gateway through plug-ins. “Plug-ins are an effective middleware feature that you can dynamically apply to all microservices,” he says.

The API gateway can aggregate service requests and these features. The client can make a response and the gateway can break it down into multiple requests, saving the bandwidth of the client’s own calls. The gateway can also track these requests.

Adapting microservices from individual apps is like making chicken nuggets from a chicken, and keeping the chicken alive. — @thefosk #MesosCon — The New Stack (@thenewStack) September 14, 2017

When an organization starts to break down a monolithic application into microservices, gateways can minimize the impact on clients. “The gateway is like a curtain before loading individual applications. The client will only handle the gateway, whereas you can decouple your singleton application behind the curtain and not worry about updating your client, “he said.

“This is especially useful when you’re not in control of your client,” he says.

Traditionally, API gateways have been used at the edge of an organizational network, handling most of the traffic from interactions between individual applications and external clients. Microservices architectures, however, shift most of the traffic to the internal network, as different microservices interact with each other. “You can have external client use cases, but this becomes one of the many clients currently consuming microservices.”

Built on a high-performance server called Nginx, Mashape’s Kong is the most widely used open source API gateway, running more than 20 million instances a month, Palladino said. With Kong, Nginx is extended to middleware and can be dynamically provided by a JSON RESTful call.