Chapter 8 · Distributed Databases & CAPChương 8 · Cơ sở dữ liệu phân tán & CAP
You have just taken the operations shift at DVD-Rec, a movie recommendation system built on the dvdrental data. Four short simulations, about 5 minutes each, and each one targets a common misconception about distributed databases.
Bạn vừa nhận ca trực vận hành DVD-Rec, hệ gợi ý phim được xây trên dữ liệu dvdrental. Bốn mô phỏng ngắn, mỗi cái khoảng 5 phút, mỗi cái nhắm vào một hiểu nhầm hay gặp về cơ sở dữ liệu phân tán.
High scores are stored only in your browser and never sent anywhere.Điểm cao nhất chỉ được lưu trong trình duyệt của bạn, không gửi đi đâu.
DVD-Rec has 12 weeks to grow. Traffic rises every week. Each week you choose one action:
Revenue comes from the requests you manage to serve. Murphy's law is waiting: failed disks, security patches, viral movies.
DVD-Rec có 12 tuần để lớn lên. Lượng truy cập tăng mỗi tuần. Mỗi tuần bạn chọn một việc:
Doanh thu đến từ số request phục vụ được. Định luật Murphy đang chờ: ổ hỏng, vá bảo mật, phim viral.
Serve as many users as possible, don't go broke, and keep downtime as low as you can.Phục vụ nhiều người dùng nhất, không phá sản, càng ít downtime càng tốt.
You are DVD-Rec's query router: 1 primary and 1 asynchronous replica. Requests arrive in a queue, and you send the one at the head of the queue to the Primary or the Replica.
You can switch to sync mode. Watch what happens when the replica goes down.
Bạn là bộ định tuyến truy vấn của DVD-Rec: 1 primary và 1 replica bất đồng bộ. Request chạy vào hàng đợi, bạn gửi request đầu hàng tới Primary hoặc Replica.
Bạn có thể chuyển sang chế độ sync. Hãy để ý chuyện gì xảy ra khi replica sập.
P orhoặc ← sends to Primarygửi tới Primary · R orhoặc → sends to Replicagửi tới Replica
75 seconds. If a request waits more than 6 seconds, the customer leaves the app.75 giây. Request chờ quá 6 giây thì khách thoát app.
The table holds 1,600 sample rows that follow dvdrental's real monthly distribution. DVD-Rec's main queries: 70% are “one customer's data”, 20% are “recent rentals”.
Bảng đang có 1.600 dòng mẫu, lấy theo đúng phân bố tháng của dvdrental. Truy vấn chủ yếu của DVD-Rec: 70% là “dữ liệu của một khách”, 20% là “lượt thuê gần đây”.