Topic archive
Java
Java tutorials, examples, and performance tips.
-
Java Virtual Threads on JDK 21: What 2,000 Connections, One Carrier Thread, and a synchronized Block Actually Do
A measured look at virtual threads on JDK 21.0.3: an echo server under 2,000 concurrent connections, the synchronized pinning stall reproduced with one carrier, where the 10x win is, and the case where virtual threads were slower.

-
Idempotency Keys in a Spring Boot REST API: Atomic Claims, Request Fingerprints, and 20 Concurrent Duplicates
A Spring Boot 3.5.16 payment endpoint with Idempotency-Key handling in Redis, tested with 20 simultaneous duplicates (one row, 1 x 201, 19 x 409), and the two ways the usual SETNX-lock recipe fails: a failed first attempt locks the key for a day, and the template it injects does not exist.

-
Cache-Aside with Caffeine: Which Read Path Prevents a Stampede, and What Expiry, Refresh, and Stats Really Do
Tested on Caffeine 3.2.4 and Java 17: the getIfPresent/put helper let 32 of 32 concurrent misses hit the database, cache.get(key, fn) let one through, and the published async example did not compile.

-
Envoy as a Sidecar for a Java Service: A Configuration That Loads, and What Retries, Timeouts, Outlier Ejection and Circuit Breakers Actually Do
The earlier envoy.yaml is rejected by Envoy 1.23 and 1.39.1 alike and its docker command cannot reach a service on the host. This version runs Envoy 1.39.1 in front of a plain Java HTTP server and reads retries, a 1 s route timeout, consecutive-5xx ejection, the panic threshold and a 1-connection circuit breaker off the…

-
Distributed Tracing in Spring Boot 3 with Micrometer Tracing and Zipkin: Migrating from Spring Cloud Sleuth
Spring Cloud Sleuth is end-of-life. Two Spring Boot 3.5.16 services, Micrometer Tracing with Brave, Zipkin 3.6.1: the same traceId in both logs, the trace fetched from Zipkin’s API, W3C headers on the wire, and sampling measured at exactly 10 of 100.

-
Practical Guide to Java Deadlock Detection and Resolution in Production Systems
This practical Java engineering guide covers detecting and resolving deadlocks in production systems using ThreadMXBean, lock ordering, tryLock with timeouts, and monitoring best practices.
