0% found this document useful (0 votes)
59 views

Software Engineering (Week-6)

The document discusses software quality attributes like performance, scalability, and reliability. It defines these attributes and provides examples. It then discusses how to design application architecture and scale it up to a system architecture for large e-commerce systems. Key considerations for system architecture include latency, scalability, availability, security, and modularity through specialized services.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views

Software Engineering (Week-6)

The document discusses software quality attributes like performance, scalability, and reliability. It defines these attributes and provides examples. It then discusses how to design application architecture and scale it up to a system architecture for large e-commerce systems. Key considerations for system architecture include latency, scalability, availability, security, and modularity through specialized services.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 84

SOFTWARE ENGINEERING

(Week-6)

USAMA MUSHARAF
LECTURER (Department of Computer
Science)
FAST-NUCES PESHAWAR
CONTENTS OF WEEK # 6

Software Quality Attributes


 Performance
 Scalability
 Reliability

Application Architecture to System Architecture


Sample System
Performance
Performance
Measure of how fast or responsive a system is
under
A given workload
 Backend data
 Request Volume

A given hardware
 Kind
 capacity
Performance Problems
How to spot a performance problem? How does it
look like?
Performance Principles
Efficiency Caching
◦ Efficient Resource
Utilization
◦ IO- Network, Memory, Disk Concurrency
◦ CPU ◦ Hardware
◦ Software
◦ Queuing
Efficient Logic ◦ Coherence
◦ Algorithms ◦ Capacity
◦ DB Queries

Efficient Data Storage


◦ Data Structures
◦ DB Schema
Performance Objectives
Performance Measurement Metrics
Latency
◦ Affects– User Experience
◦ Desired– As low as possible

Throughput
◦ Affects– Number of users that can
be supported
◦ Desired– Greater than the
request rate

Errors
◦ Affects– Functional Correctness
◦ Desired– None

Resource Saturation
◦ Affects– Hardware Capacity
Required
◦ Desired– Efficient utilization of all
system resources.
Serial Request Latency
Disk Latency - Approaches
Parallel Request (Concurrency)
C(N) = theoretical
speed
Parallel + Serial
Concurrent Processing

C is capacity
N is scaling dimension like CPU or load
Alpha represents resource contention
Beta represents coherence delay

Linear performance when alpha and beta


are zero
Contention
Locking Compatibility Matrix
Coherence

Suppose that two threads are working on SharedObj. If two threads run on
different processors each thread may have its own local copy of sharedVariable.

If one thread modifies its value the change might not reflect in the original one in
the main memory instantly. This depends on the write policy of cache. Now the
other thread is not aware of the modified value which leads to data inconsistency.

“Volatile” keyword in java tells the compiler that the value of a variable must
never be cached as its value may change outside of the scope of the program
itself.
Scalability
Performance vs Scalability
FIXED LOAD VARIABLE LOAD
Performance Scalability
 Low Latency  High Throughput
 High Throughput  Ability of a system to increase its
 Concurrency throughput by adding more
 Single-Machine- Multi-Threading
hardware capacity.
 Both Ways: Up and Down
 Multi-Machine- Multi-Threading +
Multiprocessing = Distributed Processing
Vertical & Horizontal Scalability
Modularity
Scalable architecture starts with Modularity
Provides the foundation for breaking an application into more specialized
functions/services.
Horizontal Scaling Methods
1. Services
2. Replication
1. Stateful
2. Stateless

3. Portioning
1. Vertical / Functionality Portioning
2. Database portioning

4. Asynchronous Calls
Microservices
Reliability
Reliability

Software reliability is defined as the probability of


failure-free operation of a software system for a
specified time in a specified environment.
Partial Failures
Reliability Engineering

1. Reliability
2. Availability
3. Fault Tolerance
Availability
Fault Tolerance
Fault Tolerant Design

1. Redundancy
2. Fault Detection
3. Recovery
Redundancy
Types of Redundancy
Datacenter
Redundancy
Fault Models
Health Checks

External Monitoring
Service
• Ping based

Internal Cluster Monitoring


• Heartbeat based
Application Architecture

57
Assume ‘Architecting’ a big e-commerce system

58
Use Case Model

y s
Wa
ech
w T
Ne

59
Domain Model

ays
c hW
Te
ew
N y s
Wa
ech
w T
Ne

60
Low Level Design

Behavior
State

Code

Static + Transactional

61
Component Model

Client Web Business Logic Database


Tier Tier

62
What About?

High Response Global System &


Availability Latency Customers Data Security

File storage for Mobile Unstructured Data Cloud


Catalog Images Support Storage & Analytics Deployment

63
Going Beyond

Application Architecture To System Architecture

64
Application Architecture Vs System Architecture

System level challenges


surface up in large scale systems

Scale, Reliability, Security, Deployment are


biggest concerns for a large-scale system

65
Latency Requirements

• 10 years ago, Amazon found that every 100ms of


latency cost them 1% in sales

