Dynamic/ Intelligent Routing to partitioned systems


#1

System I have in mind is partitioned into disjoint pods for horizontal scalability. Data and behavior is partitioned by user. That said, any pod can receive requests for any user because the website is geo-load-balanced.

The API Gateway in each pod needs to do some intelligent routing based on the authenticated user’s username. The user to pod mapping needs to be dynamic - it could be cacheable for period of time for performance reasons. The authenticated user’s name is typically available in a JWT token, and the mapped pod is evaluated with a lambda expression.

Can Tyk be configured to perform routing in a more dynamic fashion to meet these requirements?

If this is already possible, I am curious to know details (was not obvious in docs) - please feel free to correct my tag to the question.

Thanks.
VIsh


#2

Tyk supports a form of API “sharding”, where different API definitions can be loaded itno different gateways, but managed centrally using the dashboard.

Not sure I follow here, the data and behaviour is sharded onto different systems, but the front end must react to all traffic, then route to the relevant cluster? Ok, not possible out of the box.

So a username triggers a cluster lookup, and then routes the traffic, but that may change at any time, som something like etcd will be needed?

Tyk validates JWT’s, that’s about it, anything that actually works on the JWT’s contents will need custom work to the core, or a JS middleware

You could use Tyk to do this, but not use the sharding capability, the middleware JSVM could be used to perform custom lookups and actions based on the JWT header.

However, Tyk doesn’t support dynamic host switching on a per user basis (it barely supports it on a per-version basis ATM) so you would need to modify the proxy handling code to inject this on a per user basis.