When is Redis pub/sub the wrong choice compared with Kafka?
Simple meaning
Redis pub/sub is fire-and-forget: if a subscriber is down, the message is gone.
Open the full page for Why, Steps, Example and Key takeaway.
Panel-ready Java Specialist questions for freshers and experienced developers. Practice at Coding Cadre in Faridabad, or Online from Delhi NCR.
Redis pub/sub is fire-and-forget: if a subscriber is down, the message is gone.
Open the full page for Why, Steps, Example and Key takeaway.
A topic is a named stream, like orders.
Open the full page for Why, Steps, Example and Key takeaway.
Each partition is assigned to at most one consumer in a group, so the group shares work.
Open the full page for Why, Steps, Example and Key takeaway.
At-most-once commits the offset before processing, so a crash can skip messages.
Open the full page for Why, Steps, Example and Key takeaway.
Kafka keeps a durable, replayable log so a new billing service can catch up from old offsets.
Open the full page for Why, Steps, Example and Key takeaway.
The key hashes to a partition, so all events for that user land in one ordered log.
Open the full page for Why, Steps, Example and Key takeaway.
Opening a TCP connection and authenticating to Postgres on every HTTP call is slow and will exhaust database max_connections.
Open the full page for Why, Steps, Example and Key takeaway.
HikariCP is the default JDBC pool.
Open the full page for Why, Steps, Example and Key takeaway.
Each request thread that hits the database needs a connection at the same time.
Open the full page for Why, Steps, Example and Key takeaway.
You load N parents with one query, then lazy-load each collection with one extra query, for N+1 round trips.
Open the full page for Why, Steps, Example and Key takeaway.
Use JOIN FETCH in a dedicated query, an @EntityGraph on that use case, or a DTO projection that joins in SQL.
Open the full page for Why, Steps, Example and Key takeaway.
Error handlers have four arguments (err, req, res, next).
Open the full page for Why, Steps, Example and Key takeaway.
The cluster module or a process manager like PM2 forks workers that share the port.
Open the full page for Why, Steps, Example and Key takeaway.
Read the Authorization Bearer token, verify signature and expiry with the IdP public key or a shared secret, then attach req.user.
Open the full page for Why, Steps, Example and Key takeaway.
Key by IP plus username, count hits in Redis with an INCR and TTL window, and return 429 when the cap is exceeded.
Open the full page for Why, Steps, Example and Key takeaway.
If one team owns the whole domain and traffic is moderate, a modular monolith deploys faster and avoids distributed transactions.
Open the full page for Why, Steps, Example and Key takeaway.
It is a single entry point for auth, TLS, rate limits, and routing to many backend services.
Open the full page for Why, Steps, Example and Key takeaway.
Instances come and go with autoscaling, so callers cannot hardcode IPs.
Open the full page for Why, Steps, Example and Key takeaway.
Use synchronous REST when the user is waiting and you need an immediate consistent answer, like checking wallet balance.
Open the full page for Why, Steps, Example and Key takeaway.
After a dependency fails past a threshold, the breaker opens and fails fast instead of waiting on timeouts.
Open the full page for Why, Steps, Example and Key takeaway.