▲ 38 r/microservices+1 crossposts

How to scale a Real-Time Driver Tracking System (UberEats/DoorDash scale)

How do delivery apps sync a driver's GPS coordinates in real time with a customer's map without melting the database? Writing every 2-second location ping to disk is an infrastructure nightmare. Here is the high-performance setup:

  • The Ingestion Shock Absorber: Drivers stream GPS packets via WebSockets to an API Gateway, which routes them directly to Apache Kafka to handle massive write spikes.
  • In-Memory Live State: A consumer pulls from Kafka and updates an active Redis Cluster using geospatial commands (GEOADD). The live location of the driver lives strictly in-memory during the delivery.
  • Targeted Fan-Out: The customer's app listens to a WebSocket connection. The backend uses Redis Pub/Sub rooms keyed by Order_ID to broadcast the location updates only to the specific customer and restaurant involved, avoiding global broadcast overhead.
  • Async Cold Storage: Once the delivery completes, the full GPS history is batched out of Kafka and archived in ClickHouse or an S3 data lake for mileage payouts and support audits.

Let's discuss: How would you handle calculating and updating the traffic-aware ETA on the fly without making expensive third-party Maps API calls every 2 seconds?

reddit.com
u/Silent-Weather76005 — 7 days ago

Does anyone else feel like trying to learn everything at once actually slows them down?

Recently, I came across a post that perfectly described many engineering students: DSA, development, aptitude, AI, cloud, resumes, LinkedIn... all running in parallel.

It reminded me of another study plan I had seen:

  • Morning for DSA.
  • Evening for development.
  • Night for aptitude or AI.

On paper, it sounds like the ideal routine. You're checking every important box.

But I've noticed something over time. The more I tried to optimize every hour by fitting multiple subjects into a single day, the less meaningful progress I made in any of them.

Instead of getting really good at one thing, I ended up making shallow progress in several.

Lately, I've been experimenting with a different approach: focusing on one learning milestone at a time and, for example, finishing a DSA topic before shifting my attention to a project, or completing a feature before starting another course.

I'm not saying everyone should only learn one thing. Different people have different schedules and goals. But for me, reducing constant context switching has made learning feel much more manageable.

I'm curious how others handle this.

Do you divide your day between multiple skills, or do you prefer focusing on one area until you reach a clear milestone?

reddit.com
u/Silent-Weather76005 — 14 days ago
▲ 3 r/lifelonglearning+1 crossposts

Does anyone else feel like trying to learn everything at once actually slows them down?

Recently, I came across a post that perfectly described many engineering students: DSA, development, aptitude, AI, cloud, resumes, LinkedIn... all running in parallel.

It reminded me of another study plan I had seen:

  • Morning for DSA.
  • Evening for development.
  • Night for aptitude or AI.

On paper, it sounds like the ideal routine. You're checking every important box.

But I've noticed something over time. The more I tried to optimize every hour by fitting multiple subjects into a single day, the less meaningful progress I made in any of them.

Instead of getting really good at one thing, I ended up making shallow progress in several.

Lately, I've been experimenting with a different approach: focusing on one learning milestone at a time and, for example, finishing a DSA topic before shifting my attention to a project, or completing a feature before starting another course.

I'm not saying everyone should only learn one thing. Different people have different schedules and goals. But for me, reducing constant context switching has made learning feel much more manageable.

I'm curious how others handle this.

Do you divide your day between multiple skills, or do you prefer focusing on one area until you reach a clear milestone?

reddit.com
u/Silent-Weather76005 — 14 days ago

How to architect a real-time collaborative text editor (Google Docs scale)

Hey everyone,

How do systems like Google Docs or Notion handle concurrent edits from thousands of users on a single document without scrambling the text or locking the database?

Traditional DB locks don't work here. Here is the high-performance architecture:

  • Conflict Resolution (CRDTs): Use Conflict-free Replicated Data Types (like Yjs). CRDTs treat text as an array of characters with unique, immutable IDs. It allows edits to merge mathematically in any order without needing a central lock.
  • Transport (WebSockets): Editors maintain an open WebSocket connection to stream individual character mutation operations (insert/delete) instead of heavy text payloads.
  • Pub/Sub Layer (Redis): Use Redis Pub/Sub to create memory-optimized chat rooms per Document ID, instantly broadcasting operations to all active users in under 10ms.
  • Persistence: Save operations to an append-only log in Cassandra and take periodic document snapshots to keep initial loading times ultra-fast.

