Posts

Introduction to Containers

Image
  Section: Introduction to Containers By the end of this lesson, you should understand: What containers are and why we need them. The difference between physical servers, virtual machines (VMs), and containers. How containers work. Why containers are important for Kubernetes and GKE. 1. First, understand the problem Imagine you have developed a Java Spring Boot application. For your application to run, you need: Java (JDK/JRE) Required libraries and dependencies Configuration files Your application code The problem is that your application works on your laptop but fails on another computer because the Java version or dependencies are different. Containers solve this problem by packaging your application with its required dependencies. 2. The evolution: Physical servers → VMs → Containers 1. Physical servers Imagine one physical computer dedicated to running your application. Problems: Hardware is expensive. Resources can be wasted. Scaling requires additional machines. Setup and ma...

App Engine vs Compute Engine vs GKE

  1. What is App Engine? App Engine is a Google Cloud service that lets you deploy and run your application without having to manage the server yourself. Suppose you have developed a Java Spring Boot application. Normally, you might need to: Create a server. Install Linux. Install Java. Configure the server. Deploy your application. Monitor the server and manage scaling. With App Engine, Google manages much of this infrastructure for you. You focus mainly on writing your application and deploying it. 2. Real-life example Imagine you're building a food delivery application like Swiggy. Your Java Spring Boot code Restaurant API, login API, order API Deploy to App Engine Google provisions and manages the application runtime Google runs your application Hosting, traffic handling and scaling features Customer uses your app The app sends HTTP requests to your APIs For example, a customer requests restaurant details. The request reaches your application running on App Engine, your Java co...

GKE Foundations — Google Cloud's Compute Workload Options

Image
  GKE Foundations — Google Cloud's Compute Workload Options Google Cloud provides different services to run applications. The best choice depends on how much control you need over the infrastructure and how you want to deploy your application. Let's understand each service from a beginner's perspective. 1. The main compute services 1. Kubernetes Engine (GKE) Containers A managed environment for deploying and managing containerized applications using Kubernetes. Example: Deploy multiple Spring Boot microservices in Docker containers and let Kubernetes manage scaling and recovery. 2. Compute Engine Virtual machines Provides virtual machines (VMs) where you control the operating system, software, and runtime configuration. Example: Create a Linux VM, install Java, and run your Spring Boot JAR file. 3. App Engine Platform as a service A managed platform for deploying applications without managing the underlying servers directly. Example: Deploy a supported web application and l...

How to Interact with Google Cloud Platform (GCP)

Image
  GKE Foundations — Section: How to Interact with Google Cloud Platform (GCP) Let's understand this video from zero, with simple examples and practical commands. This topic is important because, while learning Kubernetes Engine (GKE), you'll use tools like Google Cloud Console, Cloud Shell, gcloud , and kubectl . 1. What is GCP? Google Cloud Platform (GCP) is Google's cloud computing platform. Instead of purchasing and maintaining physical servers, you can use Google's infrastructure to run applications. For example, imagine you have a Java Spring Boot application that you want to deploy. You might need: A virtual machine or Kubernetes cluster to run your application. Storage to store files. A network to connect services. Monitoring to check CPU usage and application errors. GCP provides these services, and you need tools to manage them. 2. The four ways to interact with GCP 1. Google Cloud Console GUI A website where you manage cloud resources using your mouse and keyb...

Deployment strategies in real projects

Image
  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...