All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Duolingo's Implementation of Optimistic Locking to Solve Database Contention in Notification System

By

Caleb Noble

5mo ago· 9 min readenInsight

Summary

Duolingo engineers implemented optimistic locking to solve database contention issues in their notification scheduling system. The system, called 'comeback', schedules hundreds of millions of daily notifications by calculating reminder times when users complete lessons. Traditional pessimistic locking was causing performance bottlenecks and high computing costs. By switching to optimistic locking with version numbers, they eliminated contention, improved performance, and reduced infrastructure costs while maintaining data consistency.

Key quotes

· 4 pulled
In order to schedule and send hundreds of millions of notifications each day, we use a system known as comeback.
When a user does things like finishing a lesson, we will calculate when we should send them reminders for the following days and store that schedule of reminders as a row in our database.
Here's how we used *optimism* to fix our notifications service and save computing costs.
The Duolingo app is famous for encouraging users to do their lessons. While Duo the owl's methods vary, the most effective method for reminding users about their learning goals is via notifications.
Snippet from the RSS feed
Here’s how we used *optimism* to fix our notifications service and save computing costs.

You might also wanna read