Let's discuss:

  • Would you pick CRDTs (decentralized, heavier memory) or Operational Transformation (OT) (centralized server math) for a massive enterprise project?
  • How would you handle a user who goes offline for an hour, makes heavy edits, and reconnects?
reddit.com
u/Silent-Weather76005 — 16 days ago

How to architect a real-time collaborative text editor (Google Docs scale)

Hey everyone,

How do systems like Google Docs or Notion handle concurrent edits from thousands of users on a single document without scrambling the text or locking the database?

Traditional DB locks don't work here. Here is the high-performance architecture:

  • Conflict Resolution (CRDTs): Use Conflict-free Replicated Data Types (like Yjs). CRDTs treat text as an array of characters with unique, immutable IDs. It allows edits to merge mathematically in any order without needing a central lock.
  • Transport (WebSockets): Editors maintain an open WebSocket connection to stream individual character mutation operations (insert/delete) instead of heavy text payloads.
  • Pub/Sub Layer (Redis): Use Redis Pub/Sub to create memory-optimized chat rooms per Document ID, instantly broadcasting operations to all active users in under 10ms.
  • Persistence: Save operations to an append-only log in Cassandra and take periodic document snapshots to keep initial loading times ultra-fast.

Let's discuss:

  • Would you pick CRDTs (decentralized, heavier memory) or Operational Transformation (OT) (centralized server math) for a massive enterprise project?
  • How would you handle a user who goes offline for an hour, makes heavy edits, and reconnects?
reddit.com
u/Silent-Weather76005 — 16 days ago
▲ 1 r/microservices+1 crossposts

Building a Scalable, Sub-Second Alert & Notification Engine

How do platform tools like PagerDuty or Opsgenie process 50,000 incoming telemetry events per second and route critical pages (SMS, Push, Webhooks) to the right engineer in under 1 second?

When an entire data centre cluster drops, a massive flood of identical alerts hits the system simultaneously. If you try to fire API calls to downstream networks like Twilio all at once, you will get rate-limited, blacklisted, or crash the pipeline.

Here is how to design a high-availability, fault-tolerant notification stack:

The Technical Challenges

Sub-Second Delivery: Critical alerts must reach the device in < 1 second.• Alert Fatigue & Floods: Suppressing thousands of duplicate logs into one incident.

At-Least-Once Delivery: An incident page can never be silently dropped or lost.

The Architectural Solution

  1. Ingestion Layer: Enforce an API Gateway that assigns idempotency keys and offloads payloads instantly into Apache Kafka to absorb traffic spikes safely.
  2. In-Memory Sliding-Window Deduplication: Calculate a unique signature token for each alert (e.g., hash(cluster_id + metric)). Run an atomic check against a Redis Cache Cluster using a sliding window. If it triggered recently, increment the counter and drop the duplicate from the outbound queue.
  3. Escalation Scheduling: Use Redis Keyspace Notifications or a hashed wheel timer. When an alert is dispatched, create a 5-minute expiry key. If no acknowledgment (ACK) clears the key, a worker triggers the next tier on the on-call ladder.
  4. Leaky Bucket Downstream Queues: Isolate outbound traffic into independent per-channel worker threads (SMS, Email, Push) to match target provider API rate limits.

When scaling real-time notification architectures, the hardest part isn't the delivery—it is the smart deduplication and rate-limiting throttling at the edge.

How does your team handle alert storms and on-call routing policies? Let's discuss below!

reddit.com
u/Silent-Weather76005 — 19 days ago

Architecting a Fraud Detection Engine that handles 100k TPS with a strict &lt; 50ms P99 Latency Bound

Hey everyone,

How do credit card networks evaluate risk, pull user history, and return an APPROVE/DENY decision before a payment terminal times out?

