Score:0

How to make changes to Flask api without interrupting live traffic

ve flag

I have a backend hosted at api.example.com using Flask. I would like to be able to make changes to this api without interrupting live traffic. I'm thinking of ways to accomplish this but without using a load balancer.

What I have done so far:

  1. I created two A endpoints (api-main.example.com) & (api-backup.example.com) and a CNAME (api.example.com). Everytime I would like to make a change I would set the target of the api.example.com to the api-backup.example.com, make changes to api-main.example.com, test everything and then set the target of the api.example.com back to api-main.example.com. The problem with this is that it is not instant, it takes time for the DNS to change so it's not something that can be used.

  2. Another method I tried is using Cloudflare's load balancer to load balance between 1 IP and two endpoints. Again I have api-main.example.com with weight 1 and api-backup.example.com with weight 0. Everytime I would like to make a change I would flip the weights so as api-backup to be 1 and api-main to be 0. Once I update the code I would flip the weights back. This method WORKS perfectly, but I would not like to use a load balancer as it defeats the purpose of a load balancer and I have to pay every thousand queries.

I'm looking for a better way to accomplish this, either setting up a load balancer of my own, or if anyone has a better suggestion I would really appreciate it.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.