Home > Courses > Microservice Programming (VU-CSS 325) > Introduction to Microservices

Introduction to Microservices

Subject: Microservice Programming (VU-CSS 325)
Microservices programming is an architectural approach to software development where a large application is built as a suite of small, independent, and modular services. Each service runs its own process, manages its own database, and communicates with others via lightweight mechanisms, such as HTTP/REST APIs (Application Programming Interface) or message brokers. This paradigm allows teams to develop, deploy, and scale services independently, enhancing agility and resilience.





Evolution from Monoliths to Microservices


Monolithic Architecture


In a monolithic system, the entire application is built as one single unit.
- User interface, business logic, and database access are all tightly coupled
- Deployed as one package
- Example: A banking app where login, payments, notifications, and reports all live in one codebase

Problems with Monoliths


- Hard to scale: You must scale the whole application even if only one feature needs more resources
- Slow development: A small change requires rebuilding and redeploying the entire system
- Technology lock-in: You’re stuck with one programming language or framework
- Risky deployments: One bug can bring down the entire system

Transition Phase: Modular Monolith


Before microservices, many teams tried:
- Splitting code into modules
- Improving separation of concerns
This helped, but deployment and scaling were still tightly coupled.

Microservices Architecture


Microservices break a system into small, independent services, each responsible for a single business capability.

Example:
- Authentication Service
- Payment Service
- Notification Service
- User Profile Service

Each service:
- Runs independently
- Has its own database
- Can be deployed separately

This evolution was driven by:
- Cloud computing
- DevOps culture
- Need for faster innovation (Agile & CI/CD - Continuous Integration/Continuous Delivery or Deployment)

Characteristics of Microservices Architecture


1. Small and Focused Services: each service does one thing well (Single Responsibility Principle). For example, a “Payment Service” should not handle user authentication.
2. Independent Deployment: services can be updated without affecting others, therefore reduces downtime and deployment risk.
3. Decentralized Data Management: each microservice owns its own database; that is, no shared database across services, this prevents tight coupling and improves scalability.
4. Technology Diversity: different services can use different programming languages, frameworks or databases. For example, auth service can be developed using .NET and C# with Microsoft SQL Server database, while the analytics service built with Python programming language and PostgreSQL database
5. Communication via APIs: services communicate using REST APIs or Message queues (RabbitMQ, Kafka)
6. Fault Isolation: if one service fails others continue to work; that is, the entire system does not collapse




Advantages of Microservices


1. Scalability: scale only the services that need more resources.
2. Agility: faster development cycles; teams work independently.
3. Resilience: failures are contained within individual services.
4. Flexibility: polyglot programming and persistence (different tech stacks per service).
5. Continuous Delivery: easier to roll out updates without affecting the whole system.

Disadvantages of Microservices


1. Increased Complexity: managing many services is harder than managing one. Therefore it requires good system design
2. Network Latency: services communicate over a network, therefore slower than in-process method calls
3. Data Consistency: distributed data makes transactions harder i.e transactions across services are complex, may requires patterns like Saga
The Saga pattern in microservices manages distributed transactions by breaking a large process into a series of smaller, local transactions, each updating its own service's database. If any local step fails, compensating transactions are executed to undo previous successful steps, ensuring data consistency across services without global locks, similar to a vacation booking where canceled flights trigger canceled hotel reservations.
4. DevOps Overhead: It needs CI/CD pipelines and requires monitoring, logging, and containerization
5. Skilled Team Requirement: developers must understand distributed systems, cloud infrastructure and API security. Requires strong DevOps culture and communication

Real-World Use Cases and Industry Adoption


1. Netflix: Pioneer in microservices; uses hundreds of services for streaming, recommendations, billing, etc.
2. Amazon: Migrated from monolith to microservices to handle millions of transactions daily.
3. Uber: Uses microservices for ride-matching, payments, notifications, and driver management.
4. Spotify: Employs microservices for music streaming, playlist management, and social features.
5. Finance & Banking: Microservices enable modular systems for payments, fraud detection, and customer management.
6. Healthcare: Supports patient record management, appointment scheduling, and telemedicine services.
7. E-commerce: Platforms like eBay and Shopify use microservices for product catalogs, orders, and inventory.

Summary


Microservices represent a modern approach to building scalable, resilient, and agile applications. They evolved from monolithic systems to address scalability and deployment challenges. While they bring significant benefits, they also introduce complexity that requires robust infrastructure, monitoring, and team practices. Their widespread adoption across industries highlights their effectiveness in handling large-scale, dynamic systems.

By: Vision University

Comments

No Comment yet!

Login to comment or ask question on this topic




  • 1 Introduction to Microservices