A Deep Dive into How Distributed Data Systems Work
Alex Petrov

#Data
#Database
#software_developers
#software_engineers
#software_architects
#Distributed_systems
📘 وقتی بحث انتخاب، استفاده و نگهداری از یک دیتابیس میشه، درک اینترنالهای اون کاملاً ضروریه
اما با این حجم از دیتابیسهای توزیعشده و ابزارهایی که امروز وجود دارن، واقعاً سخته بفهمی هرکدوم دقیقاً چه چیزی ارائه میدن و تفاوت اصلیشون کجاست. توی این راهنمای کاملاً عملی، الکس پتروف توسعهدهندهها رو با مفاهیم پشت پردهی دیتابیسهای مدرن و اینترنالهای Storage Engine آشنا میکنه.
🧠 در طول کتاب، با مجموعهای از مفاهیم مهم روبهرو میشی که از کتابها، Paperها، پستهای فنی وبلاگها و حتی سورسکد چندین دیتابیس Open Source استخراج شدن. این منابع در انتهای بخش اول و دوم کتاب لیست شدن.
نکتهی جالب اینجاست که مهمترین تفاوت بین خیلی از دیتابیسهای مدرن، دقیقاً داخل Subsystemهایی قرار داره که مشخص میکنن Storage چطور سازماندهی بشه و Data چطور توزیع بشه.
🔥 این کتاب موضوعات زیر رو بررسی میکنه:
🔹 Storage Engineها
طبقهبندی و Taxonomy مربوط به Storage رو بررسی میکنی و بعد وارد دنیای Storage Engineهای مبتنی بر B-Tree و Immutable Log Structured میشی؛ همراه با تفاوتها و Use Caseهای هرکدوم.
🔹 Building Blockهای Storage
یاد میگیری فایلهای دیتابیس چطور سازماندهی میشن تا Storage بهینه ساخته بشه؛ با استفاده از ساختارهای کمکی مثل:
Page Cache، Buffer Pool و Write-Ahead Log.
🔹 سیستمهای توزیعشده (Distributed Systems)
مرحلهبهمرحله میبینی Nodeها و Processها چطور به هم متصل میشن و Patternهای ارتباطی پیچیده رو شکل میدن.
🔹 کلاسترهای دیتابیس
مدلهای Consistency که دیتابیسهای مدرن استفاده میکنن رو بررسی میکنی و میفهمی سیستمهای Storage توزیعشده چطور Consistency رو حفظ میکنن.
📚 فهرست مطالب
بخش اول: موتورهای ذخیرهسازی
1. مقدمه و نمای کلی
2. مبانی B-Tree
3. فرمت فایلها
4. پیادهسازی B-Tree
5. پردازش تراکنش و بازیابی
6. واریانتهای B-Tree
7. ذخیرهسازی Log-Structured
نتیجهگیری بخش اول
بخش دوم: سیستمهای توزیعشده
8. مقدمه و نمای کلی
9. تشخیص Failure
10. انتخاب Leader
11. Replication و Consistency
12. Anti-Entropy و Dissemination
13. تراکنشهای توزیعشده
14. Consensus
نتیجهگیری بخش دوم
🎯 این کتاب برای چه کسانیه؟
💬 توی کنفرانسهای فنی، همیشه یه سؤال تکراری میشنوم:
«چطور میتونم بیشتر دربارهی اینترنالهای دیتابیس یاد بگیرم؟ اصلاً از کجا باید شروع کنم؟»
بیشتر کتابهای مربوط به Database Systemها وارد جزئیات پیادهسازی Storage Engine نمیشن و معمولاً مفاهیمی مثل B-Tree رو خیلی سطحی توضیح میدن. از طرفی، تعداد کمی کتاب وجود داره که مفاهیم جدیدتری مثل Variantهای مختلف B-Tree یا Storageهای Log-Structured رو پوشش بدن؛ برای همین معمولاً پیشنهاد میشه Paper بخونی.
📄 اما هرکسی که Paper خونده باشه میدونه داستان به این سادگی نیست:
این کتاب خلاصههای فشرده و دقیقی از مفاهیم مهم Database Systemها ارائه میده و میتونه:
👨💻 همه قرار نیست Database Developer بشن، اما این کتاب برای هرکسی که با Database Systemها کار میکنه ارزش داره:
⚙️ اگر شرکتت به هر نوع Infrastructure Component وابستهست — چه دیتابیس باشه، چه Message Queue، چه Container Platform یا Task Scheduler — باید Change-logها و Mailing Listهای پروژهها رو دنبال کنی تا همیشه در جریان تغییرات جدید باشی.
🔍 وقتی Terminologyها و اینترنال سیستمها رو بشناسی، میتونی:
اگر یه روز مشکلی پیش بیاد، داشتن درک کلی از نحوهی کار Database Systemها کمک میکنه:
🚀 این کتاب برای ذهنهای کنجکاو هم فوقالعادهست؛ آدمهایی که صرفاً برای لذت یادگیری سراغ تکنولوژی میرن:
🧩 فرض کتاب اینه که خواننده تا حدی تجربهی توسعهی Backend Systemها و کار با Database Systemها رو داشته باشه. داشتن دانش قبلی دربارهی Data Structureها هم کمک میکنه مطالب سریعتر جا بیفته.
👤 درباره نویسنده
الکس پتروف یک مهندس زیرساخت داده، علاقهمند به Database و Storage Systemها، عضو PMC و Committer پروژهی Apache Cassandra هست و تمرکز اصلیش روی Storage، سیستمهای توزیعشده و الگوریتمهاست.
When it comes to choosing, using, and maintaining a database, understanding its internals is essential. But with so many distributed databases and tools available today, it’s often difficult to understand what each one offers and how they differ. With this practical guide, Alex Petrov guides developers through the concepts behind modern database and storage engine internals.
Throughout the book, you’ll explore relevant material gleaned from numerous books, papers, blog posts, and the source code of several open source databases. These resources are listed at the end of parts one and two. You’ll discover that the most significant distinctions among many modern databases reside in subsystems that determine how storage is organized and how data is distributed.
This book examines:
• Storage engines: Explore storage classification and taxonomy, and dive into B-Tree-based and immutable Log Structured storage engines, with differences and use-cases for each
• Storage building blocks: Learn how database files are organized to build efficient storage, using auxiliary data structures such as Page Cache, Buffer Pool and Write-Ahead Log
• Distributed systems: Learn step-by-step how nodes and processes connect and build complex communication patterns
• Database clusters: Which consistency models are commonly used by modern databases and how distributed storage systems achieve consistency
Table of Contents
Part I. Storage Engines
1. Introduction and Overview
2. B-Tree Basics
3. File Formats
4. Implementing B-Trees
5. Transaction Processing and Recovery
6. B-Tree Variants
7. Log-Structured Storage
Part I Conclusion
Part II. Distributed Systems
8. Introduction and Overview
9. Failure Detection
10. Leader Election
11. Replication and Consistency
12. Anti-Entropy and Dissemination
13. Distributed Transactions
14. Consensus
Part II Conclusion
Who is this book for?
In conversations at technical conferences, I often hear the same question: “How can I learn more about database internals? I don’t even know where to start.” Most of the books on database systems do not go into details of storage engine implementation, and cover the access methods, such as B-Trees, on a rather high level. There are very few books that cover more recent concepts, such as different B-Tree variants and log-structured storage, so I usually recommend reading papers.
Everyone who reads papers knows that it’s not that easy: you often lack context, the wording might be ambiguous, there’s little or no connection between papers, and they’re hard to find. This book contains concise summaries of important database systems concepts and can serve as a guide for those who’d like to dig in deeper, or as a cheat sheet for those already familiar with these concepts.
Not everyone wants to become a database developer, but this book will help people who build software that uses database systems: software developers, reliability engineers, architects, and engineering managers.
If your company depends on any infrastructure component, be it a database, a messaging queue, a container platform, or a task scheduler, you have to read the project change-logs and mailing lists to stay in touch with the community and be up-to-date with the most recent happenings in the project.
Understanding terminology and knowing what’s inside will enable you to yield more information from these sources and use your tools more productively to troubleshoot, identify, and avoid potential risks and bottlenecks. Having an overview and a general understanding of how database systems work will help in case something goes wrong. Using this knowledge, you’ll be able to form a hypothesis, validate it, find the root cause, and present it to other project maintainers.
This book is also for curious minds: for the people who like learning things without immediate necessity, those who spend their free time hacking on something fun, creating compilers, writing homegrown operating systems, text editors, computer games, learning programming languages, and absorbing new information.
The reader is assumed to have some experience with developing backend systems and working with database systems as a user. Having some prior knowledge of different data structures will help to digest material faster.
About the Author
Alex is a data infrastructure engineer, database and storage systems enthusiast, Apache Cassandra committer and PMC member, interested in storage, distributed systems and algorithms.









