todo mundo aceitou. um dev questionou.

todo mundo aceitou. um dev questionou.

Shopify's Shift from Redis to MySQL: A Case Study in Scalability

Introduction to the Topic

  • Shopify transitioned from using Redis to MySQL for handling high transaction volumes, particularly during peak times like Black Friday 2025, where it processed $5.1 million per minute.
  • This change challenges common assumptions about scalability and database architecture in e-commerce systems.

The Problem of Concurrent Transactions

  • A significant issue arises when two users attempt to purchase the last item in stock simultaneously, leading to potential double sales or lost transactions.
  • If the system fails to manage these concurrent requests properly, it can result in customer dissatisfaction and legal disputes.

Understanding Shopify's Architecture

  • Initially, Shopify used Redis as a caching layer while relying on MySQL as the primary data source for inventory management. This setup caused delays and inconsistencies during payment processing due to separate transaction handling between systems.
  • The reliance on two different systems created risks of errors where items could be sold without proper inventory updates or remain blocked incorrectly in the database.

Innovations with MySQL

  • Shopify implemented a feature called "Skip Locked" which allows for better concurrency control by reserving items directly within the same transaction context of their relational database rather than relying on external caches like Redis.
  • Each unit of stock is treated as an individual entry in the database, allowing real-time updates and reducing conflicts during simultaneous purchases. This method enhances efficiency by ensuring that all operations occur within one transactional scope—either everything succeeds or nothing does.

Overcoming Database Challenges

  • During this transition, Shopify faced classic database issues such as poorly designed keys causing deadlocks and default configurations that restricted performance unnecessarily. They addressed these problems through optimization strategies including grouping operations effectively and minimizing unnecessary locks on resources.
  • Ultimately, they discovered that bottlenecks were not solely related to reservations but also involved other parts of their checkout process that needed refinement for improved performance under load conditions like Black Friday sales events.

Conclusion: Lessons Learned from Shopify's Experience

  • The case illustrates how questioning long-standing architectural decisions can lead to significant improvements; what was once deemed necessary (like using Redis) may no longer be optimal as business needs evolve over time.
  • Developers are encouraged to critically assess their technology stacks regularly and consider whether existing solutions still meet current demands efficiently without incurring excessive costs or complexity in maintenance processes.
Video description

Shopify jogou o Redis fora e substituiu pelo MySQL. O mais louco? Escalou. 5.1 milhões de dólares por minuto na Black Friday 2025, tudo rodando num banco relacional com uma feature que existe desde 2018 e quase ninguém usa: o Skip Locked. Nesse vídeo eu analiso o artigo da Shopify sobre como eles redesenharam o sistema de reserva de estoque, os 3 problemas clássicos de banco que quebraram a cara deles, e por que isso é mais uma prova do Grande Rollback. 🔗 Artigo da Shopify: https://shopify.engineering/scaling-inventory-reservations 🔗 Hostinger (cupom MANODEYVIN): https://hostinger.com.br/deyvin 🔗 Prêmio iBest: https://premioibest.vote/483718727 ⭐ Seja membro do canal: https://www.youtube.com/channel/UC1VZDEtGNxfQzh7EYcD2frg/join 📸 Instagram: https://instagram.com/manodeyvin 📌 Canal de cortes: https://www.youtube.com/@cortesdomanoofc ⏱ Capítulos: 0:00 Shopify largou o Redis 1:20 O problema: dois comprando o último tênis 2:17 Como o Redis funcionava na arquitetura antiga 3:30 Hostinger 4:33 Skip Locked: a feature que ninguém usa 5:51 Pool de 1000 linhas por produto 6:35 3 problemas clássicos de banco que travaram tudo 7:02 Otimizaram tudo. Ainda travava. 8:26 O gargalo real não era onde achavam 9:04 Configuração do MySQL que ninguém mexia há anos 9:22 O Grande Rollback chegou no banco 10:19 Redis virou resposta automática 10:35 Um ser humano questionou. Não foi IA. 11:44 O que isso muda pra você 12:31 Skip Locked funciona no PostgreSQL também 12:49 Comenta aí: o que tem na sua stack que ninguém questiona? --------- 📧 Precisa de recomendação de Pentesters / Devs Seniores? Fale comigo: contato@manodeyvin.com.br Edição: editorlivre.com #shopify #redis #mysql #database #programação #tecnologia #desenvolvimento #dev #backend #arquitetura #bancodedados #skiplocked #blackfriday #ecommerce #infraestrutura #granderollback #manodeyvin