Querying a traditional database on the fly to check historical spending habits will instantly kill your latency budget. Here is how to architect a real-time solution:

  1. Dual-Path Architecture

Separate your system into an Online Path (Hot) for instant decisions and an Offline Path (Cold) for data analytics.

  1. In-Memory Feature Store

Never calculate aggregates (like 30-day spending limits or hourly velocity) during a transaction.

The Cold Path: Apache Flink continuously processes a Kafka stream of completed transactions in the background.

The Hot Path: Flink stores these pre-computed metrics in Aerospike or Redis Enterprise. When a transaction arrives, the engine performs a single key-value fetch in < 2ms.

  1. Hybrid Decision Engine

The enriched payload runs through a fast, sequential evaluation tree:

Deterministic Rules: Quick checks for hard blocks (e.g., blacklisted countries).

ML Inference: A lightweight gradient-boosted tree model (like XGBoost) compiled via ONNX runtime for sub-millisecond risk scoring.

  1. Resiliency: Failing Open

If the fraud engine suffers a network partition or times out past 15ms, the system drops into a Fail-Open policy. It automatically approves the transaction to protect user experience and flags the event for asynchronous review.

Let's discuss:

How do you deploy new dynamic rules written by risk teams without re-deploying core backend code?

What is your strategy for handling race conditions if a user swipes their card twice in two different cities within seconds?

reddit.com
u/Silent-Weather76005 — 21 days ago

Architecting a Fraud Detection Engine that handles 100k TPS with a strict &lt; 50ms P99 Latency Bound

Hey everyone,

How do credit card networks evaluate risk, pull user history, and return an APPROVE/DENY decision before a payment terminal times out?

Querying a traditional database on the fly to check historical spending habits will instantly kill your latency budget. Here is how to architect a real-time solution:

  1. Dual-Path Architecture

Separate your system into an Online Path (Hot) for instant decisions and an Offline Path (Cold) for data analytics.

  1. In-Memory Feature Store

Never calculate aggregates (like 30-day spending limits or hourly velocity) during a transaction.

The Cold Path: Apache Flink continuously processes a Kafka stream of completed transactions in the background.

The Hot Path: Flink stores these pre-computed metrics in Aerospike or Redis Enterprise. When a transaction arrives, the engine performs a single key-value fetch in < 2ms.

  1. Hybrid Decision Engine

The enriched payload runs through a fast, sequential evaluation tree:

Deterministic Rules: Quick checks for hard blocks (e.g., blacklisted countries).

ML Inference: A lightweight gradient-boosted tree model (like XGBoost) compiled via ONNX runtime for sub-millisecond risk scoring.

  1. Resiliency: Failing Open

If the fraud engine suffers a network partition or times out past 15ms, the system drops into a Fail-Open policy. It automatically approves the transaction to protect user experience and flags the event for asynchronous review.

Let's discuss:

How do you deploy new dynamic rules written by risk teams without re-deploying core backend code?

What is your strategy for handling race conditions if a user swipes their card twice in two different cities within seconds?

reddit.com
u/Silent-Weather76005 — 21 days ago

Architecting a Fraud Detection Engine that handles 100k TPS with a strict &lt; 50ms P99 Latency Bound

Hey everyone,

How do credit card networks evaluate risk, pull user history, and return an APPROVE/DENY decision before a payment terminal times out?

Querying a traditional database on the fly to check historical spending habits will instantly kill your latency budget. Here is how to architect a real-time solution:

  1. Dual-Path Architecture

Separate your system into an Online Path (Hot) for instant decisions and an Offline Path (Cold) for data analytics.

  1. In-Memory Feature Store

Never calculate aggregates (like 30-day spending limits or hourly velocity) during a transaction.

The Cold Path: Apache Flink continuously processes a Kafka stream of completed transactions in the background.

The Hot Path: Flink stores these pre-computed metrics in Aerospike or Redis Enterprise. When a transaction arrives, the engine performs a single key-value fetch in < 2ms.

  1. Hybrid Decision Engine

The enriched payload runs through a fast, sequential evaluation tree:

Deterministic Rules: Quick checks for hard blocks (e.g., blacklisted countries).

