Skip to main content
SYSTEM INTEGRATION AND
ARCHITECTURE 2
PREPARED BY:
SHERILYN PADILLA-TOBIAS
LECTURE 1: MICROSERVICES ARCHITECTURE
1.1 Introduction to Monolithic & Microservices Architecture
1.2 Characteristics and Benefits of Microservices
1.3 Challenges of Microservices
1.4 Design Principles: Single Responsibility, Decentralized Data
Management
1.5 Use Cases and Industries Adopting Microservices
MONOLITHIC
AND
MICROSERVICES ARCHITECTURES
MONOLITHIC ARCHITECTURE:
Definition: In a monolithic architecture, an
application is built as a single, tightly integrated unit
where all components are interconnected and run
together as a single codebase.
MICROSERVICES ARCHITECTURE
Definition:
Microservices architecture is an approach to software
design and development where a complex
application is decomposed into a set of small, loosely
coupled services that can be developed, deployed,
and scaled independently.
VS
MONOLITHIC PRO’S
&
MICROSERVICES CON’S
SIMPLICITY OF DEVELOPMENT:
• Monolithic (Pros): Developing and maintaining a single
codebase is simpler and requires less overhead in terms of
managing multiple services and communication between
them.
• Microservices (Cons): Microservices involve the complexity of
distributed systems, which can make development and
debugging more challenging.
EASE OF LOCAL TESTING
• Monolithic (Pros): Testing a monolithic application is
often easier since all components run within the same
process, simplifying debugging and local testing.
• Microservices (Cons): In microservices, testing often
requires more complex setups due to the distributed
nature of the architecture.
LOWER LATENCY:
• Monolithic (Pros): Communication within a monolithic
application typically involves lower latency compared
to network communication between microservices.
• Microservices (Cons): Inter-service communication in
microservices can introduce additional latency,
especially in scenarios with high request volume.
SYNCHRONIZATION AND TRANSACTIONS:
• Monolithic (Pros): Maintaining data consistency and enforcing
transactions across the entire application is more
straightforward in monolithic databases.
• Microservices (Cons): Implementing distributed transactions
and ensuring data consistency can be complex in a
microservices architecture.
DEPLOYMENT SIMPLICITY
• Monolithic (Pros): Deploying a single application is generally
less complex than coordinating the deployment of multiple
microservices.
• Microservices (Cons): Deploying microservices may require
additional tooling and processes for orchestration and version
management.
SINGLE CODEBASE:
• Monolithic (Pros): Working with a single
codebase can simplify version control and
codebase management.
• Microservices (Cons): In microservices,
multiple codebases need to be maintained,
which can be more challenging to manage.
MICROSERVICES PRO’S
&
MONOLITHIC CON’S
SCALABILITY
• Microservices (Pros): You can independently scale
individual microservices to handle increased loads,
optimizing resource usage.
• Monolithic (Cons): Scaling in a monolithic architecture
often requires scaling the entire application, which can be
inefficient and costly.
FLEXIBILITY IN TECHNOLOGY STACK:
• Microservices (Pros): Each microservice can use the most
suitable technology stack for its specific task, allowing for
innovation and flexibility.
• Monolithic (Cons): In a monolithic application, you're typically
locked into a single technology stack for the entire system,
limiting your choices.
EASE OF MAINTENANCE:
• Microservices (Pros): Updates and maintenance
can be performed on individual microservices
without affecting the entire system.
• Monolithic (Cons): Making changes in a monolithic
codebase can be risky, as a small error can impact
the entire application.
FASTER DEVELOPMENT:
• Microservices (Pros): Different teams can work
concurrently on separate microservices, speeding up
development.
• Monolithic (Cons): In a monolithic system,
coordination among developers working on different
features can be challenging and time-consuming.
ISOLATION OF FAILURES:
• Microservices (Pros): Failures in one microservice are
less likely to impact the entire application because of
their isolation.
• Monolithic (Cons): A bug or failure in one part of a
monolithic application can potentially bring down the
entire system.
CONTINUOUS DEPLOYMENT:
• Microservices (Pros): Microservices can be
independently deployed, enabling continuous
delivery and faster release cycles.
• Monolithic (Cons): In monolithic systems, deploying
updates can be a complex process, often requiring
downtime.
EASIER TESTING:
• Microservices (Pros): Testing individual
microservices is more straightforward and can be
automated effectively.
• Monolithic (Cons): Comprehensive testing in
monolithic applications can be time-consuming
and complex.
WHEN TO USE EACH ARCHITECTURE?
USE MONOLITHIC WHEN:
• Building a new app (faster to get started)
• Small team (less coordination overhead)
• Simple application with few features
• Learning software development
Example: A startup's first product, a class project, a simple
internal tool
USE MICROSERVICES WHEN:
• Large, complex application with many features
• Millions of users
• Multiple teams working independently
• Different parts need different scaling
• High reliability required (can't afford downtime)
• Application is mature and stable
Example: Netflix, Uber, Amazon, Spotify, Facebook
CONCLUSION:
The choice between monolithic and microservices architectures
depends on factors such as the application's complexity,
scalability requirements, development team structure, and
deployment needs. While monolithic architectures can simplify
certain aspects of development, microservices architectures
offer greater flexibility, scalability, and maintenance advantages,
particularly in complex and rapidly evolving systems.
Microservices Design
Phase
1. SYSTEM UNDERSTANDING
Questions:
• What is the purpose of the
system?
• What problems should it
solve?
• Who will use the system?
• What are the main business
needs?
Output:
✓Business
requirements
✓ System goals
EXAMPLE: FACEBOOK
Questions
• What is the purpose of Facebook?
• Who uses Facebook?
• What problems does Facebook solve?
• What features do users need?
GATHER FUNCTIONAL AND NON-FUNCTIONAL
REQUIREMENTS
Functional Requirements:
• Users can create an account.
• Users can post photos and
videos.
• Users can like and comment
on posts.
• Users can send messages.
Non-Functional
Requirements:
• Fast loading of posts.
• Secure user accounts.
• Available 24/7 worldwide.
2. BUSINESS DOMAIN ANALYSIS
Goal: Identify the main business functions.
Example:
Questions:
✓What business capabilities exist?
✓What are the major workflows?
✓Who are the stakeholders?
✓How does the business operate?
Output: Business Capabilities
Business Processes
EXAMPLE: FACEBOOK
Questions:
• What features does
Facebook provide?
• What activities do users
perform?
•User Registration
•Posting Content
•Messaging
•Notifications
•Reactions (Likes)
3. IDENTIFY MICROSERVICES
Goal:
Divide the system into small services.
Output:
List of Microservices
EXAMPLE: FACEBOOK
4. DEFINE SERVICE RESPONSIBILITIES
Goal:
Decide what each service can do.
Output:
Service Boundaries
EXAMPLE: FACEBOOK
User Service → Manages user accounts
Post Service → Creates and stores posts
Message Service → Handles chat messages
Notification Service → Sends alerts
5. DESIGN COMMUNICATION
Goal:
Decide how services talk to each other.
Output:
API Design
Communication Flow
EXAMPLE: FACEBOOK
When a user likes a post:
User
↓
Like Service
↓
Notification Service6
↓
Post Owner Receives Notification
6. DESIGN DATA FLOW
Goal:
• Understand how data moves between services.
Output:
Data Flow Diagram (DFD)
Data Movement Description
Service Interaction Flow
WHAT IS DATA FLOW?
Data Flow shows how information moves
from one user, service, or database to
another.
In microservices, data does not stay in one
place. It travels between services.
FACEBOOK EXAMPLE: CREATING A POST
Step 1: User Creates a Post
Anna uploads a photo and writes: "Enjoying my
vacation!“
Data Generated:
• User ID
• Photo
• Caption
• Date and Time
FACEBOOK EXAMPLE: CREATING A POST
Step 2: Post Service
Receives the Data
• Post Service
Responsibilities
• Validate the post
• Check whether Anna is
logged in
• Process the uploaded
photo
User
↓
Post Service
FACEBOOK EXAMPLE: CREATING A POST
Step 3:
Post Service Stores
the Data
Stored Data:
FACEBOOK EXAMPLE: CREATING A POST
Step 4: Notification
Service is Triggered
Message sent:
User 1001 created
a new post.
Post Service
↓
Notification
Service
FACEBOOK EXAMPLE: CREATING A POST
Step 5:
Notification Service
Alerts Friends
Notification Service
↓
User's Friends
COMPLETE DATA FLOW
User
↓
Post Service
↓
Post Database
↓
Notification Service
↓
User’s Friends
7. DESIGN DATA STORAGE
Purpose:
Determine where data will be stored.
Output
Database Design
Data Ownership Rules
FACEBOOK MICROSERVICES DATABASE DESIGN
CONCEPT
EXAMPLE: FACEBOOK
1.User Database:
Stores user account
information.
Users Table
• UserID(PK)
• FirstName
• LastName
• Email
• Password
• DateCreated
EXAMPLE: FACEBOOK
2. Post Database:
Stores post created by
users.
Post Table
• PostID (PK)
• UserID
• Caption
• PhotoURL
• DatePosted
EXAMPLE: FACEBOOK
3. Message Database:
Stores chat messages.
Message Table
• MessageID(PK)
• SenderID
• ReceiverID
• MessageText
• DateSent
EXAMPLE: FACEBOOK
4. Like Database:
Stores likes on posts..
Like Table
• LikeID(PK)
• PostID
• UserID
• DateLiked
EXAMPLE: FACEBOOK
5. Notification Database:
Stores notifications sent to
users.
Notification Table
• NotificationID(PK)
• UserID
• Message
• DateCreated
• Status
8. DEPLOYMENT & TESTING
Purpose:
Build the system, deploy them, and make
sure they work correctly.
9. MONITORING & MAINTENANCE
Purpose
Keep the system healthy after deployment.
Activities
• Monitor system performance
• Check for errors.
• Fix bugs.
• Add new features.
API’S AND MICROSERVICES
APPLICATION PROGRAMMING INTERFACE (API)
• API (Application Programming Interface) is a set of
rules, protocols, and tools that allows different
software systems to communicate and interact with
each other. It defines how requests and data should be
exchanged between systems, enabling them to work
together seamlessly without needing to know the
internal details of each system.
WHY ARE API’S IMPORTANT IN MODERN
SOFTWARE?
• Flexibility: Developers can build different parts
independently.
• Modularity: Software is broken into pieces that can work
together.
• Scalability: Systems can grow by adding or updating parts
without rewriting everything.
COMMON API CALL TYPES:
• GET: Gets or fetches information from a service.
• POST: Sends new information to create something in
the service.
• PUT/PATCH: Changes or updates information that’s
already there.
• DELETE: Removes or deletes information from the
service.
How the API works step-by-step in this social media app example:
• GET: When you open the app to see your news feed or profile, the app
sends a GET request to the server asking, “Please send me the latest posts
or my profile details.” The server then responds by sending back that
information, which the app displays for you.
• POST: When you write a new post or upload a photo, the app sends a POST
request to the server with the new content. This tells the server, “Here is
new data to add,” so the server saves your post or photo and makes it
visible to others.
• PUT/PATCH: If you update your profile info or edit a post, the app sends a
PUT or PATCH request with the updated details. This tells the server, “Please
change the existing information to this new version,” so the server updates
the data accordingly.
• DELETE: When you delete a post or comment, the app sends a DELETE
request to the server saying, “Please remove this item.” The server then
deletes it from the database so it no longer appears in your feed.
CHALLENGES OF MICROSERVICE
SERVICE COORDINATION:
As the number of services increases, managing inter-
service communication and coordination becomes more
complex. Service interactions, such as synchronous and
asynchronous communication, event-driven
architectures, and data consistency across services, need
to be carefully designed and implemented.
DATA MANAGEMENT:
Data management becomes more challenging in a
microservices architecture. Each service may have its own
database, leading to data duplication and potential data
consistency issues. Implementing strategies for data
synchronization, eventual consistency, and maintaining
data integrity across services is crucial.
DISTRIBUTED SYSTEM COMPLEXITY:
Microservices architecture introduces the
complexity of managing a distributed system.
Issues such as network latency, partial failures,
message delivery guarantees, and distributed
transactions need to be carefully addressed to
ensure the overall system's reliability and stability.
OPERATIONAL OVERHEAD:
With multiple services running independently,
operational tasks such as monitoring, logging,
deployment, and scaling become more
complex.
SERVICE DISCOVERY AND ORCHESTRATION:
As the number of services grows, service discovery and
orchestration become crucial. Tools and mechanisms for
service registration, discovery, load balancing, and
routing need to be implemented to ensure seamless
communication and scalability.
TESTING COMPLEXITY:
Testing a microservices architecture requires more
comprehensive and sophisticated testing strategies.
Apart from unit testing individual services, integration
testing, end-to-end testing, and testing service
interactions become important. Setting up test
environments and data management for testing can be
challenging.
ORGANIZATIONAL AND TEAM ALIGNMENT:
Microservices architecture requires teams to be
organized around specific services or functional areas.
Coordinating and aligning the efforts of multiple teams,
managing inter-team dependencies, and maintaining
consistent development practices across teams can be
challenging.
OPERATIONAL MONITORING AND
OBSERVABILITY:
Monitoring and gaining visibility into a distributed system
can be more complex in a microservices architecture.
Capturing and analyzing logs, metrics, and traces across
multiple services becomes crucial for troubleshooting,
performance optimization, and ensuring system health.
DEPLOYMENT COMPLEXITY:
Deploying and managing multiple services,
potentially using different technologies and versions,
can be complex. Adopting containerization and
orchestration tools like Docker and Kubernetes can
help streamline the deployment process, but they
also introduce their own learning curve and
operational challenges.
1.5 USE CASES AND INDUSTRIES
ADOPTING MICROSERVICES
USE CASES AND INDUSTRIES ADOPTING
MICROSERVICES
E-commerce Platforms:
Online retailers use microservices to manage
product catalogs, payments, recommendations,
and customer accounts independently,
facilitating rapid changes and updates.
USE CASES AND INDUSTRIES ADOPTING
MICROSERVICES
Finance and Banking:
Microservices enable financial institutions
to build agile systems for account
management, payment processing, risk
assessment, and fraud detection.
USE CASES AND INDUSTRIES ADOPTING
MICROSERVICES
Travel and Hospitality:
Booking systems, reservations, loyalty programs,
and customer reviews can be efficiently managed
through microservices, offering better user
experiences.
USE CASES AND INDUSTRIES ADOPTING
MICROSERVICES
Healthcare:
Healthcare providers utilize microservices to
develop interoperable systems for electronic
health records (EHR), patient management,
appointment scheduling, and telemedicine.
USE CASES AND INDUSTRIES ADOPTING
MICROSERVICES
Entertainment and Media:
Streaming platforms, content delivery, user
profiles, and recommendation engines
benefit from microservices' ability to
handle high volumes of data and user
interactions
USE CASES AND INDUSTRIES ADOPTING
MICROSERVICES
Gaming:
Online gaming companies use microservices
for game logic, matchmaking, player profiles,
leaderboards, and real-time updates.
USE CASES AND INDUSTRIES ADOPTING
MICROSERVICES
Logistics and Transportation:
Microservices assist in building scalable systems
for route optimization, tracking, inventory
management, and supply chain visibility.
USE CASES AND INDUSTRIES ADOPTING
MICROSERVICES
Manufacturing:
Manufacturing industries adopt microservices
for production line control, quality assurance,
inventory management, and predictive
maintenance.
USE CASES AND INDUSTRIES ADOPTING
MICROSERVICES
Telecommunications:
Telecom companies utilize microservices to
develop services like billing, customer
support, network management, and
provisioning.
USE CASES AND INDUSTRIES ADOPTING
MICROSERVICES
Energy and Utilities:
Microservices help in monitoring and
controlling infrastructure, managing
energy distribution, and optimizing
resource usage
USE CASES AND INDUSTRIES ADOPTING
MICROSERVICES
Government and Public Services:
Government agencies use microservices to
modernize citizen services, such as tax filing, permit
applications, and information dissemination.
End of Chapter I
Stay curious, remain diligent, and
approach each new chapter with
enthusiasm.
Remember that the journey of learning
is a continuous one, and your
commitment to it will undoubtedly
lead you to remarkable
accomplishments.