Skip to content
tezvyn:
Menu

Concurrency

183 bites tagged Concurrency: interview questions with model answers, and 60-second explainers.

Test yourself: Top 30 Concurrency interview questions →Multiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.
Node.js & Express1 min read

postMessage vs SharedArrayBuffer in worker_threads tradeoffs?

Structured cloning copies data, SharedArrayBuffer shares memory.

TypeScript & Web APIs2 min read

Dedicated vs Shared vs Service Workers compared

Dedicated worker serves one page for offloading CPU; Shared worker is one instance across same-origin contexts via ports; Service worker is a network proxy for caching and push, event-driven and killable.

React & Next.js1 min read

Tearing and useSyncExternalStore in concurrent React

Tearing is inconsistent UI when an interruptible render reads a changed external store mid-pass; useSyncExternalStore subscribes and forces consistent snapshots, re-rendering synchronously on change.

React Native2 min read

Threading of native module methods

Methods run on a dedicated native module queue, not the UI thread; long blocking work stalls other module calls; offload to a background executor or override methodQueue, returning results via promise.

React Native1 min read

How do you move a 500ms blocking task off the JS thread?

Offload to a native module or C++ TurboModule, a worklet/worker thread, or chunk the work and yield; never block JS.

Python & FastAPI1 min read

SQLAlchemy connection pooling across Uvicorn workers

Each worker has its own pool; total DB connections equal workers times (pool_size plus max_overflow); overflow connections are temporary; misconfiguration exhausts DB…

Python & FastAPI1 min read

asyncio.gather vs asyncio.wait

Gather returns ordered results and propagates the first exception (or captures them); wait returns done/pending sets and never raises, you inspect each.

Node.js & Express1 min read

worker_threads versus cluster: when to use each

Worker_threads offloads CPU-bound compute within one process with shared-memory transfer; cluster forks processes to scale IO-bound request throughput across cores.

Node.js & Express2 min read

Offloading CPU work with worker_threads

Heavy sync work blocks the single event loop and stalls all requests; move it to a Worker, message the input, await the result asynchronously, and ideally pool workers.

Node.js & Express1 min read

Purpose of the Node.js cluster module

Cluster forks worker processes sharing one listening port, so requests spread across CPU cores via the OS, raising throughput and adding resilience.

Node.js & Express1 min read

Atomic order creation with Sequelize transactions

Wrap dependent writes in sequelize.transaction, pass the transaction to each query, let managed transactions auto-commit or roll back.

Node.js & Express1 min read

Promise.all vs Promise.allSettled

All rejects on the first failure; allSettled always fulfills with a status/value or reason per input. Use allSettled when partial success is acceptable.

Node.js & Express2 min read

Bounded concurrency for many async requests

Chunk the array and await Promise.all per chunk, or run a fixed worker pool pulling from a shared index; cap in-flight requests.

Node.js & Express1 min read

Running independent requests with Promise.all and race

Start all requests then await Promise.all to get all results or fail fast on first rejection; use Promise.race when only the fastest settled result matters.

Node.js & Express1 min read

Offloading CPU-bound work with Worker Threads

Synchronous CPU work freezes the loop and all requests; offload to a Worker, communicate via messages or SharedArrayBuffer, use a pool.

Node.js & Express1 min read

Order of the Node.js event loop phases

Timers, pending callbacks, poll, check, close phases in order; I/O completion runs in poll.

Monitoring & SRE2 min read

Why does 200ms latency drop requests? Diagnose it.

Little's Law shows added latency raises in-flight requests, exhausting the thread or connection pool; check pool saturation, timeouts, and retries.

Monitoring & SRE1 min read

Little's Law for capacity planning

L equals lambda times W, concurrency equals arrival rate times time in system; rearrange to size threads or concurrency for a target throughput and latency.

Monitoring & SRE1 min read

Backpressure

Backpressure is a mechanism by which a slow consumer signals an upstream producer to slow down or stop, preventing unbounded queues and resource exhaustion. It keeps systems stable under overload by propagating capacity limits backward through a pipeline.

Databases & Architecture1 min read

SQL isolation levels and the anomalies they prevent

Read Uncommitted allows dirty reads; Read Committed blocks them; Repeatable Read blocks non-repeatable reads; Serializable blocks phantoms.

Databases & Architecture2 min read

Iceberg vs Delta Lake metadata and ACID

Iceberg uses a tree of metadata and manifest files with atomic pointer swaps and optimistic concurrency; Delta uses an ordered transaction log of JSON commits with optimistic concurrency.

Databases & Architecture1 min read

Unit of Work / Session pattern in ORMs

The Unit of Work tracks new, dirty, and deleted objects, then flushes them as one batched transaction at commit.

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.

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.

Get Concurrency bites daily.

Five a day, five minutes, offline. With quizzes so it sticks.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon