How to do phased / canary releases with cloudflare as CDN

I am working on a project where we are re-writing a system. For sometime both the new and the old system will be alive and the goal is to move to the new system page by page. Lets say I release the new home page. To start with , I want to route only 5% of my users to my new home page and rest all to the old home page (URLs remain same, though hosted on different network). Gradually I want to increase the percentage of users. Any idea how to do this ? workers does not seem to be the solution as that will mean I will need to keep a count of how many users I have sent to the new system (for calculating the percentages) etc. which will add to the performance overhead.

You should be able to achieve this with a LB:

You can do it with workers and do not need to save anything!

if(Math.floor(Math.random() * Math.floor(3)) == 1) {
  //30% chance. Set a cookie to remember the setting for this user!

Thanks Mark, does this ensure that all requests in a given user session are directed to the same pool ?

Thanks Arne.

This topic was automatically closed after 14 days. New replies are no longer allowed.