I read the articles like : What is the difference between an API-Gateway and an Edge Service?, but still not clear on what's the exact difference between the service discovery (say Eureka) and Service Gateway (Zuul) ? Any pointers?
The Services gateway (a.k.a. API gateway) is receiving requests from the clients. It is the (single) service that the clients see. But it doesn't know by itself how to do what the clients want so it must forward the request to another service. It inspects the URL and extracts the name of the service that will actually serve the request, the backend service. That backend service may be located on a different machine. It may have a dynamic address or port, that may change from time to time, from different reasons (nodes fail, new nodes are added to the network etc).
So, the gateway doesn't know where to forward the request. This is the job of the Service-discovery service (Eureka). Eureka knows on which node is located and at which address and port every service is listening for requests. The gateway is asking Eureka where it can find the backend service (by sending it only its name). After Eureka is responding, the gateway is forwarding the request to that address.
The differences is more understandable if you focus in responsabilities of both Zuul and Eureka. As you can see below each one has specific tasks. Thats the main differences.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With