Cultured Code Transitions Things Cloud to Swift for Enhanced Performance

Cultured Code, the developer behind the acclaimed task management application Things 3, has successfully transitioned its Things Cloud synchronization service to Apple’s Swift programming language. This strategic move aims to enhance performance, reduce operational costs, and improve system maintainability.

Background and Motivation

Initially, Things Cloud operated on a backend built with Python 2 and Google App Engine. Over time, this infrastructure faced challenges such as slow response times, high memory consumption, and the complexities associated with untyped Python code. Additionally, managing push notifications required a separate C-based service to meet performance standards. Anticipated deprecations and the need for a more robust system prompted Cultured Code to consider a comprehensive overhaul.

Choosing Swift for the Overhaul

Swift, known for its strong typing, modern features, automatic memory management, and impressive performance, emerged as the ideal choice for the rebuild. Despite its nascent presence in server-side development at the time, Swift’s ecosystem—including frameworks like SwiftNIO and Vapor, along with support from the Swift Server Workgroup—provided a solid foundation for the transition.

Implementation Process

Over a span of three years, Cultured Code meticulously rewrote the entire Things Cloud system in Swift. The new backend compiles into a single monolithic binary capable of running multiple services through runtime parameters. Hosted on Amazon Web Services (AWS) and managed via Terraform, the infrastructure utilizes Kubernetes and Docker for deployment orchestration. Key components include MySQL (integrated via MySQLKit), Redis (via RediStack), and Apple Push Notification service integration (via APNSwift).

Performance and Reliability Enhancements

The transition to Swift has yielded significant improvements:

– Cost Efficiency: Compute costs have been reduced by over threefold.

– Enhanced Performance: Response times have been significantly shortened.

– Scalability: A Kubernetes cluster comprising four instances now efficiently handles traffic peaks of up to 500 requests per second.

– Streamlined Operations: The previous C-based notification service has been replaced with a Swift-based solution, simplifying both operations and the codebase.

To ensure system resilience, Cultured Code has implemented daily chaos testing, intentionally disrupting services to verify robust recovery mechanisms. Monitoring is conducted using Amazon CloudWatch and Swift Prometheus, with alerts managed through PagerDuty.

Seamless Transition

The migration to the Swift-based system was executed without any service disruption. The new infrastructure operated in parallel with the legacy system for over a year, processing real-world data to validate its reliability. Once confirmed, the switch was seamlessly implemented, ensuring a smooth experience for users.

Conclusion

This comprehensive overhaul underscores Cultured Code’s commitment to delivering a reliable and innovative task management experience. By unifying both client and server code under Swift, the Things ecosystem is now more cohesive and future-proof, positioning it to meet evolving user needs effectively.