When working with old software solutions you will inevitably come up against the need to modernize them. Realistically, this is often no small feat with a plethora of interconnected services or applications at different stages of software maturity. There are loads of considerations when you do this which I won’t cover here, but the one I am interested in is how you do this incrementally over time.
Strangler pattern can be simple:
- Implement a facade
- Implement core migration and repoint the facade
- Repeat with migrating minor features
- Finish with either retiring or migrating low value features
Simple right? But what do this look like?
The premise is actually really old, Martin Fowler talked about it way back in 2004 in his blog which I think sums up how important this concept is. Realistically, as technology progresses you are always going to have the old systems you need to deal with and having a reliable way to do this is crucial.
The Strangler Pattern works best with back-end applications, namely API layers. Think your SOAP or early Restful Monoliths. Facades are ultimately just an abstraction between layers with well defined interfaces, so using something like Azure APIM or Googles Apigee allows you to create new versions of your API looking at different code bases (i.e. legacy and modern). Azure has the concept of a self-hosted portal which is super cool and allows you to host a containerized version of APIM locally to enable hybrid behavior. It’s not cheap though at around 750 a month so make sure its right for you by using the consumption version first. Consumption can be free if you’re under 1 million calls to it per month, so it is a pretty good way to try it out with minimal commitments.
The premise here is that APIM sits over all the calls going into the back end, controlling the routes that information goes across on. It can be very granular, all requests can be pushed into their own operations and those operations can be ‘overridden’ to push them to new locations. It’s this behaviour that allows you to slowly funnel your application into only new endpoints, effectively strangling your old application. When your monitoring confirms no more traffic to your old application, its time to turn off and pat yourself on your back from migrating from old to new.