Lecture 5 System Design
Lecture 5 System Design
Lecture 5:
System design
Acknowledgement
1
26/9/24
Outlines
• System architecture
• Three popular architectural styles
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
• Security
• Performance
Design
The requirements describe the function of a system as
seen by the client.
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
2
26/9/24
Design
We have already
looked at user
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
interface design.
3
26/9/24
System Architecture
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
10
4
26/9/24
System Architecture
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
11
12
5
26/9/24
Subsystems
A subsystem is a grouping of elements that form part of a
system.
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
13
Component
OrderForm
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
14
6
26/9/24
16
18
7
26/9/24
Package
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
JavaScript
19
Node
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
Server
20
8
26/9/24
Web server
Web browser
21
Deployment Diagram
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
nodes
PersonalComputer DeptServer
WebBrowse WebServer
r
component
s
22
9
26/9/24
WebBrowser WebServer
HTTP
dependency realization
interface
23
WebServer
Get Post
24
10
26/9/24
Architectural Styles
An architectural style is system architecture that recurs
in many different applications.
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
See:
• [Link]
software-architecture-tools-design-definition-
•
explanation-best
• Mary Shaw and David Garlan, Software
architecture: perspectives on an emerging
discipline. Prentice Hall, 1996
• David Garlan and Mary Shaw, An Introduction to
Software Architecture. Carnegie Mellon University, 1994
[Link]
[Link]
25
26
11
26/9/24
27
Input Transactions
components
Repository
28
12
26/9/24
Repository
This is sometimes
called a “glue” layer Data Store
29
Time-Critical Systems
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
31
13
26/9/24
Spawned
Daemon
process
32
33
14
26/9/24
An Exam Question
A company that makes sports equipment decides to
create a system for selling sports equipment online. The
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
An Exam Question
a) For the system architecture of Phase 1:
a.i) Draw a UML deployment diagram.
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
ShoppingServer
Product DB
PersonalComputer
Ordering
WebBrowser system
Customer DB
35
15
26/9/24
An Exam Question
(a) For the system architecture of Phase 1:
[Link]). Draw a UML interface diagram.
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
Product DB
WebBrowser Ordering
system
Customer DB
36
An Exam Question
(b) For Phase 1:
b.i). What architectural style would you use for the
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
customer database?
Repository with Storage Access Layer
[Link]). Why would you choose this style?
It allows the database to be replaced without
changing the applications that use the database.
37
16
26/9/24
An Exam Question
(b) For Phase 1:
[Link]). Draw an UML diagram for this architectural style
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
Customer DB
optional
Data Store
38
Outlines
• System architecture
• Three popular architectural styles
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
• Security
• Performance
39
17
26/9/24
Three-Tier Architecture
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
40
Example 1:
Batch Processing with Master File Update
• Electricity utility customer billing (e.g., NYSEG)
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
41
18
26/9/24
43
First Attempt
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
44
19
26/9/24
45
errors
Master file
46
20
26/9/24
DataInput EditCheck
RawData ValidData
MasterFile
Check
47
errors
Reports
Validated Sort by
transactions account
in batches Batches of
Master file Bills
input data
update
Checkpoints and
audit trail
48
21
26/9/24
49
Advantages:
Efficient way to process batches of transactions.
Disadvantages:
Information in master file is not updated
immediately. No good way to answer customer
inquiries.
50
22
26/9/24
Online Inquiry
A customer calls the utility and speaks to a customer
service representative.
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
Customer service
Representative
read only
New
transaction
Master file
51
AnswerCustomer
<<uses>>
CustomerRe NewTransactio
p n
52
23
26/9/24
Customer
service
Advantage:
Efficient way to answer customer inquiries.
Disadvantage:
Information in master file is not updated
immediately.
53
54
24
26/9/24
Data
Web browser Server
Advantage:
Server-side code can configure pages, access data,
validate information, etc.
Disadvantage:
All interaction requires communication with server
55
56
25
26/9/24
Component Diagram
Database
WebBrowser WebServer Server
HTTP ODBC
57
User
58
26
26/9/24
59
html
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
Java Data
Script
Server
Web browser
27
26/9/24
61
designs.
• Some are system architectures, where the model, view, and
controller are separate components.
• Some are program designs, with classes called model,
view, and controller.
We will look at three variants:
• An MVC system architecture used in robotics.
• A general purpose MVC system architecture used for
interactive systems.
• Apple’s version of MVC as a program design for mobile apps.
62
28
26/9/24
Model/View/Controller in Robotics
Example: Control of an unmanned model aircraft
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
Model
Aircraft
View Controller
State Model
State
query change
View control
View Controller
64
29
26/9/24
Model
The model records the state of the application and
notifies subscribers. It does not depend on the
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
66
View
The view is the part of the user interface that presents
the state of the interface to the user. It subscribes to
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
67
30
26/9/24
Controller
The controller is the part of the user interface that
manages user input and navigation within the application.
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
68
State Model
State
query change
External
View control services
View Controller
69
31
26/9/24
User Controller
action Notify
Update Update
View Model
70
71
32
26/9/24
72
73
33
26/9/24
Outlines
System architecture
Three popular architectural styles
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
Security
Performance
74
75
34
26/9/24
development
"Practical security balances the cost of protection and
the risk of loss, which is the cost of recovering from a
loss times its probability... When the risk is less than the
cost of recovering, it’s better to accept it as a cost of
doing business ... than to pay for better security."
"Many companies have learned that although people may
complain about inadequate security, they won’t spend
much money, sacrifice many features, or put up with
much inconvenience to improve it."
Butler W. Lampson, 2004
77
35
26/9/24
78
79
36
26/9/24
80
81
37
26/9/24
External Intruders
All network systems are vulnerable to security
breaches by external intruders:
• financial
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
• malicious
• secrets
• and worse
Modern software is so complex that it is impossible to
eliminate all vulnerabilities.
Many skilled individuals and organizations are continually
seeking to discover and exploit new vulnerabilities.
82
External Intruders
Examples of external security vulnerabilities:
• unauthorized access — modify software, install
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
listening devices
• backdoors — bypass authentication
• denial of service — overload and other forms of
blocking
• eavesdropping
• spoofing
• phishing etc., etc.
This list is derived from Wikipedia
83
38
26/9/24
a major difference.
How to minimize the risks:
• System design — secure protocols, authentication,
barriers to access
• Programming — defensive programming and rigorous
testing
• Operating procedures — backup, auditing,
vulnerability testing
• Training and monitoring personnel
84
85
39
26/9/24
a network
• Firewalls
• Require authentication to access certain systems or
parts of systems
Every barrier imposes restrictions on permitted uses of
the system.
Barriers are most effective when the system can be
divided into subsystems.
Example: Integration of Internet Explorer into Windows
86
Barriers: Firewall
Public Private
network network
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
Firewall
87
40
26/9/24
88
Example:
An Access Architecture for Digital Content
User
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
Authentication
Role
89
41
26/9/24
X Y
Decryption
Y X
90
91
42
26/9/24
92
43
26/9/24
Java/JavaEE, [Link]
• Input handling
• Authentication & session management
• Access control (authorization)
• Java types & JVM management
• Application faults & logging
• Encryption services
• Concurrency and threading
• Connection patterns
94
95
44
26/9/24
96
Operations: Recovery
Sooner or later every system fails because of hardware,
software, operational, or security problems.
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
97
45
26/9/24
Conclusion
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
98
Outlines
System architecture
Three popular architectural styles
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
Security
Performance
99
46
26/9/24
hardware
Yet performance is important
A single bottleneck can slow down an entire system
Future loads may be much greater than predicted
100
101
47
26/9/24
High-Performance Computing
High-performance computing:
• Large data collections (e.g., Amazon)
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
102
Tasks
• Predict performance problems before a system is
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
implemented.
• Design and build a system that is not vulnerable to
performance problems.
• Identify causes and fix problems after a system is
implemented.
103
48
26/9/24
Examples
• In a distributed system, what messages pass between
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
nodes?
• How many times must the system read from disk for
a single transaction?
• What buffering and caching is used?
• Are operations in parallel or sequential?
• Are other systems competing for a shared resource
(e.g., a network or server farm)?
• How does the operating system schedule tasks?
105
49
26/9/24
106
107
50
26/9/24
108
=
mean service time for a transaction
mean inter-arrival time of transactions
109
51
26/9/24
• Simulation
All require detailed understanding of the interaction
between software and hardware systems.
110
Mathematical Models
Queueing theory
Good estimates of congestion can be made for single-
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
111
52
26/9/24
Examples
• Requests to read from a disk (with no buffering or
other optimization)
• Customers waiting for check in at an airport, with
a single check-in desk
112
Queues
Multi-server queue
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
Examples
• Tasks being processed on a computer with several
processors
• Customers waiting for check in at an airport, with
a several check-in desks
113
53
26/9/24
Techniques: Simulation
Build a computer program that models the system as set
of states and events.
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
114
mean
delay
before
service
begins
Utilization of
0 1 service
115
54
26/9/24
116
total MB/s
average / CPU
117
55
26/9/24
118
119
56
26/9/24
120
• in 12 years = 20:1
• in 24 years = 500:1
Magnetic media: cost/performance improves 40% / year
• in 12 years = 50:1
• in 24 years = 3,000:1
These assumptions are conservative. During some periods, the
increases have been considerably faster.
Recently, the rate of performance increase in individual
components, such as CPUs, has slowed down, but the overall
rate of increase has been maintained by placing many CPU cores
on a single chip.
121
57
26/9/24
122
2017 2027
Processors 2 x 2.5 GHz 8 x 10 GHz or 100
processors?
Memory 8 GB 200 GB
Disc 500 GB 15 TB
Network 1 Gb/s 25 Gb/s
123
58
26/9/24
Parkinson's Law
Original:
Work expands to fill the time available. (C. Northcote
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
Parkinson)
Software development version:
(a) Demand will expand to use all the hardware
available.
(b) Low prices will create new demands.
(c) Your software will be used on equipment that you
have not envisioned.
124
125
59
26/9/24
1965 Today
126
What
Assoc. Prof. Nguyen Thi Thuy Loan, PhD
level?
127
60
26/9/24
128
61