Skip to main content

Posts

Showing posts from 2025

Microservices vs Monolithic Architecture

 Microservices vs Monolithic Architecture Here’s a clear side-by-side comparison between Microservices and Monolithic architectures — from a system design and engineering perspective: Aspect Monolithic Architecture Microservices Architecture Definition A single, tightly coupled codebase where all modules run as one unified application A collection of small, independent services that communicate over the network (e.g., HTTP, gRPC) Codebase Single repository/project Multiple repositories or modular projects per service Deployment Deployed as one unit (e.g., one WAR, JAR, EXE) Each service is deployed independently Scalability Vertical scaling (scale entire app) Horizontal scaling (scale services independently based on load) Technology Stack Generally a unified stack (e.g., Java/Spring, .NET)...

Event-Driven Architecture (EDA) vs Event Sourcing Pattern vs Domain-Driven Design (DDD)

 Event-Driven Architecture (EDA) vs Event Sourcing Pattern vs  Domain-Driven Design (DDD)  Here’s a clear point-by-point comparison of Event-Driven Architecture (EDA) , Event Sourcing Pattern , and Domain-Driven Design (DDD) in a tabular format: Aspect Event-Driven Architecture (EDA) Event Sourcing Pattern Domain-Driven Design (DDD) Definition Architecture style where components communicate via events Pattern where state changes are stored as a sequence of events Software design approach focused on complex domain modeling Primary Purpose Loose coupling and asynchronous communication Ensure complete audit and ability to reconstruct state from events Align software with business domain and logic Data Storage Not the focus – events trigger actions, state stored in services Event store maintains append-onl...

When to use REST, SOA, and Microservices

Here’s a breakdown of the core differences between REST , SOA , and Microservices and when you might choose each: 1. REST (Representational State Transfer) What it is: REST is an architectural style for designing networked applications. It uses HTTP protocols to enable communication between systems by exposing stateless APIs . Key Characteristics: Communication: Uses standard HTTP methods (GET, POST, PUT, DELETE). Data Format: Commonly JSON or XML. Stateless: Every request from the client contains all the information the server needs to process it. Scalability: Highly scalable due to statelessness. Simplicity: Easy to implement and test. Best Use Case: For systems requiring lightweight, simple API communication (e.g., web applications or mobile apps). 2. SOA (Service-Oriented Architecture) What it is: SOA is an architectural style where applications are composed of loosely coupled services that communicate with each other. Services can reuse components and are designed for ...

Securing an Azure SQL Database

 Securing an Azure SQL Database is critical to protect sensitive data and ensure compliance with regulations. Here are some of the best security strategies and practices: 1. Authentication and Access Control Use Microsoft Entra ID (formerly Azure AD) for centralized identity and access management. Implement role-based access control (RBAC) to grant users the least privileges necessary. Avoid using shared accounts and enforce multi-factor authentication (MFA) for all users. 2. Data Encryption Enable Transparent Data Encryption (TDE) to encrypt data at rest automatically. Use Always Encrypted to protect sensitive data, ensuring it is encrypted both at rest and in transit. Enforce TLS (Transport Layer Security) for all connections to encrypt data in transit. 3. Firewall and Network Security Configure server-level and database-level firewalls to restrict access by IP address. Use Virtual Network (VNet) integration to isolate the database within a secure network. Enable Private ...

Build a Redis-like Distributed In-Memory Cache

  This tests: System design depth Understanding of distributed systems Trade-off navigation (CAP, consistency, latency) Real-world edge case handling Let’s go step by step and design Redis-like cache from first principles , not using cloud-managed services. 🚀 Goal: Build a Redis-like Distributed In-Memory Cache 🧾 1. Requirements Gathering (Clarify with interviewer) 🔹 Functional Support GET , SET , DEL , TTL Handle concurrent reads/writes Cache keys across multiple nodes Optional: Support pub/sub, data structures (hash, list) 🔹 Non-Functional Low latency (<1ms typical) High availability & fault tolerance Scalable horizontally Eventual or strong consistency Memory-optimized with TTL eviction Absolutely! Back-of-the-envelope estimations are crucial in system design interviews — they demonstrate your pragmatism , ability to roughly size a system, and to make sound trade-offs . Let’s break it down for your Redis-like...

Design a Global Video Streaming Service (e.g., YouTube, Netflix)

  Design a Global Video Streaming Service (e.g., YouTube, Netflix) Question: Design a scalable and fault-tolerant video streaming platform that can: Stream videos globally with low latency. Allow users to upload videos. Handle millions of users simultaneously. Requirements (functional and non-functional) functional requirement: video upload, video streaming, handle the network bandwidth, video for the different devices like mobile, smart tv, computer non-function : high availability, fault tolerance 1. High-Level Requirements Functional Requirements: Video Upload : Users can upload videos in various formats. Video Streaming : Provide smooth playback with adaptive streaming for different network conditions. Network Bandwidth Handling : Adjust video quality dynamically based on bandwidth. Device Compatibility : Support multiple devices (e.g., mobile, smart TV, computer). Non-Functional Requirements: High Availability : The service should handle millions of concurrent viewers with m...

Scenario: Design a Scalable URL Shortener

Question:  Imagine you are tasked with designing a system similar to Bitly that converts long URLs into short ones. The system should handle billions of URLs and millions of requests per second. Please explain how you would design this system. Requirements: function requirements : shortener, redirection, expiry of url  non-functional : high availability, fault tolerant (like AP from CAP) Step 1: High-Level Design At a high level, the system will have the following components: Frontend Service : Handles user requests for shortening, redirection, and URL expiry. Backend Service : Processes requests, generates short URLs, manages expiration policies, and stores mappings. Database : Stores the short-to-long URL mappings. Cache : Speeds up redirection for frequently accessed URLs. Load Balancer : Distributes incoming traffic evenly across backend servers to handle high availability and fault tolerance. Step 2: Capacity Planning Now, let's expand on capacity planning for this system...

Google system design interview experience

To excel in a system design interview at Google India , you’ll need a structured, methodical approach while demonstrating clarity and confidence. Here’s how you can handle system design questions effectively: 1. Understand the Problem Statement Before diving in, clarify the requirements: Ask questions to understand functional requirements (e.g., "What features does the system need?"). Explore non-functional requirements like scalability, performance, reliability, and security. Example: If asked to design a URL shortener, clarify if analytics tracking or expiration for URLs is required. 2. Start with a High-Level Approach Begin by breaking the problem into logical components . Use simple terms initially: For example: "For a URL shortener, we need to generate short URLs, store mappings, and support quick redirections." Draw a rough block diagram : Show user interaction, application servers, caching layers, databases, etc. Use terms like "user sends request,...