Welcome to your one-stop destination for all things tech! Insightful blogs, code snippets, and industry updates for developers of all levels — from Java and Spring Boot to Docker, Kafka, and AWS.
New Linux Server? Do These 9 Things Before Anything Else
Every fresh VPS (Hetzner, DigitalOcean, your homelab Proxmox box) boots up with the same problem: a root login over password, no firewall, and nothing installed. Before you deploy anything, spend 15 minutes on this checklist. Order matters. Firewall rules and SSH hardening can lock you out permanently if done in the wrong sequence. Do the steps in this order and you won’t have to rescue-boot your way back in. 1. Update everything first Connect as root and patch the box before touching anything else. ...
Rate Limiting in Spring Boot: The System Design Interview Answer, in Code
Rate limiting shows up in two places: your on-call rotation and your system design interview. Both reward the same thing — knowing which algorithm to pick, why, and what breaks at scale. This guide builds three working limiters in Spring Boot, each with tests: Fixed window — the simplest thing that works, hand-rolled. Token bucket — smooth, burst-friendly, via Bucket4j. Distributed sliding window — precise and shared across instances, on Redis with Lua. Then we close with the part interviews actually grade: how to talk through the tradeoffs. ...
Flipping spring.threads.virtual.enabled=true? Read This First
Virtual threads can be one of the easiest throughput wins in a blocking Spring Boot application. The switch is one line: spring: threads: virtual: enabled: true But that line changes the concurrency model of the application. It does not make database queries faster, reduce API latency, or create more database connections. It makes waiting cheaper by allowing many request tasks to share a smaller number of carrier threads. ...
Java Streams
JAVA Streams Sum of Elements Given a list of integers, compute the sum of all numbers. // using sum List<Integer> arr = Arrays.asList(1, 4, 5, 6, 22, 3, 90, 89, 2, 1, 3, 4, 55, 6); int sum = arr.stream() .mapToInt(Integer::intValue) .sum(); // or int sum3 = arr.stream() .reduce((a,b) -> a + b) .get(); // or int sum2 = arr.stream() .reduce(0, (total, n) -> total + n, (total1, total2) -> total1 + total2); Average of Elements Given a list of integers, compute the average of all numbers. ...
Java Concurrency Multithreading
Thread Thread Subclass Here is an example of creating a Java Thread subclass: public class MyThread extends Thread { public void run(){ System.out.println("MyThread running"); } } To create and start the above thread you can do like this: MyThread myThread = new MyThread(); myTread.start(); You can also create an anonymous subclass of Thread like this: Thread thread = new Thread(){ public void run(){ System.out.println("Thread Running"); } } thread.start(); Runnable Interface Implementation Java Class Implements Runnable public class MyRunnable implements Runnable { public void run(){ System.out.println("MyRunnable running"); } } Anonymous Implementation of Runnable Runnable myRunnable = new Runnable(){ public void run(){ System.out.println("Runnable running"); } } Java Lambda Implementation of Runnable Runnable runnable = () -> { System.out.println("Lambda Runnable running"); }; Starting a Thread With a Runnable Runnable runnable = new MyRunnable(); // or an anonymous class, or lambda... Thread thread = new Thread(runnable); thread.start(); The Java Memory Model Here is a diagram illustrating the call stack and local variables stored on the thread stacks, and objects stored on the heap: ...