# Overview of Counter Batching #flashcard 1. Each Write Service instance requests a batch of counter values from the DB instance (e.g., 1000 values at a time). 2. The DB instance atomically increments the counter by 1000 and returns the start of the batch. 3. The Write Service instance can then use these 1000 values locally without needing to contact DB for each new URL. 4. When the batch is exhausted, the Write Service requests a new batch. This approach reduces the load on DB while still maintaining uniqueness across all instances. It also improves performance by reducing network calls for counter values. <!--ID: 1751507776604--> # Key Considerations # Pros - Reduces the load on DB while still maintaining uniqueness across all instances - Improves performance by reducing network calls for counter values # Cons # Use Cases - Incrementing a counter for a [[Design a URL Shortener]] # Related Topics