ML Inference: A lightweight gradient-boosted tree model (like XGBoost) compiled via ONNX runtime for sub-millisecond risk scoring.

  1. Resiliency: Failing Open

If the fraud engine suffers a network partition or times out past 15ms, the system drops into a Fail-Open policy. It automatically approves the transaction to protect user experience and flags the event for asynchronous review.

Let's discuss:

How do you deploy new dynamic rules written by risk teams without re-deploying core backend code?

What is your strategy for handling race conditions if a user swipes their card twice in two different cities within seconds?

reddit.com
u/Silent-Weather76005 — 21 days ago
▲ 7 r/softwarearchitecture+1 crossposts

Architecting a Dynamic Batching API for Low-Latency, High-Throughput ML Inference

Hey everyone,

I wanted to break down how to design an API gateway and worker architecture optimized for hosting large-scale ML models (like an LLM inference endpoint) while managing expensive GPU infrastructure efficiently.

The Problem: Single-Request GPU Waste

GPUs are monsters at parallel matrix multiplication, but running inference on a single user prompt at a time leaves massive hardware capacity sitting idle. Conversely, if your system waits around too long to form a large batch of users, you destroy your P99 latency and break the real-time user experience.

The High-Level Architecture

  1. Client -> API Gateway: Handles auth, rate limiting, and maintains an open HTTP/2 connection.
  2. Gateway -> Local Queue: Prompts are serialized and pushed into an in-memory ring buffer.
  3. Queue -> Dynamic Batcher: An orchestrator (like NVIDIA Triton) groups discrete inputs into a single model execution tensor.
  4. GPU -> Client: Matrix outputs are de-multiplexed and streamed back to individual users via Server-Sent Events (SSE).

Token Streaming & De-muxing

Because LLMs generate tokens sequentially, the inference engine doesn't wait for the entire text to finish. The system slices the chunk arrays at each generation step and streams individual tokens back to respective client sockets in real-time, keeping Time-To-First-Token (TTFT) minimal.

Handling Scale & Multitenancy

  • Priority Queues: Route interactive chat UI traffic to high-priority queues, while background batch processing jobs get processed on lower-priority threads.
  • KV Caching: Store previous prompt context fragments in a shared KV cache layer to avoid re-computing system prompts for recurring users.

Let's discuss:

  1. How do you handle batching when users pass vastly different input token lengths? (Padding vs. Continuous Batching/vLLM)
reddit.com
u/Silent-Weather76005 — 26 days ago
▲ 13 r/mlops

Architecting a Dynamic Batching API for Low-Latency, High-Throughput ML Inference

Hey everyone,

I wanted to break down how to design an API gateway and worker architecture optimized for hosting large-scale ML models (like an LLM inference endpoint) while managing expensive GPU infrastructure efficiently.

The Problem: Single-Request GPU Waste

GPUs are monsters at parallel matrix multiplication, but running inference on a single user prompt at a time leaves massive hardware capacity sitting idle. Conversely, if your system waits around too long to form a large batch of users, you destroy your P99 latency and break the real-time user experience.

The High-Level Architecture

  1. Client -> API Gateway: Handles auth, rate limiting, and maintains an open HTTP/2 connection.
  2. Gateway -> Local Queue: Prompts are serialized and pushed into an in-memory ring buffer.
  3. Queue -> Dynamic Batcher: An orchestrator (like NVIDIA Triton) groups discrete inputs into a single model execution tensor.
  4. GPU -> Client: Matrix outputs are de-multiplexed and streamed back to individual users via Server-Sent Events (SSE).

Token Streaming & De-muxing

Because LLMs generate tokens sequentially, the inference engine doesn't wait for the entire text to finish. The system slices the chunk arrays at each generation step and streams individual tokens back to respective client sockets in real-time, keeping Time-To-First-Token (TTFT) minimal.

Handling Scale & Multitenancy

  • Priority Queues: Route interactive chat UI traffic to high-priority queues, while background batch processing jobs get processed on lower-priority threads.
  • KV Caching: Store previous prompt context fragments in a shared KV cache layer to avoid re-computing system prompts for recurring users.

