Posted on: September 26, 2025 Posted by: rahulgite Comments: 0

Kubernetes Scaling Configuration and Background

1. Horizontal Pod Autoscaler (HPA) Purpose/Background: HPA is for application-level scaling. It automatically adjusts the number of Pods (replicas) based on metrics like CPU usage to handle changing load efficiently, saving resources during quiet periods while scaling out during peak times. Configuration File (HorizontalPodAutoscaler object): Crucial Prerequisite: Resource Requests ⚠️ For HPA to work with resource utilization metrics, the target Deployment must define resource requests in the Pod spec: 2.…

Posted on: September 26, 2025 Posted by: rahulgite Comments: 0

Kafka Delivery Guarantees

The Core Concept: Delivery Guarantees In any messaging system like Kafka, “delivery guarantees” refer to the promises the system makes about whether a message sent by a producer will be received by a consumer, and how many times it might be received. There are three main types: Default Scenario in Kafka: At Least Once By default, Kafka is configured for an at-least-once delivery guarantee. This is a balance between performance…

Posted on: September 26, 2025 Posted by: rahulgite Comments: 0

Kafka Replication

🔹 1. Kafka Data Replication 👉 If the leader fails, one of the in-sync followers (ISR) is promoted as the new leader. 🔹 2. Consumer Offsets Replication 🔹 3. Transactional State Replication 🔹 4. Kafka Streams State Replication 🔹 5. Connect Configs and Status Replication 🔹 6. Metadata Replication (ZooKeeper vs KRaft) 🔹 7. Log Segments (File System Level) 🔹 8. Producer Reliability (Duplicates vs Idempotence) 🔹 Summary Table Component…

Posted on: September 26, 2025 Posted by: rahulgite Comments: 0

Understanding ZooKeeper vs KRaft

🔹 How They Work ✅ ZooKeeper-based Kafka ✅ KRaft-based Kafka 🔹 Why the Change? 🔹 Advantages & Disadvantages ✅ ZooKeeper Advantages: Disadvantages: ✅ KRaft Advantages: Disadvantages: 🔹 Summary Comparison Feature ZooKeeper Mode KRaft Mode (Raft) Metadata Storage ZooKeeper nodes Kafka internal topic __cluster_metadata Controller Election Done via ZooKeeper Done via Raft quorum Deployment Complexity Requires external ZooKeeper cluster Self-contained, no ZooKeeper Scalability Limited with large clusters More scalable Reliability Stable,…

Posted on: September 26, 2025 Posted by: rahulgite Comments: 0

Kafka Consumer Scenarios

Kafka Basics Recap Consumer group → a set of consumers working together to read from a topic. Topic → logical channel where producers write data. Partition → a topic is split into multiple partitions for parallelism. Offset → a sequential ID for messages within a partition. Scenario A: One Consumer, One Topic Scenario B: Multiple Consumers in Same Consumer Group Scenario C: Multiple Consumers in Different Groups Scenario D: More…

Posted on: July 2, 2025 Posted by: rahulgite Comments: 0

Java Garbage Collection: Concepts, Algorithms, and Object Lifecycle

1. Reference Variables and Memory Allocation 2. Heap Memory Structure 3. Survivor Spaces and Object Movement Example: 4. Object Metadata Storage 5. Garbage Collectors and Their Algorithms Serial Garbage Collector Concurrency is about dealing with many tasks at once.Parallelism is about doing many tasks at the same time.Concurrency can happen on a single core through context switching, while parallelism requires multiple cores. Parallel Garbage Collector (Throughput GC) Concurrent Mark-Sweep (CMS)…

Posted on: July 2, 2025 Posted by: rahulgite Comments: 0

JPA Scenario for dynamic DB

Question:How can I dynamically fetch data from different country-specific databases (like india_db, italy_db) using Spring Boot, such that I don’t need to add new configurations or modify any table when a new country is added? Answer:To achieve this in Spring Boot, where each country has its own database (following a pattern like <country>_db), but all databases share the same schema and credentials, you can implement a dynamic repository factory pattern.…

Posted on: July 2, 2025 Posted by: rahulgite Comments: 0

Caching in Spring Data JPA

Caching is a performance optimization technique that stores frequently accessed data in memory to avoid repetitive and expensive computations or database calls. 1. Why Use Cache? 2. Types of Caches 1. First-Level Cache (Persistence Context Cache) 2. Second-Level Cache 3. Application-Level Cache (Spring Cache Abstraction) Spring Cache abstracts the caching mechanism and lets you plug in your own provider: 2.1 Steps to Add Each Cache Provider ✅ Overview of All…

Posted on: July 2, 2025 Posted by: rahulgite Comments: 0

Spring Data JPA: Complete Guide with Examples and Diagrams

This guide provides an end-to-end explanation of Spring Data JPA including project setup, entity creation, repository interfaces, query methods, JPA architecture, persistence lifecycle, and JPQL examples. It also includes diagrams and best practices. 1. Project Setup Start with Spring Initializr (start.spring.io) and add the following dependencies: Project Structure: 2. JPA Architecture Overview Key Components: Flow Diagram: 3. Persistence Lifecycle States States of a JPA Entity: State Description New Not yet…

Posted on: June 27, 2025 Posted by: rahulgite Comments: 0

Angular Performance Optimization Tips

Here are some key points, descriptions, and examples to help improve performance in Angular applications: 1. Use OnPush Change Detection Strategy Description: The default change detection strategy checks the whole component tree. OnPush only checks when inputs change or events occur, reducing unnecessary checks. Example: 2. Lazy Load Feature Modules Description: Load modules only when they are needed rather than at the start. This reduces initial load time. Example: 3.…