Duolingo provides a free language app that uses crowdsourcing to translate web content as users learn a new language. For example, native English speakers who use the app to learn French also translate French websites to English as they progress through lessons. Duolingo currently offers courses in English, Spanish, French, Italian, German and Portuguese. The application runs on the web, Android and iOS platforms.

Founded in 2011, Duolingo is a spinoff from the Carnegie Mellon University School of Computer Science. The startup, located in Pittsburgh, Pa., is funded by Union Square Ventures, New Enterprise Associates and Kleiner Perkins Caufield & Byers venture capitalists. In 2013, Duolingo won both Apple’s Best App of the Year and Google Play’s Best of the Best awards. Figure 1 demonstrates how the app works.

duolingo-screengrab

Figure 1. Duolingo App Functionality

As a young company, Duolingo wanted to focus on maximizing growth and bringing new features to market as quickly as possible. They originally planned to use a co­location service, but changed their minds before the servers were in place.

“We decided that we didn’t want to manage hardware,” says CTO and co-founder, Severin Hacker. “We wanted to focus on what we are good at — the application and the code.” The founders decided that cloud technology would be a better fit for their company and started to look for a cloud service provider.

After considering several options, Duolingo decided on Amazon Web Services (AWS). “AWS had developer support and good documentation,” says Hacker. “In 2011, AWS was the most widely adopted cloud service and it had the most mature platform. At the time, AWS was one of the few cloud service providers that offered a managed database service.”

Duolingo stores data to create a model for each user’s learning experience. The app uses this model to generate personalized lessons. For example, you might understand the word for sleep in German, but have trouble with grammar tenses. If you don’t use the app for a while, Duolingo will deliver a different lesson to review what you learned previously.

To deliver a personalized learning experience, Duolingo tracks the words and concepts a user has seen. Initially, this data was stored in a MySQL database using an Amazon RDS for MySQL DB instance. Hacker and engineer Brendan Meeder were on their way to the first AWS re:Invent conference in 2012 when they found out that the MySQL database had reached its limit. “We just landed and found out that we had a service issue,” Meeder recounts. “As soon as we got to our hotel, we upgraded to the largest instance available. Then we realized that at the rate we were growing, we would outgrow the instance within a matter of months.”

After learning more about Amazon DynamoDB at the conference, Hacker and Meeder decided DynamoDB was the solution to scaling Duolingo’s vocabulary data. “The service fundamentally changed our situation,” says Hacker. “We can use DynamoDB to increase throughput as needed and don’t have to deal with anything else. We would have crumbled by now without AWS.”

The amount of data that Duolingo can store has increased from 100 million items to over four billion items. The NoSQL database service is Duolingo’s largest and most active data store — items in the data store are updated nearly a thousand times per second and retrieved many thousands of times per second.

“Previously, we had problems with the MySQL table, either because of latency or difficulty changing the schema as new features were added,” says Meeder. “After migrating to DynamoDB in December 2012, we haven’t had a single problem. We’ve been able to scale our storage without increases in latency or needing to distribute data across multiple database instances.”

Duolingo still uses Amazon RDS for MySQL with provisioned IOPS for many of its data needs, but uses DynamoDB exclusively for frequently changing data.

In addition to DynamoDB, Duolingo uses Amazon Virtual Private Cloud (Amazon VPC) to provide a private, secure environment on the AWS Cloud. Elastic Load Balancing distributes web and mobile traffic across approximately 170 Amazon Elastic Compute Cloud (Amazon EC2) instances. Duolingo operates in the US East (Northern Virginia) Region across three Availability Zones.

All traffic from the website and mobile apps goes through Elastic Load Balancing to distribute traffic across Amazon EC2 instances automatically. Private (internal) and public (Internet-facing) load balancers handle hundreds of millions of requests per day. “Our developers especially benefit from the easy administration of Elastic Load Balancing and seamless integration with Auto Scaling groups,” says Hacker.

Duolingo processes many millions of jobs per day and Amazon Simple Queue Service (Amazon SQS) serves as the main way for queuing asynchronous tasks. Amazon Simple Email Service (Amazon SES) delivers announcement emails and daily reminders to keep users engaged in the learning process.

Amazon CloudFront and Amazon Simple Storage Service (Amazon S3) serve over three billion requests per month for user avatars and rendered text-to-speech audio. “Previously this content was being served by Duolingo servers,” says Hacker. “Deferring this functionality to core AWS services allows the development team to not worry about scaling the delivery of these assets.”

Amazon Relational Database Service (Amazon RDS) stores hundreds of gigabytes of data. After switching to provisioned IOPS on the main database, Duolingo engineers immediately observed faster and more consistent application response times.

Duolingo uses specialized Amazon EC2 instances for specific services. For example, servers running speech recognition software use a specific Amazon Machine Image (AMI) build and Auto Scaling groups. For compute-intensive workloads, Duolingo started with the C1 family of instances for its web and API servers, but has recently switched the newer C3 instance. Meeder says that switching to the new instance types allows Duolingo to run fewer instances with a lower cost per instance. “We’ve saved thousands of dollars per month by making this change.” The engineering team uses Amazon EC2 Reserved Instances to reduce costs further for its base traffic load.

The company currently supports about eight million active users worldwide across all platforms. Twenty percent of traffic comes from its website and eighty percent from its mobile apps. Duolingo has been able to scale to manage over one million new users in a single week, as well as expanding the service to offer over 30 new languages. “We can scale instantly using DynamoDB,” says Hacker. “It’s like magic.”

Duolingo’s traffic grew almost tenfold in 2013, and experienced large surges in traffic around iOS and Android features. By using Auto Scaling to scale web and API machines, the company can handle traffic spikes that expand up to seven times the amount of normal traffic. Meeder notes that because of the ability of DynamoDB and Amazon CloudFront to handle surges in traffic, the development team can focus entirely on fixing application bottlenecks during peak loads.

Hacker comments that Duolingo’s time to market is much shorter while saving on operations costs. “We can write the code, launch an instance, and test it. If everything works, we make new instances and made them production-ready. The nice thing is that every developer can do that. We have a 15­-person engineering team and we don’t have any dedicated operations staff. Every developer can launch instances and start services. AWS is the future.”

To learn more about how AWS can help you run your web and mobile application needs, visit our Web, Mobile, and Social details page: http://aws.amazon.com/web-mobile-social/.