Let's discuss:

  1. How do you handle batching when users pass vastly different input token lengths? (Padding vs. Continuous Batching/vLLM)
reddit.com
u/Silent-Weather76005 — 26 days ago
▲ 7 r/microservices+1 crossposts

System Design: Scaling a Real-Time AI Ride-Matching Service

How do apps like Uber or Lyft match you with a driver in under 2 seconds while handling millions of concurrent location updates?

Traditional relational databases will lock up and crash under this scale. Here is how to architect a fault-tolerant solution:

The Core Challenges• Write-Heavy: Drivers stream GPS coordinates every 4 seconds.• Ultra-Low Latency: Matching must happen in < 2 seconds.• Data Consistency: No double-matching a driver to two riders.

The Architectural Solution

  1. Ingestion Layer: Drivers stream locations via WebSockets. An API Gateway routes this directly into Apache Kafka to buffer spikes.
  2. Geospatial Indexing: Instead of a disk database, we use Uber’s H3 or Google’s S2 to map the world into a hexagonal grid.
  3. In-Memory Storage: We store these grid cell IDs in Redis Sorted Sets (ZSET).
  4. The Match Engine: When a passenger requests a ride, the system retrieves their cell ID, fetches available drivers from the corresponding Redis key, and computes driving ETAs.
  5. Concurrency Control: To prevent double-matching, we use a distributed lock via Redis (Redlock) or an atomic conditional update in the database.

What would you add to this stack? Surge pricing engines? Let's discuss below!

reddit.com
u/Silent-Weather76005 — 27 days ago
▲ 2 r/microservices+1 crossposts

System Design: The Thundering Herd Problem

Imagine millions of users refreshing your app at the same moment.

If your cache expires right then, every single request hits your database simultaneously.

Result? Your database crashes. Your service goes down.

This is the Thundering Herd Problem.

How to prevent it:

Mutated TTLs: Add random jitter to cache expiration times so they do not expire at once.

Mutex Locking: Allow only the first request to rebuild the cache while others wait or read stale data.

Background Warm-up: Refresh the cache via a background cron before it actually expires.

How do you handle high-concurrency spikes in your current architecture? Let's discuss in the comments!

reddit.com
u/Silent-Weather76005 — 28 days ago
▲ 41 r/microservices+1 crossposts

System design question for the backend engineers:

Cache invalidation is famously one of the hardest problems in computer science.

What is your absolute go-to strategy when you need strict consistency but cannot afford database latency?

Do you trust Write-Through, rely on short TTLs, or do you have a custom event-driven cache-busting mechanism that actually works? Drop your architecture patterns below!

reddit.com
u/Silent-Weather76005 — 30 days ago

Is using AI to turn your own thoughts into long-form content still considered "AI slop"?

I want to get your honest take on a specific gray area regarding AI content.

If someone takes their own genuine, original idea or thought, but uses an LLM to flesh it out into a full article, post, or essay—is that final product considered "AI slop"?

I have a few specific questions for the community:

  • Does ownership matter? If the core concept is 100% yours, does it matter if a machine wrote the actual sentences?
  • Is it lazy or efficient? Where is the line between leveraging a productivity tool and just creating low-effort noise?
  • Can you feel the difference? Does content automatically lose its "soul" and unique human nuance when an AI structures it?
  • Would you read it? If you found out an insightful post was generated from a human's 2-sentence prompt, would you feel cheated?

Where do you personally draw the line? Let’s discuss.
Yeah, this content is also AI-generated, but the thought behind it is mine

reddit.com
u/Silent-Weather76005 — 1 month ago

Is using AI to turn your own thoughts into long-form content still considered "AI slop"?

I want to get your honest take on a specific gray area regarding AI content.

If someone takes their own genuine, original idea or thought, but uses an LLM to flesh it out into a full article, post, or essay—is that final product considered "AI slop"?

I have a few specific questions for the community:

  • Does ownership matter? If the core concept is 100% yours, does it matter if a machine wrote the actual sentences?
  • Is it lazy or efficient? Where is the line between leveraging a productivity tool and just creating low-effort noise?
  • Can you feel the difference? Does content automatically lose its "soul" and unique human nuance when an AI structures it?
  • Would you read it? If you found out an insightful post was generated from a human's 2-sentence prompt, would you feel cheated?

