تمرین ۱ — طرحِ sharding برای دادهٔ زمانسریExercise 1 — a sharding scheme for time-series data
hotspot و query-aware sharding مهماند؛ hash-range بدون تعیین کلید هش پاسخ یکتایی ندارد.Hash-range needs a specified hash key; monthly totals can hide instantaneous hotspots.
نسخهٔ بازبینیشده برای مصاحبهReviewed interview brief
برای دادهٔ ماهانهٔ سنسورها، timestamp-range، sensor:timestamp range، hash(sensor_id) و hash(full_key) را مقایسه کن. هم بار لحظهای و هم مجموع ماه را بسنج. مسیر query یک سنسور در یک ماه، hotspot سنسور پرنرخ و repartitioning را توضیح بده.Compare timestamp ranges, sensor:timestamp ranges, hash(sensor_id) and hash(full_key). Measure instantaneous and monthly load, query fan-out, hot sensors and repartitioning.
معیار پاسخ خوبWhat a good answer demonstrates
- توزیع ماهانه hotspot لحظهای را پنهان نمیکندInstantaneous hotspot measurement
- hash sensor را با hash full key یکی نمیگیردSpecified hash input
- query fan-out و write skew کمی شدهاندQuery fan-out and skew
پیگیری مصاحبه:Interview follow-up: یک سنسور ۴۰٪ نوشتنها را تولید کند؛ چه تغییری در کلید میدهی؟One sensor generates 40% of all writes. How do you change the partition key?
آزمایشگاه تکمیلی · زمان تقریبی ۲–۴ ساعتExtended hands-on laboratory · estimated 2–4 hours
برای پایگاه دادهِ زمانسریِ سنسورها (کلید = timestamp) طرحِ sharding طراحی کن: سه جایگزین (key-range با کلیدِ timestamp،
key-range با کلیدِ sensor_id:timestamp، و hash-range) را روی یک مجموعهدادهٔ مصنوعیِ یک ماهه پیاده کن.
توزیعِ نوشتن بین shardها را اندازه بگیر، hotspot را با اعداد نشان بده، و trade-offِ «range scan برای یک ماهِ یک سنسور»
را در هر سه طرح بسنج. کدام را برای چه نوع کوئری انتخاب میکنی و چرا؟
Design a sharding scheme for a sensor time-series database (key = timestamp): implement three alternatives (key-range on a timestamp key, key-range on a sensor_id:timestamp key, and hash-range) over one synthetic month of data. Measure write spread across shards, show the hotspot in numbers, and weigh the “one month of one sensor range scan” trade-off in all three schemes. Which do you pick for which query type, and why?
برای یادگیریِ عمیق است؛ انجام کاملش در زمان بحثِ مصاحبه انتظار نمیرود.The full laboratory is optional depth work and is not expected within the discussion time.
ارزیابی، سطح و شواهد این تمرینAssessment, level and evidence · حل آموزشی این تمرینWorked solution · Microsoft · technical interviewing · Amazon · SDE III interview preparation