Urgent.News

What's breaking now, across thousands of outlets.

Tech

Black Friday Sale: System Design

Imagine, there are 4 database sharding strategies with 4 completely different outcomes. Pick the wrong one and your primary database melts on Black Friday. Your Postgres orders table just hit 500 million rows. Queries that used to take 40ms are now crawling at 800ms. Vertical scaling is dead. You have to shard. But before you pick a strategy, look at your actual workload. 80% of reads are…

In the Black Friday sale scenario, proper database sharding is critical to ensure fast user access to order history while handling the high volume of writes and reads. Out of the four sharding strategies presented - hash sharding on order ID, range sharding on creation date, directory-based lookup, and consistent hashing with virtual nodes - the optimal choice for this e-commerce pattern is directory-based sharding.

Hash sharding distributes data evenly across all shards, eliminating hotspots. However, it fails in the customer-centric scenario where a user needs to view their last 30 days of orders. Queries would need to scatter-gather data from all shards, leading to slow user-facing performance.

Range sharding by creation date is great for analytics focused on specific date ranges, but fails during peak sale days. All new orders will funnel into a single shard, causing it to become overloaded and potentially crash.

Consistent hashing with virtual nodes is elegant for adding and removing servers, but still suffers from the same scatter-gather issue as hash sharding during customer order lookups.

In contrast, directory-based sharding acts like a customer lookup directory. When a user requests their orders, the directory maps them to a specific shard instantly, allowing for sub-millisecond response times. The only potential bottleneck is the directory itself, which can be mitigated with caching in Redis. This approach enables high availability and low latency for the 80% of read queries focused on customer order history, while still handling the 5% write traffic.

The key lesson is to choose a sharding strategy based on actual workload patterns, not just its theoretical appeal or perceived sophistication.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

How to Clean Up Ollama and LM Studio Models Taking Up Space on Windows in 2026

Your C: drive is red in File Explorer, and a good part of it is AI models you pulled into LM Studio and Ollama months ago.

  • Off Grid AI Desktop identifies and displays each model's size
  • LM Studio models in %USERPROFILE%\.lmstudio\models, Ollama in %USERPROFILE%\.ollama\models
  • Off Grid AI Desktop offers recycle bin and PowerShell/Command Prompt removal method

Agents follow the runbook — including the step the attacker added

Agents follow the runbook — including the step the attacker added Give an agent a runbook and it will follow it. That is the point of a runbook.

  • Runbooks contain legitimate steps and a malicious step
  • TaintWall firewall blocks all 16 malicious cases
  • Firewall incurs 6-point utility cost

Fitting Three Objects in One Case: Modeling Multi-Item Packaging

The first article in this series modeled a product as a data model. The second one dealt with a curved object that broke the rectangular assumption.

  • Multi-item packaging case now uses layout with individual cavities for each object.
  • Cavity data structure includes id, inner dimensions, clearance, position, and orientation.

More from Thursday 29 October →