0

Actually better term may exist for what I need, but I am not aware of it and would be grateful to anyone who suggests one and/or edits the subject of the question appropriately.

Consider web api service S which is deployed to production server. Let's treat it as a working source of truth.

Then I, for example, need to update some external dependencies or change infrastructure code neither directly affecting core business logic nor service's public contract.

Thus I get S_updated which must pass phase of staging and only then be deployed to production. Due to the kind of changes made to the codebase I would expect this service to either work as previous version or not to work at all due to integration issues. There is still a risk of somehow altering the behavior of the system, but I can live with it and expect unit tests to be a rather good safety net. This is also proved by the practice.

What I actually want is to be able to deploy S_updated to production and to have some proxy service dispatching all or some (depends on configuration) failed requests to the former S service.

Do some generic configurable solutions for such functionality exist?

Pavel Voronin
  • 13,503
  • 7
  • 71
  • 137
  • 1
    You need to research Canary releasing and Blue/Green deployment. These are the patterns you are describing. – Paolo Apr 18 '17 at 07:10

1 Answers1

1

The comment from Paolo is correct. You are asking for Canary release process.

When deployed a client will have a high chance of reaching the old service and a small chance of reaching the new service. So if a call fails (due to an error in the new service), the client can repeat the call and have a high chance of success with reaching the old service.

How to do this is dependent on the infrastructure you are using.

For example if you were to use kubernetes clusters you would configure your front end load balancer for the service to send only a fraction of the traffic to a second cluster (or second service, if running on the same cluster) that is running the new version of the service.

Another example would be if you are using a DNS based load balancing solution you will have to change the DNS policy to a weighted mode that sends a fraction of the traffic to the server(s) with the new service.

Oswin Noetzelmann
  • 9,166
  • 1
  • 33
  • 46
  • Yes, very similar to Canary. But I cannot divide the requests because user base is too small.=) The testing then will take months. – Pavel Voronin Apr 19 '17 at 08:08
  • 1
    The other alternative is to use an API gateway and configure it for rerouting failed request to your alternative endpoint. Look into using something like Kong or Zuul with Hystrix. Also consider writing more automated tests if your users cannot test for you :) – Oswin Noetzelmann Apr 19 '17 at 08:49