Where do you personally draw the line? Let’s discuss.
Yeah, this content is also AI-generated, but the thought behind it is mine

reddit.com
u/Silent-Weather76005 — 1 month ago

Is using AI to turn your own thoughts into long-form content still considered "AI slop"?

I want to get your honest take on a specific gray area regarding AI content.

If someone takes their own genuine, original idea or thought, but uses an LLM to flesh it out into a full article, post, or essay—is that final product considered "AI slop"?

I have a few specific questions for the community:

  • Does ownership matter? If the core concept is 100% yours, does it matter if a machine wrote the actual sentences?
  • Is it lazy or efficient? Where is the line between leveraging a productivity tool and just creating low-effort noise?
  • Can you feel the difference? Does content automatically lose its "soul" and unique human nuance when an AI structures it?
  • Would you read it? If you found out an insightful post was generated from a human's 2-sentence prompt, would you feel cheated?

Where do you personally draw the line? Let’s discuss.
Yeah, this content is also AI-generated, but the thought behind it is mine

reddit.com
u/Silent-Weather76005 — 1 month ago
▲ 1 r/systems_engineering+1 crossposts

Under the hood of AI builders: why they are moving to TanStack Start over Next.js

I’ve been experimenting quite a bit with modern prompt-to-app platforms like Lovable and Bolt.new lately, digging into their source files to see exactly how they structure full-stack apps under the hood. While I expected them to default to a standard Next.js setup, I noticed a fascinating architectural shift. They are increasingly leveraging the new TanStack Start framework for their full-stack React applications.

They aren't just choosing this framework out of hype. If you look at how AI code generation actually operates, TanStack Start solves some major bottlenecks that have historically plagued AI builders. Because it is built from the ground up with Type-Safe Routing and seamless data-fetching primitives, it provides explicit, rigid structural rules that an LLM can understand with incredibly high accuracy.

When you ask an AI model to generate server actions in Next.js, it frequently messes up the boundary between client and server components or hallucinates the routing structure. TanStack Start enforces a unified, type-safe architecture across both the frontend and backend. This strict contract makes it significantly easier for the AI engine to generate code, run automated compile checks, and stitch together backend server functions without throwing runtime errors. Seeing this architecture play out in real-time is a great reminder that the best frameworks for the AI era aren't necessarily the biggest ones, but the ones that offer the most predictable, compiler-friendly structure.

u/Silent-Weather76005 — 1 month ago
▲ 262 r/neuralnetworks+1 crossposts

The real genius of the Transformer architecture was a hardware optimization trick

I’ve been diving deep into the math behind early deep learning models compared to modern attention mechanisms. It made me realize that the massive explosion of generative AI we are seeing right now didn't happen because Transformers are magically smarter at understanding human language than previous models. The real game-changing breakthrough of the 2017 Transformer paper was actually a massive engineering and hardware optimization triumph.

Before Transformers, the industry relied entirely on Recurrent Neural Networks and LSTMs for processing sequential data like text. The fundamental flaw with those architectures was that they had to process text word by word, in sequential order. You couldn’t calculate the meaning of the tenth word until you finished processing the ninth word. This created a massive computing bottleneck because it meant you could not utilize the massive parallel processing power of modern graphics cards. Your expensive GPUs were essentially sitting idle, waiting for the previous word's loop to finish.

The Transformer architecture completely threw out recurrence and replaced it entirely with self-attention. By doing this, it allowed the model to look at an entire document all at once, simultaneously.

Suddenly, processing text became a massive, parallel matrix multiplication problem. This single structural shift aligned perfectly with how GPU hardware is physically built. We went from training models on small paragraphs over weeks to feeding entire datasets into massive server clusters in days. The AI revolution didn't scale because the code got more philosophical; it scaled because the math finally allowed us to throw unlimited brute-force hardware at the problem. It is a great reminder that software design is always bound by the physical realities of the silicon it runs on.

reddit.com
u/Silent-Weather76005 — 1 month ago