• Now Akamai study shows that every 100-


millisecond delay in website load time can hurt
sales by 6%

• Google found an extra .5 seconds in search page


generation time dropped traffic by 20%

66
Scalability Requirements

• For 100 M products with


10 million requests/day average product
1K to 100K simultaneous users description/image size of 1 MB
• Data Storage = 100M x 1MB =
100 million products
100 TB
Transaction data for last 5
years
• Logs generated and archived
Petabytes of log data • Data Storage => in Petabytes

67
Availability & Reliability Requirements
Unavailability results in
◦ Business loss
◦ Reputation loss

99.95% Availability
◦ Maximum cumulative disruption of 4 hours 22
minutes in a year

99.999999999% Durability for storage


systems
◦ Data once stored is practically never lost

Disaster Recovery
◦ Operations to continue even if a region goes
down due to a natural calamity

68
Security Requirements
Infrastructure protection
◦ Network access
◦ System access
◦ Service access

Data Protection
◦ Data sensitivity classification
◦ Protect data at rest
◦ Protect data on wire
◦ Data backup & replication

Identity & Access Management


◦ Authentication, Authorization

69
Designing System Architecture

70
Scalability Principle

Monolith is an anti-pattern for Scalability

Scalability goes up with


◦ Decentralization
◦ More specialized workers – Services
◦ More workers – Instances, Processors, Threads

◦ Independence
◦ Multiple workers are as good as a single worker if they can’t work
independently
◦ They must work concurrently to maximum extent

71
Modularity
Scalable architecture starts with modularity
◦ Provides the foundation for breaking a system function/service into more
specialized functions/services
Web Browser Web Application Business Application DBMS

View API Protocol Layer

Controller Service Modules:


User
Model Catalog
Order
Inventory

Data Access Layer

72
Specialized Services –
WebServices
Services can be scaled differently e.g., Number of instances

Notification Service Inventory Service

Order Service

Web Application

Catalog Service

User Service

73
Aggregator Service & RESTful
API – Mobile Support
REST for external interface interoperability & Mobile Support

Notification Service Inventory Service

Order Service

Web Application

REST Catalog Service

RESTful
Aggregator/ User Service
Gateway
Service

74
Independent Services –
MicroServices
Micro-Services can be scaled differently and deployed independently

Notification Service Inventory Service

Order Service

Web Application

Catalog Service

Aggregator/
User Service
Gateway
Service

75
Asynchronous Services
Updates can be done asynchronously to buffer peak loads and to reduce
response latency
Notificatio Inventory
n
View Create/Update
Order Order

Web
Applicati Orde Order Order
on r Queue Processi
ng

Catalo
Aggregator/ g
Gateway
Service
User

76
Stateless Replication
Replication provides more computation power

Notificatio Inventory
n

Web
Applicati Orde Order
Order
on r Queue
Processing

Catalo
Aggregator/ g
Gateway
Service
User

77
Reliability Principle

Reliability and Availability are achieved


Reliability mainly through Fault Tolerance
◦ Normal functioning even in
the presence of faults
Fault Tolerance requires
◦ Provisioning Redundancy
Availability
◦ Always available even in the
presence of faults ◦ Fault Detection Mechanisms
◦ Health-checks, heart-beats

78
Single Point Of Failures

Identify all SPOF


◦ Any component that does not have a redundant Power Supply
replica is a SPOF
Notificatio Inventory
n
Discove
ry
Stati
c
HTTP Cache Orde Order Order
Dynami r Queue Processin
c
g

Catalo
HTTP Cache Aggregator g
Service Object
Cache
CDN Session
Cache User

79
Redundancy

Components that are SPOF requires redundancy


Power Supply

Notificatio Inventory
n
Discove
ry
Stati
c
HTTP Cache Orde Order Order
Network Dynami r Queu Processi
c
e ng

Catalo
HTTP Cache Aggregator g
Object
Service Cache
CDN Session
Cache User

80
Monitoring For Fault Detection

Hierarchical Monitoring -> Health Checks


Power Supply
Peer to Peer Monitoring -> Heart Beats
Notificatio Inventory
n
Discove
ry
Stati
c
HTTP Cache Orde Order Order
Network Dynami r Queue Processing
c

Catalo
HTTP Cache Aggregator g
Object
Service Cache
CDN Session
Cache User

81
Zonal Redundancy
Zonal redundancy for fault isolation

Backend Replication
Power Supply

y s
HTTP Cache Wa Zone 1
c h
w Te Zone 2
HTTP Ne
Cach
e
Power Supply
CDN
User

82
Security-Web Application
Firewalls
Multiple security related attacks can be prevented by inspecting requests for
common attacks and vulnerabilities by using Web Application Firewalls

Notificatio
TLS n

Injection Attack
Web Orde
DDoS Attack
Applicati r
Session Hijacking
on

TLS Catalo
Aggregator/ g
Gateway
Service
User
Auth

83
HAVE A GOOD DAY!

You might also like