Urgent.News

What's breaking now, across thousands of outlets.

Tech

Database Partitioning & Sharding: How to Distribute Massive Datasets

As an application grows, its database grows with it. A small application might start with a few thousand users and a single database server. But what happens when that application reaches millions of users, processes thousands of requests per second, and stores terabytes or even petabytes of data? At that point, simply buying a more powerful database server is not always enough. This is where…

Database partitioning and sharding are essential techniques for handling large datasets as applications scale. When an application transitions from a few thousand users to millions, a single database server becomes insufficient. Simply upgrading to a more powerful server (vertical scaling) is not always a viable solution.

Database partitioning involves breaking down a large dataset into smaller, more manageable pieces called partitions. This can be done based on various methods such as range partitioning, hash partitioning, or list partitioning. For example, a users table could be partitioned by country, where each partition contains only the data for users from a specific country.

Sharding is a more advanced form of partitioning that distributes data across multiple independent database servers. Each shard stores only a portion of the total dataset. A shard key determines which server stores a particular piece of data. For example, user IDs could be used as the shard key, with user IDs 1-10 million stored on shard 1, 10 million-20 million on shard 2, and so on.

The main difference between partitioning and sharding is that partitioning splits data within a single database server, while sharding distributes those splits across multiple database servers. Sharding provides better performance and manageability, but it is more complex to implement.

Choosing the right shard key is crucial in a sharded architecture. A good shard key should evenly distribute data and traffic, be frequently available in queries, avoid creating hotspots, and support future growth. A well-chosen shard key can help prevent hot spots, where one shard becomes overloaded while others remain mostly idle.

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

I Turned the GetBirthChart Astrology Engine Into a Python Package

A few weeks ago, I open-sourced the Python calculation engine behind GetBirthChart. The source was public, but using it still meant cloning the repository, setting up the environment, and…

  • GetBirthChart engine open-sourced as Python package gbc-astro
  • Package installs via pip install gbc-astro, maintains original calculations
  • Features planetary positions, zodiac placements, houses and more

Nearly 100,000 scam posts removed as Govt steps up online fraud fight

NEARLY 100,000 scam-related posts have been removed from social media platforms in Malaysia this year, as authorities step up efforts to protect the public from increasingly widespread online fraud.

  • Nearly 100,000 scam posts removed from Malaysian social media this year
  • MCMC exceeded 98,503 posts taken down last year
  • 106,268 removal requests submitted to platforms

More from Saturday 22 August →