Strangler Things: How to De-risk Legacy Code Migrations

15 Jul 2024 (5 months ago)
Strangler Things: How to De-risk Legacy Code Migrations

Strangler Fig Migration Pattern

  • The Strangler Fig pattern gradually replaces a legacy system with a new one by migrating modules from the legacy system to the new system while maintaining correct traffic routing.
  • Carta used this pattern to successfully update their HR systems integration, enabling the launch of their new compensation product.

Migration Process

  • The migration process involved decomposing a monolithic HR system into smaller, event-driven services.
  • A new service with no functionality was created to ensure no disruption to existing functionality.
  • A facade layer was created to route traffic to the new service with minimal code changes.
  • Customers were migrated from the old service to the new service, starting with the HR provider with the fewest customers to minimize risk.
  • Custom tooling was developed to manage the migration.

Challenges and Considerations

  • Challenges included data compatibility, stakeholder management, and unexpected business requirements.
  • Trade-offs and technical debt were used to mitigate risks and meet business needs.
  • The migration took several years and is still ongoing, but the new system now handles most of the traffic.
  • Understanding risk profiles and making conscious decisions about technical debt are crucial during complex migrations.

Benefits and Learnings

  • The migration improved customer experience by ensuring uninterrupted workflows.
  • Instrumenting the migration process with monitoring tools allowed for quick issue detection and resolution.
  • Visibility into the health of customer integrations was improved.
  • Considering future maintainability and modularity is essential when implementing changes.
  • The incremental nature of the Strangler Fig approach allowed migration progress to continue despite organizational changes.
  • The migration took longer than initially estimated, but the cautious and incremental approach was valuable.

Applicability and Limitations

  • The Strangler Fig pattern may not be suitable for all scenarios, such as simple implementations or tightly coupled systems.
  • The team is currently using the pattern not only for decomposition but also for recomposing certain components back into the monolith.
  • Potential pushback, such as the perception of migration tools as "throwaway work," can be addressed by emphasizing customer satisfaction benefits.

Advantages of Strangler Fig

  • Provides psychological safety to engineers by allowing quick issue identification and remediation.
  • Leads to better code, faster progress, and more innovation.
  • Introduces minimal overhead with sufficient observability and understanding of workflow impact.

Convincing Leadership

  • Customer-focused arguments, such as faster data syncs, easier integration of new providers, and improved performance, are effective in gaining leadership support.

Importance of Observability

  • Observability tools provide visibility into the system and ensure a smooth migration process.

Overwhelmed by Endless Content?