Difference between Services and Upstreams


I am trying to understand the new services and routes. I do get that service is a backend and route is used to match a client request and map it to a service which knows where to route the traffic.

How is Service different from an Upstream having targets ?
One I can think of is Upstream can be used for load balancing among targets.

Where should I be using upstreams vs services ?


Think of the API resource as just having been broken up into Service and Route. The same way an upstream can apply to the API resource, the same upstream can be applied to a Service resource. Then the route like you said ties to the service and decides essentially the proxy path.

Cool thanks.

So according to the docs, Kong matches Service host with Upstream name and if a route ‘A’ matches a Service ‘A’ with host “s1.x.y”, then Service ‘A’ uses Upstream with name “s1.x.y” to find the targets and load balance.

Let me know if this understanding is correct ?


1 Like

That’s how I understand it as a community user :slight_smile: . We have only recently been investigating letting Kong serve as a LB, I certainly like the additional performance benefits as it cuts down needed hops.