stock market

What is Software Architecture?

Spread the love

Software architecture is the high-level structure or blueprint of a software system. It defines how different parts of an application are organized, how they communicate with each other.

  • Why its matters: Architecture impacts scalability, performance, and maintainability.
  • Importance in system design and Key design Consideration.
    • Scalability: Ability to handle increased data or traffic.
    • Maintainability: How easily the system can be updated or modified.
    • Performance: Efficiency and responsiveness under load.
  • Keep in mind , the architecture choices you make directly Influence system Behaviour.
Software Architecture pattern and styles.
1. Monolithic Architecture
  • Definition: A system where components communicate through events(message) instead of direct calls, enabling loose coupling.
  • Pros:
    • Highly decoupled architecture.
    • Excellent for handling asynchronous workflows.
    • Better scalability for high-traffic systems.
  • Cons:
    • Debugging and tracing becomes more complex.
    • Difficult to ensure data consistency across services.
  • Use Cases: Real-time systems, IOT applications, financial trading platforms.

Multi-Tier Architecture

  • Multi-Tier Architecture is a software design pattern that structures applications into multiple layers, each responsible for specific functions, this separation enhances scalability, maintainability, and security.
  • Key points:
    • Organizes applications into independent layers.
    • Separates concerns: UI , business logic , and data storage.
    • Enables better scalability, performance, and security.
    • Used in web applications enterprise systems and cloud architecture.
2. Microservices Architecture

Definition: Microservices architecture is a software design pattern where applications are structured as a collection of small, loosely coupled services, each responsible for a specific function.

Characteristics:

  • Independently deployable services
  • Loosely coupled services
  • Scalable and fault tolerant.

1 How to Identify Microservices.

  • Business Capabilities: Each service should align with a specific business function.
  • Single Responsibility Principle: A Microservices should do one thing well.
  • Data Ownership: Each Microservices owns its own database – avoid shared databases.
  • Independently Deployable: should be deployable and scalable without affecting others.
  • How to structure Microservices
  • Decompose by business Domain: Use Domain driven design (DDD) to group services logically.
  • Define clear APIS: Services should communicate via well-defined APIS.
  • Avoid making microservices too large or too small.
  • Implement observably: Use logging, monitoring. And tacking to track service interactions.

2 How to structure Microservices.

  • Decompose by business Domain: Use Domain driven design (DDD) to group services logically.
  • Define clear APIS: Services should communicate via well-defined APIS.
  • Avoid making microservices too large or too small.
  • Implement observably: Use logging, monitoring. And tacking to track service interactions.

3.Communication in Microservices.

  • Synchronous Communication
    • REST APIS (Simple, widely used , but high latency)
    • gRPC (Efficient , binary format, better performance)
  • Asynchronous Communication.
    • Event-Driven Messaging (Kafka, RabbitMQ)

4. Challenges of Microservices 

  • Data Consistency: Distributed database — > Eventually consistency
  • Distributed Tracing: Difficult to debug & track requests.
  • Network Overhead: More Api calls à Increase latency
  • Security: Authentication, authorization, data protection.

5.Scaling strategies in Microservices.

  • Horizontal Scaling: Add more instances of service.
  • Auto-scaling: Scale up/down automatically.
  • Sharding & Database Scaling: split databases for high traffic services.

6. Real World Example of Microservices

  • Netflix: Uses microservices for video streaming & personalization.
  • Uber: Scales ride-matching, payments and navigation independently.
  • Amazon: Each Services run separately.
3. Event Driven Architecture

1. Introduction to Event-Driven Architecture

Definition: A system design where components communicate through events rather than direct calls.

Key Characteristics:

  • Asynchronous
  • Loose coupling
  • Scalability & Flexibility.

Why Used it?.

  • Enhances system responsiveness
  • Enables real-time event processing
  • Supports complex workflows

Synchronous Vs Asynchronous Systems.

  1. Synchronous Communication (Request-response Model)
    1. Blocking calls
    1. Tight coupling
    1. Traditional HTTP Apis
  2. Asynchronous Communication (Event-Driven model)
    1. Non-blocking
    1. Decouple components
    1. Message queue & event brokers

2. Pub-sub vs Event Streaming

  • Publish subscribe Model (pub-sub)et
    • Events are broadcasted to multiple subscribers
    • Each subscriber get the events once.
    • RabbitMq and AWS SNS.
  • Event Streaming
    • Events are stored and consumed in order.
    • Consumer process events at different time.
    • Kafka, AWS Kinesis.

3.Key component of an Event Driven System

  • Event producers (Generate Event)
  • Event Brokers (Transmit and Store events)- Example Kafka, RabbitMQ , Aws
  • Event bridge
  • Event consumers (React to events)
  • Event Storage (Log-based persistence for replaying events)

4. Best Practice

  • Use idempotent event processing to avoid duplicates
  • Implement dead letter queue for failed message
  • Choose the right event broker based on systems needs
  • Ensure event versioning to handle schema changes

5. Use cases of Event-Driven Architecture

  • Logging and Auditing
  • Real time Notification
  • Microservices decoupling
  • IoT System  
  • E- commerce order processing

Leave a Reply

Your email address will not be published. Required fields are marked *