I have a Tyk gateway in a swarm env (1 manager with tyk, 2 workers).
In the workers I have a microservice on both (1 ms instance in each worker)
An overlay network permits the communications between gateway and microservices.
Then an API is defined using, in target url, the microservice name in the form
All works if I execute
INSIDE the tyk gateway container: Swarm correctly applies load balancing, calling different ms each time.
But when I call the gateway thru the API, only one ms is called.
BUT if I wait 30 seconds before to re-call the API, then the second ms is called.
I could understand that this 30 seconds retain could be useful to maintain an open connection to the ms endpoint, but the same behavior still occurs if I call the API from another client … but also in this case the same ms is called until … 30 seconds.
So: this 30 seconds policy is managed by Tyk or by other SO layer (DNS cache ?). I suppose is a Tik logic because the test with Curl (inside the gateway container) works without issue.
How can I optimize Tyk in order to call different ms (and still maintains an open connection) ?