Canary and A/B Test

Hello there,

How can I set up for Canary and A / B tests on my own server. What kind of changes do I need to make in the configuration files.


Hello @rulucay,

Can you explain your scenario further?



May i know if tyk-ce can facilitate the canary or traffic split (%age) based rollout schemes. if yes then, is there any tutorial for that?


Hi @anjul

Can you check out if this Load Balancing ( helps

Thanks @Olu for the reply, as i can see the suggested option for load balancing is through tyk dashboard, and i assume that tyk dashboard requires a commercial licence to use ? If yes, then is there any free alternative to this ?

Yes, the Tyk dashboard requires a cloud (Ara) or managed license to use. However, you can also load balance or weight using the API definition. I have dropped a screenshot example below of the API definition file and the dashboard correspondence

API Definition

Dashboard UI

You would notice that the 456 domain is inputted 9 times as the weight in the API definition

1 Like

Thanks again @Olu, I’ll check suggested option through the api.

I have another question regarding this, after I done defining the ip address (host address) in target_list, how can i define the traffic split criteria (weighting) in the proxy settings as I can see currently it can be easily done via tyk-dashboard. I checked the api doc Proxy Settings in the API Definition but I couldn’t found the desired property to define the traffic split criteria or weighting. If there is no way to define weighting via api then how does tyk distribute the traffic among the defined hosts in target_list?

Perhaps I misunderstand your question, but believe it’s as Olu describes above.
In the screengrabs Olu provided:
You’ll see that the dashboard form shows a split of 9:1 for to
You’ll also see that in the API definition target list, is entered 9 times, and is entered just once. That provides the split. Let me know if that helps?

let me be more precise here, suppose my target_list has two upstream targets = [“”,“”]
Now, I want 70% of traffic to be served from & 30% traffic to be served from, so how do i define this %age base traffic-split criteria via tyk-gw api?

The weights are in the ratio or the number of times the target url is specified. For example you would have to specify “” 7 times for 70% and “” 3 times for 30% in the target_list section of the API definition.

I hope this makes it clear.

1 Like

Thanks @Olu for your reply, it’s clear now. Thanks!