Posts

Deployment strategies in real projects

  Deployment strategies in real projects Three deployment approaches are worth knowing: Rolling deployment Gradually replace old application instances with new ones. Useful for many routine releases. Blue-green deployment Run old and new versions in separate environments, test the new version, then switch traffic. This needs additional capacity and careful handling of state. Canary deployment Release the new version to a small portion of traffic first, check its performance, and gradually expand the release if everything looks good. For example, a bank might first release a new payment-service version to a small group of users or a limited portion of traffic before making it available to everyone. Note that Kubernetes Deployments support rolling updates directly.  Blue-green and canary releases typically need additional traffic-routing configuration or deployment tooling.

Java 21 Interview Preparation: 8 Topics Every Senior Java Developer Should Know

  Java 21 Interview Preparation: 8 Topics Every Senior Java Developer Should Know Java 21 introduced important features that interviewers may explore through coding questions, internal workings, and real-world scenarios. If you have 8+ years of Java experience, prepare these topics: 1. Virtual Threads * Platform threads vs virtual threads * How does Project Loom work? * When should you use virtual threads? * What are thread pinning and its implications? 2. Structured Concurrency (Preview in Java 21) * What problem does structured concurrency solve? * How do you manage multiple concurrent tasks? * How should task cancellation and failures be handled? 3. Pattern Matching for switch * How is it different from traditional switch? * How do type patterns and guarded patterns work? * What is exhaustive pattern matching? 4. Record Patterns * How do record patterns simplify data extraction? * How do nested record patterns work? * How can they be combined with pattern matching for switch? 5....

How HashMap work in Java

Image
If someone had asked me a year ago how HashMap works, I would've confidently said, "It's just a key-value pair that uses hashing to store data." Technically, I wasn't wrong. But I wasn't completely right either. While preparing for interviews, I decided to go beyond the definition. That's when I discovered what actually happens inside a HashMap. It isn't just a collection of random buckets. At its core, HashMap uses a dynamic array. Each position in that array is called a bucket. When you insert a key, Java calculates its hashCode() to decide which bucket it belongs to. But what if two different keys end up in the same bucket? That's called a collision. Instead of overwriting the existing value, HashMap stores both entries together. Java then uses equals() to identify the correct key when retrieving data. Earlier versions stored collided entries as a Linked List. But in Java 8 and above, if too many entries accumulate in the same bucket (and the ta...

🚀 Apache Kafka vs RabbitMQ: Which One Should You Choose?

  🚀 Apache Kafka vs RabbitMQ: Which One Should You Choose? 💡 Both Apache Kafka and RabbitMQ are powerful messaging technologies used in modern distributed systems and microservices architecture. But do you know when to use each one? 🔵 Apache Kafka ✅ Designed for high-throughput, real-time event streaming ✅ Handles millions of messages efficiently ✅ Stores events for configurable retention periods ✅ Ideal for event-driven architectures, log aggregation, and stream processing 🟠 RabbitMQ ✅ Reliable message delivery between applications ✅ Supports flexible routing using exchanges and queues ✅ Ideal for background jobs, task queues, and asynchronous communication ✅ Supports protocols such as AMQP, MQTT, and STOMP 🔥 Key Takeaway: 👉 Choose Kafka when you need high-throughput event streaming, event replay, and scalable data pipelines. 👉 Choose RabbitMQ when you need flexible message routing, task distribution, and reliable asynchronous communication.

Java Microservices Interview Questions 2026 Experience: 3 to 6 Years

Java Microservices Interview Questions 2026 Experience: 3 to 6 Years 𝗖𝗢𝗥𝗘 𝗝𝗔𝗩𝗔: 1. Fail-fast vs fail-safe iterators. 2. How does ConcurrentHashMap work internally? 3. What happens when a thread pool’s work queue reaches capacity? 4. What are the consequences of using a mutable object as a HashMap key? 5. Explain SOLID principles with a real-world example. 6. Optional: orElse() vs orElseGet(). 7. Your service throws OutOfMemoryError in production. What are your first diagnostic steps? 8. Virtual threads: when do they improve scalability, and where do they fall short? 𝗦𝗣𝗥𝗜𝗡𝗚 𝗕𝗢𝗢𝗧 𝗔𝗡𝗗 𝗠𝗜𝗖𝗥𝗢𝗦𝗘𝗥𝗩𝗜𝗖𝗘𝗦: 1. How does JWT-based authentication work? 2. What is the difference between OAuth2 and JWT? 3. RestTemplate vs WebClient vs RestClient. 4. How do microservices communicate with each other? 5. What is the role of an API Gateway? 6. How do you implement global exception handling in Spring Boot? 7. How does @Transactional work internally? 8. Why does @Transactio...