SShortSingh.
Back to feed

Developer Guide: Building a Minimal Kafka Broker From Scratch in Java

0
·1 views

A hands-on tutorial published on DEV Community walks developers through building a stripped-down Apache Kafka broker in Java to deepen understanding of how the system works internally. The guide argues that most Kafka users have little insight into what happens inside the broker between a producer sending a message and a consumer receiving it. It highlights key challenges such as multi-threaded TCP connection handling and binary wire protocol design, including the use of variable-length integers for performance efficiency. The author uses a simplified Java BrokerInfo class to illustrate how even basic serialization decisions — byte order, string encoding, architecture compatibility — reveal important protocol-level tradeoffs. The piece is the first in a multi-part series aimed at developers who want to move beyond surface-level knowledge of distributed systems.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Designer builds free web tool to generate vector topographic contour maps

A designer created Topolines, a web-based tool for generating vector topographic contour maps and generative patterns, available at topolines.app. The tool was built to fill a gap between heavy GIS software and static file purchases for design use cases such as branding, UI backgrounds, and print projects. Users can adjust parameters like elevation density, noise scale, and line weights in real time, along with full color and gradient controls. The tool supports clean SVG exports compatible with Figma and Adobe Illustrator, as well as HD PNG downloads. A free tier allows PNG exports without requiring an account, and the creator is actively seeking user feedback and feature requests.

0
ProgrammingDEV Community ·

Kubernetes Health Probes: How Liveness, Readiness, and Startup Probes Work

Kubernetes offers three types of health probes — liveness, readiness, and startup — each serving a distinct purpose in managing container lifecycle. The liveness probe monitors whether a container is functioning correctly and triggers a restart if it fails, but should only check internal process health, not external dependencies like databases. The readiness probe determines whether a pod should receive traffic and is the appropriate place to check external dependencies, also playing a key role in ensuring safe rolling updates. Introduced in Kubernetes 1.18, the startup probe handles slow-initializing applications by disabling liveness and readiness checks until the app has fully started. Misconfiguring or omitting these probes can lead to crash loops, dropped traffic, or failed deployments, while correct configuration enables self-healing and zero-downtime rollouts.

0
ProgrammingDEV Community ·

WP-CLI PHP Deprecated warnings persist on shebang-launched phar binaries, fix released

Developers found that setting WP_CLI_PHP_ARGS to suppress PHP 8.2 Deprecated warnings failed on Xserver because WP-CLI is deployed there as a shebang-launched phar binary, preventing the environment variable from ever reaching PHP's startup options. An agency first reported the issue when plugin list retrieval across multiple sites produced hundreds of Deprecated messages despite the standard configuration being in place. Tracing the execution path confirmed that when PHP is invoked via a shebang line, WP-CLI has no opportunity to inject the -d error_reporting flag into PHP's invocation. Version 1.6.8 of the tool introduces a function that inspects the WP-CLI path and, if the leading binary is a php variant, inserts the suppression flag directly after the binary name. A second helper was also added to extract only valid JSON from command output, guarding against residual notices or warnings that may still appear in stdout.

0
ProgrammingDEV Community ·

Trestle DeFi Fixes Polygon RPC Desync Bug Crashing Event Listener Pipeline

Trestle DeFi, a decentralized finance project built on Polygon, encountered persistent pipeline crashes caused by a race condition between the Bor layer's fast block production and the slower internal indexer database. During high network traffic or post-upgrade periods, asynchronous scripts querying the latest chain tip via eth_getLogs would hit unindexed data, triggering non-deterministic block range errors. The team resolved the issue without modifying node-level code by introducing a programmatic block-buffer delay, targeting query ranges three or more blocks behind the current chain tip. This roughly six-second safety window ensured all queried blocks were fully indexed before being accessed. The fix fully stabilized the off-chain reward data pipeline, eliminating endpoint crashes and preserving data integrity for user claims.

Developer Guide: Building a Minimal Kafka Broker From Scratch in Java · ShortSingh