Advanced concepts in Backend Dev, page 4

Async Generators: `yield` in an `async` World
Async generators let you write I/O-bound data streams with the elegance of yield. An async def function with yield produces values one at a time, pausing for I/O without blocking. This is ideal for streaming data from a database.
CRDTs: Syncing Data Without Locks or Conflicts
CRDTs are data structures where updates can be applied in any order and reach the same state, avoiding locks. They enable offline editing in collaborative apps and distributed databases.

asyncio: Transports Move Bytes, Protocols Decide Which Bytes
asyncio Transports are the "how" (moving bytes), while Protocols are the "what" (deciding which bytes to send). They're the low-level foundation for libraries handling raw socket I/O.

asyncio Event Loop Policies: A Deprecated Pattern
Think of an event loop policy as the global factory for asyncio's event loops, controlling which loop is created and how it's retrieved. It was used to swap implementations, but the entire API is deprecated in Python 3.14 and will be removed in 3.16.

Debugging Python's Asyncio
Debugging asyncio is about finding what's blocking the single-threaded event loop. Use its debug mode to detect slow callbacks and run_in_executor to offload CPU-bound work. The biggest mistake is calling blocking code directly, which stalls the entire app.
MOLAP: A Pre-Computed Cube for Fast Analytics
MOLAP pre-calculates business data into a multi-dimensional "cube" for near-instant analytics. Use it for BI dashboards requiring fast responses to complex queries. The footgun: the cube is a static snapshot, and building it can be slow and rigid.

Idempotency in REST APIs: Safe to Retry?
An idempotent API request means sending it once or 100 times has the same effect on the server's state. GET, PUT, and DELETE are idempotent, making them safe to retry. POST is not, so retrying can create duplicates.
API Rate Limiting: Protecting Your Express Endpoints
Rate limiting acts as a bouncer for your API, preventing any single user from overwhelming it. It's crucial for public APIs and sensitive endpoints like password resets to block abuse. The default in-memory store won't work across multiple server instances.
HATEOAS: Let Your API Tell You What's Next
HATEOAS makes an API self-discoverable, like a website where you click links instead of guessing URLs. The server's response includes links for the next possible actions, decoupling the client from hardcoded endpoints.
Rust Associated Types: One Trait, One Concrete Type
Associated types link a placeholder type to a trait, ensuring any implementation provides one specific type. This cleans up code, like in Rust's Iterator trait. The footgun: a type can only implement a trait with an associated type once.
SQLAlchemy: Control When Your Relationships Load
SQLAlchemy's default lazy loading is convenient but can cause an N+1 query storm. Use eager loading (joinedload, selectinload) for collections you'll access to prevent many database round trips.
Vector Clocks: Tracking Causality in Distributed Systems
A vector clock is an array of counters, one for each node, that tracks causality across a distributed system. It's how databases resolve conflicting writes.
Rust Marker Traits: Properties as Types
Marker traits are empty labels telling the Rust compiler about a type's capabilities, like being copyable or thread-safe. They have no methods; their presence is the signal. They're key for concurrency (Send/Sync) and memory (Copy/Sized) safety checks.
Raft: Understandable Distributed Consensus
Raft gets a cluster of servers to agree on a shared state by electing a leader to manage a replicated log. It's used to build fault-tolerant systems that must maintain a consistent state machine. The footgun: assuming 'easier than Paxos' means 'easy'.
Paxos: Achieving Consensus in Unreliable Networks
Paxos is like a legislature agreeing on a law with unreliable messengers. It lets servers agree on a value (like a transaction) despite failures. It’s used in distributed databases for consistency, but its complexity is its biggest footgun; never implement it…
Split-Brain: When a Cluster Disagrees With Itself
A split-brain is when a cluster partitions and nodes on each side think they're the leader, accepting writes independently. This is a classic failure in high-availability systems.
Causal Consistency: A Memory Model for Concurrency
Causal consistency is a rulebook for concurrent systems, defining legal data access patterns. It's used to ensure correctness in distributed shared memory and transactions, preventing data corruption from simultaneous operations.
Sequelize Transactions: All-or-Nothing Database Writes
A Sequelize transaction is a safety wrapper for database queries, ensuring they all succeed or none do. Use it for multi-step operations like creating a user and profile.

Mongoose Population: Linking Documents Across Collections
Mongoose's populate() acts like a client-side JOIN, replacing document IDs with actual documents from other collections. It's ideal for linking related data, like a blog post's author.
Sequelize Scopes: Reusable Query Shortcuts
Sequelize scopes are named shortcuts for common query conditions, letting you define where or include clauses once and reuse them. Use them to keep code DRY, like an active scope. The footgun: a defaultScope is always on unless you call .unscoped().
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles