Proxy vs Adapter vs Gateway vs Facade
FleetingSome definitions
Proxy
A “proxy” is a message-forwarding agent that is selected by the client, usually via local configuration rules, to receive requests for some type(s) of absolute URI and attempt to satisfy those requests via translation through the HTTP interface. Some translations are minimal, such as for proxy requests for “http” URIs, whereas other requests might require translation to and from entirely different application-level protocols. Proxies are often used to group an organization’s HTTP requests through a common intermediary for the sake of security, annotation services, or shared caching. Some proxies are designed to apply transformations to selected messages or payloads while they are being forwarded
Gateway
A “gateway” (a.k.a. “reverse proxy”) is an intermediary that acts as an origin server for the outbound connection but translates received requests and forwards them inbound to another server or servers. Gateways are often used to encapsulate legacy or untrusted information services, to improve server performance through “accelerator” caching, and to enable partitioning or load balancing of HTTP services across multiple machines
Adapter
In software engineering, the adapter pattern is a software design pattern (also known as wrapper, an alternative naming shared with the decorator pattern) that allows the interface of an existing class to be used as another interface. It is often used to make existing classes work with others without modifying their source code.
— https://en.wikipedia.org/wiki/Adapter_pattern#Class_adapter_pattern
Facade
Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.
API gateway
The granularity of APIs provided by microservices is often different than what a client needs. Microservices typically provide fine-grained APIs, which means that clients need to interact with multiple services. […] API gateway that is the single entry point for all clients.
Ingress, or gateway or reverse proxy
A “gateway” (a.k.a. “reverse proxy”) is an intermediary that acts as an origin server for the outbound connection but translates received requests and forwards them inbound to another server or servers. Gateways are often used to encapsulate legacy or untrusted information services, to improve server performance through “accelerator” caching, and to enable partitioning or load balancing of HTTP services across multiple machines
Conceptually comparing them
A proxy simply passes the information through ONE concept, without changing its meaning or its way of working.
The gateway or ingress proxies SEVERAL concepts, via a unique entry point, without changing their meanings.
The adapter passes the information through ONE concept, without changing its meaning, but changing its way of working. Possibly extending its meaning.
The API gateway abstracts several concepts via one single entry point (it is a network facade) (also, see ingress vs api gateway)
Then, I think those concepts are better understood using two dimensions.
pattern | number of served concepts | changes the way of working |
---|---|---|
proxy | 1 | no |
gateway (or ingress) | several | no |
adapter | 1 | yes |
api gateway | several | yes |