Reduce delay in software systems
Pekka Enberg

#Latency
#Software_systems
⚡️ تکنیکهای عملی برای ساخت نرمافزار با تأخیر پایین
کتاب Latency از اصول پایه تا کد آمادهی تولید رو پوشش میده، و بهت یاد میده چطور نرمافزارت رو در هر لایهی استک سریعتر کنی — از پردازنده تا دیتابیس، از شبکه تا سیستمعامل.
🧠 اول یاد میگیری واقعاً تاخیر یا latency چیه، چه فرقی با پهنای باند (bandwidth) داره، و چرا حیاتیترین پارامتر برای تجربهی کاربره. بعد هم با مثالهای عملی، قانون Little و قانون Amdahl رو بررسی میکنی، میفهمی چطور داده رو مدلسازی و تأخیرها رو اندازهگیری و مصورسازی کنی؛ و در نهایت، معماری الگوریتمها، کشها و عملیاتهای بدون قفل (lock-free) رو یاد میگیری تا به حداقل تاخیر برسی.
🧩 خلاصهی مفهوم کتاب:
Latency یعنی فاصلهی زمانی بین علت و معلول. در عمل، تأخیر زیاد میتونه باعث خراب شدن کل سیستم بشه — از محاسبات اشتباه و تایماوت گرفته تا تجربهی کاربریای که باعث میشه کاربر صفحه رو ببنده و نرمافزار رو ترک کنه .
حل مشکلات latency کار سادهای نیست؛ هم پیدا کردنش سخته هم رفع کردنش. اما نویسنده اینجا با یه ترکیب متعادل بین نظریه و پیادهسازی واقعی نشونت میده چطور پژوهش علمی رو تبدیل به تکنیکهای قابل استفاده در پروژههات کنی.
از میکروثانیههای ازدسترفته موقع مسیریابی پیامهای سرور گرفته تا صفحههایی که بارگذاری طولانی دارن — تأخیر میتونه یه نرمافزار عالی رو نابود کنه. این کتاب به سبک “اشکالیابی عمیق”، راههایی رو آموزش میده که باهاش میتونی تاخیر ناخواسته رو شناسایی، درک و رفع کنی؛ هم در اپلیکیشنها، هم در زیرساختها.
کتاب Latency: Reduce Delay in Software Systems بهت یاد میده چطور تأخیر موجود در برنامههات رو عیبیابی کنی یا از صفر یه سیستم با تأخیر پایین بسازی.
در طول مسیر، تکنیکهای سنگین اما کاربردی در مدیریت حافظه، همروندی (concurrency)، و اجرای پیشبینیکننده (predictive execution) یاد میگیری. نکتهها، پروژههای عملی، و بینشهای شخصی نویسنده باعث میشن کتاب هم کاربردی باشه، هم جذاب برای مطالعهی فنی شبانه .
• مدلسازی و اندازهگیری تأخیر
• سازماندهی دادهها برای تأخیر پایین
• تسریع اجرای کد
• پنهانسازی تأخیر از نگاه کاربر
مناسب برای مهندسان نرمافزار با درک عمومی از بکاند و معماری سیستم؛
مثالها با زبان Rust نوشته شدن، جایی که سرعت و کنترل مستقیم روی حافظه حرف اول رو میزنن 🚀
بخش ۱ – اصول پایه:
بخش ۲ – داده:
بخش ۳ – محاسبات:
بخش ۴ – پنهانسازی تأخیر:
ضمیمه A: منابع بیشتر برای مطالعه
پکا انبرگ (Pekka Enberg) یه متخصص نرمافزار با سابقهی سنگین در سیستمعاملها، دیتابیسها و سیستمهای توزیعشدهست؛ تمرکز پژوهشیش روی شبکههای با تأخیر پایینه.
قبلاً روی هستهی لینوکس (Linux Kernel) بهعنوان نگهدارندهی زیرسیستم تخصیص حافظه دینامیک فعالیت داشته و روی ScyllaDB کار کرده — دیتابیسی سازگار با Apache Cassandra، با تمرکز بر تأخیر پایین و گذردهی بالا.
Practical techniques for delivering low latency software.
From first principles to production-ready code, Latency teaches you how to make your software faster at every layer of the stack. You’ll learn what latency really is, how it differs from bandwidth, and why it matters for user experience. Then, guided by practical examples, you’ll apply Little’s Law, design lock-free algorithms, and architect caching systems that scale. You’ll discover how your code runs differently on distributed systems, databases, and operating systems, and understand the common latency-causing issues in each situation.
In Latency you’ll learn how to:
• Define latency, distinguish it from bandwidth, and understand its impact on user experience
• Model performance with Little’s Law and Amdahl’s Law, then measure and visualize delays
• Optimize data access with colocation, replication, partitioning, and caching
• Accelerate logic with algorithmic improvements, memory tuning, and lock-free concurrency
• Minimize delays with asynchronous processing, predictive techniques, and speculative execution
Put simply, latency is the delay between a cause and effect. In practice, too much latency can create problems throughout a software system, ranging from inaccurate calculations and timeouts to impatient users simply abandoning your applications. Latency issues can be challenging to avoid and troubleshoot. This book balances theory with practical implementations, turning academic research into useful techniques you can apply to your projects.
About the technology
From lost microseconds routing server messages to page loads that keep users waiting, latency can kill good software. This one-of-a-kind book shows you how to spot, understand, and fix unwanted latency in your applications and infrastructure.
About the book
Latency: Reduce delay in software systems shows you how to troubleshoot latency in existing applications and create low latency systems from the ground up. In it, you’ll discover high-impact fixes for measuring latency and advanced optimizations in memory management, concurrency models, and predictive execution. The tips and tricks, hands-on projects, and personal insights make this book as enjoyable as it is practical.
What's inside
• How to model and measure latency
• Organizing application data for low latency
• Accelerating your code
• Hiding latency
About the reader
For software engineers with a working knowledge of backends. Examples in Rust.
Table of Contents
Part 1 Basics
1 Introduction
2 Modeling and measuring latency
Part 2 Data
3 Colocation
4 Replication
5 Partitioning
6 Caching
Part 3 Compute
7 Eliminating work
8 Wait-free synchronization
9 Exploiting concurrency
Part 4 Hiding latency
10 Asynchronous processing
11 Predictive techniques
About the Author
Pekka Enberg is a software professional with a background and experience in operating systems, databases, and distributed systems and a research interest in low-latency networked systems. In the past, Pekka has worked on the Linux kernel as a maintainer of the dynamic memory allocator subsystem and on ScyllaDB, an Apache Cassandra-compatible, distributed database focusing on low-latency and high throughput.









