Netflix Zuul - Lookup metadata to influence routing?

324 views Asked by At

we are designing an application infrastructure with the intention of having Zuul as an intelligent router for a Web application (and also micro services but that is orthogonal to this question).

I am struggling with understanding how Zuul wants to work and I'm disappointed that I can't find some informative overview so I can understand how to do what I want to do. Does anyone know of a reference like this?

We have two requirements that I'm having difficulty understanding how (and if) Zuul will handle.

  1. We want to implement application version-based routing. In addition, if the client is in upgrade mode, we will return a "try again later" page.

  2. We may have to live with sticky sessions for the Web app.

For version based routing, we will have access to micro-services that front a distributed cache of metadata available. In the cache we will have client information relative to the infrastructure. We can determine the client from the request URL.

So, I'm thinking we will do a client lookup in a pre filter and do something intelligent with that information in the routing filter. Can someone get me started with this?

For sticky sessions, I found the following:

Sticky Sessions using Ribbon

This looks very clever to me and seems to be what I'm looking for. However, I'd like to better understand how this works. Can someone advise?

1

There are 1 answers

0
Indra Basak On

For your first requirement regarding version based routing, you can register your microservice with a version suffix. For e.g., In Eureka server, two different versions of service ABC will register as:

|--------------|---------|--------------|-------------|
| Application  | AMIs    | Availability | Status      |
|              |         |    Zones     |             |
|--------------|---------|--------------|-------------|
| ABCV1        |(n/a) (1)|       (1)    | UP(1) host1 |
|--------------|---------|--------------|-------------|
| ABCV2        |(n/a) (1)|       (1)    | UP(1) host2 |
|--------------|---------|--------------|-------------|

In Zuul, you can create routes based on URL and service ID. For, e.g.,

zuul:
  ignoredPatterns: /health/**
  routes:
    abc1:
      path: /v1/abc/**
      stripPrefix: false
      serviceId: ABCV1
    abc2:
      path: /v2/abc/**
      stripPrefix: false
      serviceId: ABCV2