How Duolingo scaled from a Python backend to 500 services on AWS
Duolingo teaches languages, math and music to a huge audience through native mobile apps and the web. Its backend started in Python and grew into more than 500 services on AWS written in Python, Kotlin and Java, while the apps are native Swift and Kotlin and use AI from OpenAI.
GPT-4 powers Duolingo Max features like Explain My Answer and Roleplay.
How they built it
Python first, Scala where speed mattered
Like most of Duolingo's backend, the Session Generator, the engine that builds each lesson, was first written in Python. In 2017 the team rewrote it in Scala. They pointed to three problems: Python was much slower, it was not thread-safe so in-memory caches were limited, and dynamic typing let many bugs slip into production.
The rewrite cut average latency from 750 ms to 14 ms and took uptime from 99.9% to 100% in the first months.
Duolingo now has more than 500 backend services owned by 30 product teams, all on AWS. Python is still central, and Kotlin became a first-class backend language next to Python and Java, which took little effort because the team could reuse Java code and Android Kotlin tooling.
Most services ran on AWS ECS, and the platform team is moving them to Amazon EKS. They wanted blue-green and canary deploys, a temporary environment for each pull request, IPv6 support and a richer open source toolbox with Argo CD, Karpenter and KEDA. As of 2026 the move was still in progress, and every new service launches on EKS.
Duolingo builds its mobile apps natively, Swift on iOS and Kotlin on Android. The Android app went fully Kotlin by 2020: less verbose code, fewer null pointer crashes and much happier developers. Converting a Java file cut its size by about 30%, and the codebase stayed the same size for two years even as contributors doubled.
For animation the team leans on Rive. When the math course moved from iOS to Android, the Swift visuals did not carry over, so Rive became the cross-platform answer and shifted part of the work from engineers to designers.
In 2024 Duolingo cut its cloud spending by 20%. The team bought reserved capacity based on EC2, RDS and ElastiCache usage, moved one database to Aurora I/O-Optimized and saved several hundred thousand dollars a year, added expiry rules to DynamoDB and S3, and trimmed noisy CloudWatch logs.
In 2025 they tried async Python instead of rewriting a service in Go. The async version handled about 40% more requests per instance, around 30% less EC2 spend per migrated service, at a much lower cost than a rewrite.
In March 2023 Duolingo launched Duolingo Max, a tier above Super built on GPT-4 from OpenAI. Its first features, Explain My Answer and Roleplay, came after months of working closely with OpenAI to tune the technology.