Skip to content
tezvyn:

All bites

The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.

4330 bites

Page 214

Databases & Architecture2 min read

What is sharding and why shard over vertical scaling?

Sharding splits one dataset across servers by a shard key so each holds a subset; you shard because vertical scaling hits hardware ceilings, gets costly, and remains a single point of failure.

Databases & Architecture2 min read

Apply the CAP theorem to a real system

Define C, A, P; note partitions are unavoidable, so the real choice during one is consistency versus availability; then classify a system as CP or AP with reasoning.

Databases & Architecture2 min read

Range-based vs hash-based sharding trade-offs?

Range sharding keeps ordered keys together, great for range scans but prone to hot spots on sequential keys; hash sharding spreads keys evenly, avoiding hot spots but killing efficient range…

Databases & Architecture1 min read

Leader-follower vs multi-leader replication

Single-writer leader-follower is simple but a write bottleneck; multi-leader accepts writes in many regions for latency and availability.

Databases & Architecture1 min read

What is eventual consistency?

Replicas converge to the same value if writes stop, allowing temporary staleness for higher availability and lower latency.

Databases & Architecture1 min read

Durable write path in a sharded KV store

Route by key hash to the shard leader, append to WAL and fsync, replicate to two followers, ack on quorum, then confirm.

Databases & Architecture1 min read

Split-brain, consensus, and quorum

Split-brain is two nodes both believing they are leader during a partition; Raft/Paxos require a majority quorum to elect a leader and commit, so the minority side cannot make progress.

Databases & Architecture1 min read

Mitigating a database shard hot spot

Short-term, add read replicas or cache the hot keys; long-term, fix the partition key with hashing, salting, or finer-grained splitting.

Databases & Architecture1 min read

Full, differential, and incremental backups

Full copies everything; differential copies all changes since the last full; incremental copies changes since the last backup of any type.

Databases & Architecture1 min read

Least privilege for database service accounts

Grant each account only the minimum rights its job needs; for an app service account, scope grants to specific tables and verbs, never use the superuser.

Databases & Architecture1 min read

Connection pooling and its key parameters

Reuse open connections to skip costly handshakes; tune max pool size and connection timeout.

Databases & Architecture1 min read

Point-in-Time Recovery (PITR)

Restore a base backup then replay archived write-ahead logs up to a chosen moment, enabling recovery to just before an error.

Databases & Architecture1 min read

RBAC vs direct user grants

Direct grants tie rights to individuals; RBAC groups rights into roles users inherit, so changes happen once per role.

Databases & Architecture1 min read

Diagnosing degradation with normal CPU and memory

When CPU and memory look fine, sessions are waiting, not computing; examine wait statistics, lock and latch contention, I/O waits, and buffer pool hit ratio.

Databases & Architecture1 min read

Defense-in-depth against SQL injection

Beyond parameterization, apply least-privilege accounts, stored procedures, input allowlisting, and monitoring to shrink blast radius.

Databases & Architecture1 min read

Purpose of database drivers (JDBC/ODBC)

A driver translates a standard API into each database's wire protocol, so app code stays portable across vendors.

Databases & Architecture1 min read

Connection pools and the problem they solve

A pool reuses pre-opened connections so requests skip the expensive connect handshake; without one, every request pays setup latency and may overwhelm the database.

Databases & Architecture1 min read

Pooled connection lifecycle and close() semantics

Borrow from pool, use, then close() returns it to the pool rather than tearing down the socket.

Databases & Architecture1 min read

Eager vs lazy loading in an ORM

Eager fetches related data up front (joins/extra query); lazy defers until accessed. Lazy in a loop causes the N+1 query problem.

Databases & Architecture1 min read

Transaction isolation levels and their tradeoffs

Isolation levels control which concurrency anomalies (dirty/non-repeatable reads, phantoms) are allowed; higher levels mean stronger consistency but more blocking and less concurrency.